Skip to content

Commit

Permalink
Merge pull request #11 from javierav/prepare-development
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Oct 16, 2024
2 parents 5bbab82 + f41ea03 commit f0f5af5
Show file tree
Hide file tree
Showing 18 changed files with 287 additions and 135 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PATH_add bin
33 changes: 27 additions & 6 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,43 @@
name: Testing
on: push
jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- "3.0"
- "3.1"
- "3.2"
- "3.3"
steps:
- uses: actions/checkout@v4
- name: Setup Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run Rubocop
run: bin/rubocop
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- "3.0"
- "3.1"
- "3.2"
- "3.3"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: rake test
run: bin/rake test
55 changes: 0 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,56 +1 @@
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

# Ignore Byebug command history file.
.byebug_history

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*
20 changes: 20 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
inherit_mode:
merge:
- Exclude

require:
- standard
- standard-performance
- rubocop-performance
- rubocop-minitest
- rubocop-rake

inherit_gem:
standard: config/base.yml
standard-performance: config/base.yml

AllCops:
DisplayCopNames: true
Exclude:
- "**/bin/**/*"
NewCops: enable
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source "https://rubygems.org"

gemspec

gem "benchmark-ips"
gem "irb"
gem "minitest"
gem "rake"
gem "rubocop", require: false
gem "rubocop-minitest", require: false
gem "rubocop-rake", require: false
gem "standard", ">= 1.35.1", require: false
gem "standard-performance", require: false
86 changes: 86 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
PATH
remote: .
specs:
class_variants (0.0.7)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
benchmark-ips (2.14.0)
io-console (0.7.2)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
minitest (5.25.1)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
psych (5.1.2)
stringio
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
standard (1.41.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.66.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.5)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.5.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.22.0)
stringio (3.1.1)
unicode-display_width (2.6.0)

PLATFORMS
arm64-darwin-24
ruby

DEPENDENCIES
benchmark-ips
class_variants!
irb
minitest
rake
rubocop
rubocop-minitest
rubocop-rake
standard (>= 1.35.1)
standard-performance

BUNDLED WITH
2.5.20
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
require "rake/testtask"
require "rubocop/rake_task"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end

task default: :test
RuboCop::RakeTask.new

task default: %i[rubocop test]
10 changes: 5 additions & 5 deletions bench.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# frozen_string_literal: true

require "benchmark/ips"

module ClassVariants
end

require_relative "lib/class_variants/instance"


Benchmark.ips do |x|
button_classes = ClassVariants::Instance.new(
"rounded border-2 focus:ring-blue-500",
variants: {
size: {
sm: "text-xs px-1.5 py-1",
base: "text-sm px-2 py-1.5",
lg: "text-base px-3 py-2",
lg: "text-base px-3 py-2"
},
color: {
white: "text-white bg-transparent border-white",
blue: "text-white bg-blue-500 border-blue-700 hover:bg-blue-600",
red: "text-white bg-red-500 border-red-700 hover:bg-red-600",
red: "text-white bg-red-500 border-red-700 hover:bg-red-600"
},
block: "justify-center w-full",
"!block": "justify-between",
"!block": "justify-between"
},
defaults: {
size: :base,
color: :white,
block: false,
block: false
}
)

Expand Down
7 changes: 7 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "class_variants"
require "irb"

IRB.start
27 changes: 27 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rake", "rake")
27 changes: 27 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rubocop", "rubocop")
38 changes: 18 additions & 20 deletions class_variants.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
require_relative "lib/class_variants/version"

Gem::Specification.new do |s|
s.name = "class_variants"
s.version = ClassVariants::VERSION
s.summary = "Easily configure styles and apply them as classes."
# information
s.name = "class_variants"
s.version = ClassVariants::VERSION
s.summary = "Easily configure styles and apply them as classes."
s.description = "Easily configure styles and apply them as classes."
s.authors = ["Adrian Marin"]
s.email = "[email protected]"
s.files = Dir["{lib}/**/*"]
s.homepage = "https://github.com/avo-hq/class_variants"
s.license = "MIT"
s.authors = ["Adrian Marin"]
s.email = "[email protected]"
s.homepage = "https://github.com/avo-hq/class_variants"
s.license = "MIT"

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if s.respond_to?(:metadata)
s.metadata["bug_tracker_uri"] = "https://github.com/avo-hq/class_variants/issues"
s.metadata["homepage_uri"] = "https://github.com/avo-hq/class_variants"
s.metadata["source_code_uri"] = "https://github.com/avo-hq/class_variants"
else
raise "RubyGems 2.0 or newer is required to protect against " \
"public gem pushes."
end
# metadata
s.metadata["homepage_uri"] = s.homepage
s.metadata["source_code_uri"] = s.homepage
s.metadata["bug_tracker_uri"] = "#{s.homepage}/issues"
s.metadata["changelog_uri"] = "#{s.homepage}/releases"

s.add_development_dependency "benchmark-ips"
end
# gem files
s.files = Dir["lib/**/*", "LICENSE", "README.md"]

# ruby minimal version
s.required_ruby_version = Gem::Requirement.new(">= 3.0")
end
Loading

0 comments on commit f0f5af5

Please sign in to comment.