Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.15.0
24.12.0
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.4
4.0.1
202 changes: 151 additions & 51 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,107 +1,200 @@
PATH
remote: .
specs:
rolemodel_rails (0.23.1)
rolemodel_rails (0.24.0)
rails (> 7.1)

GEM
remote: https://rubygems.org/
specs:
actionpack (7.2.0)
actionview (= 7.2.0)
activesupport (= 7.2.0)
action_text-trix (2.1.16)
railties
actioncable (8.1.2)
actionpack (= 8.1.2)
activesupport (= 8.1.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (8.1.2)
actionpack (= 8.1.2)
activejob (= 8.1.2)
activerecord (= 8.1.2)
activestorage (= 8.1.2)
activesupport (= 8.1.2)
mail (>= 2.8.0)
actionmailer (8.1.2)
actionpack (= 8.1.2)
actionview (= 8.1.2)
activejob (= 8.1.2)
activesupport (= 8.1.2)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (8.1.2)
actionview (= 8.1.2)
activesupport (= 8.1.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actionview (7.2.0)
activesupport (= 7.2.0)
actiontext (8.1.2)
action_text-trix (~> 2.1.15)
actionpack (= 8.1.2)
activerecord (= 8.1.2)
activestorage (= 8.1.2)
activesupport (= 8.1.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (8.1.2)
activesupport (= 8.1.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activesupport (7.2.0)
activejob (8.1.2)
activesupport (= 8.1.2)
globalid (>= 0.3.6)
activemodel (8.1.2)
activesupport (= 8.1.2)
activerecord (8.1.2)
activemodel (= 8.1.2)
activesupport (= 8.1.2)
timeout (>= 0.4.0)
activestorage (8.1.2)
actionpack (= 8.1.2)
activejob (= 8.1.2)
activerecord (= 8.1.2)
activesupport (= 8.1.2)
marcel (~> 1.0)
activesupport (8.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.3)
base64 (0.2.0)
bigdecimal (3.1.8)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (4.0.1)
builder (3.3.0)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
concurrent-ruby (1.3.6)
connection_pool (3.0.2)
crass (1.0.6)
date (3.5.1)
diff-lcs (1.5.0)
drb (2.2.1)
erubi (1.13.0)
drb (2.2.3)
erb (6.0.1)
erubi (1.13.1)
generator_spec (0.10.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
i18n (1.14.5)
globalid (1.3.0)
activesupport (>= 6.1)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.14.0)
io-console (0.8.2)
irb (1.16.0)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.12.2)
json (2.18.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.6.0)
loofah (2.22.0)
logger (1.7.0)
loofah (2.25.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mini_portile2 (2.8.7)
minitest (5.25.0)
nokogiri (1.16.7)
mail (2.9.0)
logger
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (6.0.1)
prism (~> 1.5)
net-imap (0.6.2)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.1)
net-protocol
nio4r (2.7.5)
nokogiri (1.19.0)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.8.0)
ast (~> 2.4.1)
racc
prism (1.4.0)
psych (5.1.2)
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.9.0)
psych (5.3.1)
date
stringio
racc (1.8.1)
rack (3.1.7)
rack-session (2.0.0)
rack (3.2.4)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack-test (2.2.0)
rack (>= 1.3)
rackup (2.1.0)
rackup (2.3.1)
rack (>= 3)
webrick (~> 1.8)
rails-dom-testing (2.2.0)
rails (8.1.2)
actioncable (= 8.1.2)
actionmailbox (= 8.1.2)
actionmailer (= 8.1.2)
actionpack (= 8.1.2)
actiontext (= 8.1.2)
actionview (= 8.1.2)
activejob (= 8.1.2)
activemodel (= 8.1.2)
activerecord (= 8.1.2)
activestorage (= 8.1.2)
activesupport (= 8.1.2)
bundler (>= 1.15.0)
railties (= 8.1.2)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.2.0)
actionpack (= 7.2.0)
activesupport (= 7.2.0)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (8.1.2)
actionpack (= 8.1.2)
activesupport (= 8.1.2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
tsort (>= 0.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.0.6)
rdoc (6.7.0)
rake (13.3.1)
rdoc (7.1.0)
erb
psych (>= 4.0.0)
tsort
regexp_parser (2.10.0)
reline (0.5.9)
reline (0.6.3)
io-console (~> 0.5)
rspec (3.11.0)
rspec-core (~> 3.11.0)
Expand Down Expand Up @@ -138,30 +231,37 @@ GEM
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
securerandom (0.3.1)
stringio (3.1.1)
thor (1.3.1)
securerandom (0.4.1)
stringio (3.2.0)
thor (1.5.0)
timeout (0.6.0)
tsort (0.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
useragent (0.16.10)
webrick (1.8.1)
zeitwerk (2.6.17)
unicode-emoji (4.2.0)
uri (1.1.1)
useragent (0.16.11)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.7.4)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.3)
benchmark
bundler (~> 4)
generator_spec (~> 0.10)
rake (~> 13.0)
rake (~> 13)
rolemodel_rails!
rspec (~> 3.11)
rspec (~> 3)
rspec_junit_formatter
rubocop
rubocop-rails

BUNDLED WITH
2.4.10
4.0.5
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,10 @@ bin/rails g

Install the versions of Node and Ruby specified in `.node-version` and `.ruby-version` on your machine. https://asdf-vm.com/ is a great tool for managing language versions. Then run `npm install -g yarn`.

We use the embeded Rails apps [Rails 8 Example](./recreate_rails8_example) to test the usage of the generators.
We use the embeded Rails apps (`example_rails*`) to test generators against. They reference the rolemodel_rails gem by local path,
so you can navigate into one of them and run your generator for immediate feedback while developing.

`recreate_rails8_example` is simply a freshly generated Rails 8 app. To recreate it use:

```shell
bin/recreate_rails8_example
```

Then, cd into `example_rails8` and run a rolemodel generator to see how it affects a new Rails 8 project. For example:

```shell
cd example_rails8
bin/rails g rolemodel:webpack
```
Before submitting a PR, run `bin/bump_version` for good Gem hygiene and to ensure everything continues to stay up-to-date.

## Testing

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

require 'bundler/setup'
require 'rolemodel_rails/version'
require 'rake/file_list'
require 'thor'

class VersionBumper < Thor::Group
include Thor::Actions

class_exclusive do
class_option :patch, type: :boolean, lazy_default: false, desc: 'Bump patch version instead of minor version'
class_option :major, type: :boolean, lazy_default: false, desc: 'Bump major version instead of minor version'
end

source_root File.expand_path('../', __FILE__)

def bump_version
gsub_file 'lib/rolemodel_rails/version.rb', /^ VERSION = .*/, " VERSION = '#{new_version_string}'"
end

def update_lockfile
run 'bundle exec bundle install'
end

def build_gem
run 'gem build rolemodel_rails.gemspec'
end

def update_current_example_app
Rake::FileList.new('example_rails*').each do |example_path|
inside(example_path) do
run 'bundle exec bundle install'
end
end
end

def echo_new_version
say "New Gem Version is #{set_color(new_version_string, :yellow)}", :green
end

private

def new_version_string
@new_version_string ||= begin
nv = current_version.bump
nv = nv.bump if options[:major]
nv.segments.fill(0, nv.segments.size, 3 - nv.segments.size).join('.')
end
end

def current_version
Gem::Version.new(
if options[:patch]
RolemodelRails::VERSION + '.0'
else
RolemodelRails::VERSION
end
)
end
end

VersionBumper.start(ARGV)
Loading