gnarails 1.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/actions/test-rails/action.yml +27 -0
  3. data/.github/workflows/bundler-audit.yml +19 -0
  4. data/.github/workflows/pronto.yml +30 -0
  5. data/.github/workflows/rails-test-app.yml +87 -0
  6. data/.github/workflows/run-unit-tests.yml +17 -0
  7. data/.railsrc +3 -0
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +68 -0
  10. data/CONTRIBUTING.md +1 -1
  11. data/Gemfile +1 -2
  12. data/README.md +7 -35
  13. data/RELEASE_PROCESS.md +7 -8
  14. data/Rakefile +1 -1
  15. data/bin/bundle +120 -0
  16. data/bin/pronto +29 -0
  17. data/bin/rspec +29 -0
  18. data/bin/rubocop +29 -0
  19. data/gnarails.gemspec +16 -6
  20. data/gnarly.rb +118 -176
  21. data/lib/gnarails/cli/application.rb +25 -153
  22. data/lib/gnarails/version.rb +3 -1
  23. data/templates/.github/workflows/brakeman.yml +22 -0
  24. data/templates/.github/workflows/run-tests.yml +26 -0
  25. data/templates/Procfile +1 -0
  26. data/templates/README.md +6 -6
  27. data/templates/bin/pronto +29 -0
  28. data/templates/bin/rspec +29 -0
  29. data/templates/bin/rubocop +29 -0
  30. data/templates/bin/setup +30 -0
  31. data/templates/docker-compose.yml/docker-compose-standard.yml +1 -1
  32. data/templates/esbuild.config.js +11 -0
  33. data/test-app/app/views/layouts/application.html.erb +6 -4
  34. data/test-app/spec/factories/job_postings.rb +1 -1
  35. data/test-app/spec/system/viewing_all_job_postings_spec.rb +5 -9
  36. metadata +39 -76
  37. data/.circleci/config.yml +0 -225
  38. data/bin/ci_pronto +0 -6
  39. data/bin/generate-react-test-app.sh +0 -2
  40. data/bin/generate-test-app.sh +0 -22
  41. data/templates/.circleci/config.yml +0 -66
  42. data/templates/.gitignore +0 -20
  43. data/templates/.ruby-version +0 -1
  44. data/templates/.scss-lint.yml +0 -33
  45. data/templates/Dockerfile-assets +0 -24
  46. data/templates/docker-compose.yml/docker-compose-webpack.yml +0 -26
  47. data/templates/react/.babelrc +0 -18
  48. data/templates/react/.eslintrc.js +0 -45
  49. data/templates/react/controllers/home_controller.rb +0 -4
  50. data/templates/react/js/Router/Router.jsx +0 -22
  51. data/templates/react/js/Router/index.js +0 -3
  52. data/templates/react/js/api/index.js +0 -17
  53. data/templates/react/js/api/sessions.js +0 -8
  54. data/templates/react/js/app_constants/index.js +0 -6
  55. data/templates/react/js/components/App/App.jsx +0 -15
  56. data/templates/react/js/components/App/App.tests.jsx +0 -15
  57. data/templates/react/js/components/App/_styles.scss +0 -3
  58. data/templates/react/js/components/App/index.js +0 -3
  59. data/templates/react/js/index.scss +0 -2
  60. data/templates/react/js/packs/main.jsx +0 -13
  61. data/templates/react/js/redux/entity_getter.js +0 -7
  62. data/templates/react/js/redux/history.js +0 -5
  63. data/templates/react/js/redux/initial_state.js +0 -5
  64. data/templates/react/js/redux/middlewares/authentication_middleware/authentication_middleware.tests.js +0 -109
  65. data/templates/react/js/redux/middlewares/authentication_middleware/helpers.js +0 -21
  66. data/templates/react/js/redux/middlewares/authentication_middleware/helpers.tests.js +0 -84
  67. data/templates/react/js/redux/middlewares/authentication_middleware/index.js +0 -20
  68. data/templates/react/js/redux/middlewares/index.js +0 -11
  69. data/templates/react/js/redux/nodes/app/actions.js +0 -36
  70. data/templates/react/js/redux/nodes/app/config.js +0 -12
  71. data/templates/react/js/redux/nodes/app/reducer.js +0 -35
  72. data/templates/react/js/redux/nodes/app/reducer.tests.js +0 -78
  73. data/templates/react/js/redux/reducers.js +0 -11
  74. data/templates/react/js/redux/store.js +0 -14
  75. data/templates/react/js/storage.js +0 -15
  76. data/templates/react/js/styles/_variables.scss +0 -1
  77. data/templates/react/js/test/.setup.js +0 -51
  78. data/templates/react/js/test/connect_wrapper.jsx +0 -28
  79. data/templates/react/js/test/create_request_mock.js +0 -29
  80. data/templates/react/js/test/mock_store.js +0 -12
  81. data/templates/react/layout.html.erb +0 -16
  82. data/templates/react/rails_routes.rb +0 -5
  83. data/templates/react/views/home/default.html.erb +0 -1
  84. data/templates/script/brakeman +0 -15
  85. data/templates/script/ci_pronto +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cd31f307743b9ca75ae90e5a5b19c09bd2f0c51e854bc19697af8631ee0b346
4
- data.tar.gz: 254ade5f49759aeec972194a50449b07befe517274816ffba42a031ef9cbafab
3
+ metadata.gz: bcec698aaecf93c40f68ea946ba13d7c1e77b7b4f04777140e357bb5747b4cb8
4
+ data.tar.gz: 42ea439ed01f6e1bfaaca76b5da52cfd192f3c222c838b359dab243f1f35bb64
5
5
  SHA512:
6
- metadata.gz: 7e363ad5ea9e486580e4847fd4e94b47d645e5ed2058e40203c9e253057acfcd5d774be2af6a989edaa0000bb0b4380cc66c29791aa9cfc903de96a481440279
7
- data.tar.gz: 020a851839405931ce811221cd641bb30f348605f621821e340f6c655009a531dde0538b1b99b64c664771e4972f6cd5b154d5c30023e6a4405db27b336ca852
6
+ metadata.gz: 21f2124f80a2f1fc524dde2c0adc6baa1e22797ee5b3ad77bdcce94544804013a520a31c4fb7f476929a4939af8597362e2ce9fd19f7031e775389e543932d03
7
+ data.tar.gz: 305ec626115f832937b23335838c5fe47c1148996536636630d28e91d5ca5f1631c696d4ece0fb95d67149972bcef347d7dca5bb53e28c996fc4a33caa6f1dc2
@@ -0,0 +1,27 @@
1
+ name: 'Test Rails - The Gnar Way'
2
+ description: 'Setup and run the tests for your Rails app'
3
+ runs:
4
+ using: "composite"
5
+ steps:
6
+ - name: Setup Ruby
7
+ uses: ruby/setup-ruby@v1
8
+ with:
9
+ bundler-cache: true
10
+
11
+ - name: Setup Node
12
+ uses: actions/setup-node@v3
13
+ with:
14
+ node-version: 16
15
+ cache: 'yarn'
16
+
17
+ - name: Setup App Dependencies
18
+ shell: bash
19
+ run: bin/setup
20
+
21
+ - name: Generate Assets
22
+ shell: bash
23
+ run: bin/rails assets:precompile
24
+
25
+ - name: Run tests
26
+ shell: bash
27
+ run: bin/rspec
@@ -0,0 +1,19 @@
1
+ name: Bundler Audit
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ audit:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v3
10
+
11
+ - name: Setup Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ bundler-cache: true
15
+
16
+ - run: |
17
+ gem install bundle-audit
18
+ bundle-audit update
19
+ bundle-audit check
@@ -0,0 +1,30 @@
1
+ name: Pronto
2
+ on:
3
+ pull_request:
4
+ types: [opened, synchronize]
5
+
6
+ jobs:
7
+ pronto:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ pull-requests: write
11
+ statuses: write
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
16
+ - run: |
17
+ git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/*
18
+
19
+ - name: Setup Ruby and install gems
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ bundler-cache: true
23
+
24
+ - name: Run Pronto
25
+ env:
26
+ PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
27
+ PRONTO_GITHUB_SLUG: ${{ github.repository }}
28
+ PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
29
+ run: |
30
+ bin/pronto run -c origin/${{ github.base_ref }} -f text github_pr_review github_status
@@ -0,0 +1,87 @@
1
+ name: Test Generated App
2
+ on: [push]
3
+
4
+ jobs:
5
+ build-app:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - name: Checkout code
9
+ uses: actions/checkout@v3
10
+
11
+ - name: Setup Ruby
12
+ uses: ruby/setup-ruby@v1
13
+
14
+ # We have to rely on an additional bundle install for
15
+ # the local gnarails script to run properly.
16
+ - name: Install Ruby Dependencies
17
+ run: bundle install
18
+
19
+ - name: Setup Node
20
+ uses: actions/setup-node@v3
21
+ with:
22
+ node-version: 16
23
+
24
+ - name: Generate Test App
25
+ run: |
26
+ bundle exec exe/gnarails new rails-test-app
27
+
28
+ mkdir rails-test-app/app/views/job_postings
29
+ mkdir rails-test-app/db/migrate
30
+ mkdir rails-test-app/spec/factories
31
+ mkdir rails-test-app/spec/models
32
+ mkdir rails-test-app/spec/system
33
+ mkdir rails-test-app/spec/requests
34
+
35
+ cp test-app/app/controllers/job_postings_controller.rb rails-test-app/app/controllers/job_postings_controller.rb
36
+ cp test-app/app/models/job_posting.rb rails-test-app/app/models/job_posting.rb
37
+ cp test-app/app/models/comment.rb rails-test-app/app/models/comment.rb
38
+ cp test-app/app/views/job_postings/index.html.erb rails-test-app/app/views/job_postings/index.html.erb
39
+ yes | cp test-app/app/views/layouts/application.html.erb rails-test-app/app/views/layouts/application.html.erb
40
+ yes | cp test-app/config/routes.rb rails-test-app/config/routes.rb
41
+ cp test-app/db/migrate/20170918002433_create_job_postings.rb rails-test-app/db/migrate/20170918002433_create_job_postings.rb
42
+ cp test-app/db/migrate/20170918002455_create_comments.rb rails-test-app/db/migrate/20170918002455_create_comments.rb
43
+ cp test-app/spec/factories/job_postings.rb rails-test-app/spec/factories/job_postings.rb
44
+ cp test-app/spec/models/job_posting_spec.rb rails-test-app/spec/models/job_posting_spec.rb
45
+ cp test-app/spec/system/viewing_all_job_postings_spec.rb rails-test-app/spec/system/viewing_all_job_postings_spec.rb
46
+ cp test-app/spec/requests/status_spec.rb rails-test-app/spec/requests/status_spec.rb
47
+
48
+ - name: Tar files
49
+ run: tar -czvf rails_test_app.tar -C rails-test-app .
50
+
51
+ - uses: actions/upload-artifact@v2
52
+ with:
53
+ name: rails-test-app
54
+ path: ./rails_test_app.tar
55
+
56
+ rails-test-app:
57
+ runs-on: ubuntu-latest
58
+ needs: build-app
59
+ env:
60
+ RAILS_ENV: test
61
+ DATABASE_PASSWORD: password
62
+ services:
63
+ postgres:
64
+ image: postgres:14
65
+ env:
66
+ POSTGRES_PASSWORD: password
67
+ ports: ["5432:5432"]
68
+ options:
69
+ --health-cmd pg_isready
70
+ --health-interval 10s
71
+ --health-timeout 5s
72
+ --health-retries 5
73
+ steps:
74
+ # Do not checkout the repo here - this is intentionally running of of the generated app!
75
+ - uses: actions/download-artifact@v2
76
+ with:
77
+ name: rails-test-app
78
+
79
+ - name: Un-Tar files
80
+ run: tar -xvf rails_test_app.tar
81
+
82
+ # running this from the generated app, not the Gem
83
+ - name: Run Tests
84
+ uses: ./.github/actions/test-rails
85
+
86
+ - name: Ensure app has no rubocop warnings
87
+ run: bin/rubocop --fail-level warning
@@ -0,0 +1,17 @@
1
+ name: Unit Test
2
+ on: [push]
3
+
4
+ jobs:
5
+ run-unit-test:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - name: Checkout code
9
+ uses: actions/checkout@v3
10
+
11
+ - name: Setup Ruby and install gems
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ bundler-cache: true
15
+
16
+ - name: Run Tests
17
+ run: bin/rspec
data/.railsrc CHANGED
@@ -1,2 +1,5 @@
1
+ --asset-pipeline=propshaft
1
2
  --skip-test-unit
3
+ --css=sass
4
+ --javascript=esbuild
2
5
  --database=postgresql
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.7.4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  ## Current release (in development)
2
2
 
3
+ * Upgrade to Ruby 2.6.5 [#148](https://github.com/TheGnarCo/gnarails/pull/149)
4
+
5
+ [Dan Frenette](https://github.com/danfrenette)
6
+
7
+ ## 3.0.0 - 2019-09-20
8
+
9
+ * Downgrade to Ruby 2.6.3 [#148](https://github.com/TheGnarCo/gnarails/pull/148)
10
+
11
+ [Kevin Murphy](https://github.com/kevin-j-m)
12
+
13
+ * Support Ruby 2.6.4 [#147](https://github.com/TheGnarCo/gnarails/pull/147)
14
+
15
+ [Reese Williams](https://github.com/reese)
16
+
17
+ * Upgrade to Rails 6 [#146](https://github.com/TheGnarCo/gnarails/pull/146)
18
+
19
+ [Reese Williams](https://github.com/reese)
20
+
21
+ ## 2.0.0 - 2019-03-01
22
+
23
+ * Support Ruby 2.6.1 [#134](https://github.com/TheGnarCo/gnarails/pull/134)
24
+
25
+ [Kevin Murphy](https://github.com/kevin-j-m)
26
+
27
+ * Install brakeman without `--rdoc` or `--ri` [#130](https://github.com/TheGnarCo/gnarails/pull/130)
28
+
29
+ [Kevin Murphy](https://github.com/kevin-j-m)
30
+
31
+ * Add Starting Procfile [#129](https://github.com/TheGnarCo/gnarails/pull/129)
32
+
33
+ [Blake Williams](https://github.com/BlakeWilliams)
34
+
35
+ * Set Pronto to report on Github PRs with the Review Formatter [#126](https://github.com/TheGnarCo/gnarails/pull/126)
36
+
37
+ [Kevin Murphy](https://github.com/kevin-j-m)
38
+
39
+ * Store Capybara screenshot failures as Circle CI Artifact [#123](https://github.com/TheGnarCo/gnarails/pull/123)
40
+
41
+ [Kevin Murphy](https://github.com/kevin-j-m)
42
+
43
+ * Support Ruby 2.5.1 [#122](https://github.com/TheGnarCo/gnarails/pull/122)
44
+
45
+ [Blake Williams](https://github.com/BlakeWilliams)
46
+
47
+ * Rename `/script` directory to instead use `/bin` for scripts [#121](https://github.com/TheGnarCo/gnarails/pull/121), [#125](https://github.com/TheGnarCo/gnarails/pull/125)
48
+
49
+ [Blake Williams](https://github.com/BlakeWilliams)
50
+
51
+ * Ensure use of created application's Gemfile [#120](https://github.com/TheGnarCo/gnarails/pull/120)
52
+
53
+ [Blake Williams](https://github.com/BlakeWilliams)
54
+
55
+ * Support Rails 5.2.1 [#118](https://github.com/TheGnarCo/gnarails/pull/118)
56
+
57
+ [Blake Williams](https://github.com/BlakeWilliams)
58
+
59
+ * Remove React Support [#117](https://github.com/TheGnarCo/gnarails/pull/117)
60
+
61
+ [Blake Williams](https://github.com/BlakeWilliams)
62
+
63
+ * Use ruby's RUBY_VERSION [#115](https://github.com/TheGnarCo/gnarails/pull/115)
64
+
65
+ [Blake Williams](https://github.com/BlakeWilliams)
66
+
67
+ * Format ruby code with rubocop's auto-formatter [#112](https://github.com/TheGnarCo/gnarails/pull/112)
68
+
69
+ [Taylor Kearns](https://github.com/taylorkearns)
70
+
3
71
  ## 1.0.0 - 2018-03-28
4
72
 
5
73
  ## 0.9.3 - 2018-03-28
data/CONTRIBUTING.md CHANGED
@@ -31,7 +31,7 @@ are expected to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md).
31
31
  4. Include tests to verify the change performs as expected.
32
32
  5. Run the test suite locally to ensure the change doesn't affect other
33
33
  functionality.
34
- * `bundle exec rspec`
34
+ * `bin/rspec`
35
35
  6. Commit progress in [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit).
36
36
  * `git commit -am "A message with an informative title, and detailed description
37
37
  in subsequent paragraphs"`
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/TheGnarCo/#{repo_name}" }
4
- gem 'webpacker', '=3.0'
3
+ git_source(:github) { |repo_name| "https://github.com/TheGnarCo/#{repo_name}" }
5
4
 
6
5
  group :development do
7
6
  gem 'listen'
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ # This Gem has been Deprecated
2
+
3
+ If you are looking to build rails apps with Gnarly Opinions, check out the `init` command of [`gnar-cli`](https://www.github.com/theGnarCo/gnar-cli).
4
+
1
5
  # Gnarails
2
6
 
3
7
  Create a gnarly rails app, ready to go with all the base functionality you can
@@ -28,23 +32,6 @@ $ rails new <APP_NAME> -m path/to/gnarly.rb --skip-test-unit --database=postgres
28
32
 
29
33
  A`.railsrc` is provided. If you'd like to symlink it to your home directory, it'll run `rails new` with the options to run with postgres and not including test-unit. This `.railsrc` can be personalized to include the `--template=path/to/gnarly.rb` option depending on where you locally store this repo if you'd like to use this template every time.
30
34
 
31
- ## Usage with React
32
-
33
- ### Using the CLI
34
-
35
- ```sh
36
- $ gem install gnarails
37
- $ gnarails new <APP_NAME> --webpack=react
38
- ```
39
-
40
- ### Using the template
41
-
42
- ```sh
43
- $ git clone https://github.com/TheGnarCo/gnarails.git
44
- $ cd where/app/will/go
45
- $ rails new <APP_NAME> -m path/to/gnarly.rb --skip-test-unit --database=postgresql --webpack=react
46
- ```
47
-
48
35
  ## Post-Install
49
36
 
50
37
  ```sh
@@ -54,13 +41,6 @@ $ bin/rails db:create
54
41
  $ bin/rails db:migrate
55
42
  ```
56
43
 
57
- _For React Apps_
58
-
59
- ```sh
60
- $ bin/yarn
61
- $ bin/yarn test
62
- ```
63
-
64
44
  ### Setting up pronto on CI
65
45
 
66
46
  Pronto can be used to comment on pull requests for various automated checks of
@@ -83,8 +63,7 @@ every PR, and update the following:
83
63
 
84
64
  ## Usage with Docker
85
65
 
86
- A `Dockerfile` and `docker-compose.yml` file are created by default. When run with `--webpack=react`,
87
- there are two `Dockerfile`s: one for the Rails server and one for the assets server.
66
+ A `Dockerfile` and `docker-compose.yml` file are created by default.
88
67
 
89
68
  To use Docker, run:
90
69
 
@@ -117,15 +96,8 @@ end
117
96
  ## Running the Application
118
97
 
119
98
  ```sh
120
- $ bin/rails s
121
- ```
122
-
123
- _For React Apps_
124
-
125
- In a separate terminal window/tab
126
-
127
- ```sh
128
- $ bin/yarn start
99
+ $ bin/setup
100
+ $ bin/dev
129
101
  ```
130
102
 
131
103
  Visit `localhost:3000` in your browser
data/RELEASE_PROCESS.md CHANGED
@@ -1,8 +1,7 @@
1
- * Checkout master: `git checkout master`.
2
- * Get latest: `git pull --rebase origin master`
3
- * Bump version number in `lib/gnarails/version.rb`.
4
- * Update the [CHANGELOG](CHANGELOG.md), moving the current release work to under the version number.
5
- * Create a commit, including the version number in the commit message: `git add
6
- --all && git commit -m "Version x.y.z"`.
7
- * Push the release to RubyGems: `rake release`.
8
- * Check the RubyGems [twitter account](https://twitter.com/rubygems) to publicize the release.
1
+ - Checkout master: `git checkout main`.
2
+ - Get latest: `git pull --rebase origin main`
3
+ - Bump version number in `lib/gnarails/version.rb`.
4
+ - Update the [CHANGELOG](CHANGELOG.md), moving the current release work to under the version number.
5
+ - Create a commit, including the version number in the commit message: `git add --all && git commit -m "Version x.y.z"`.
6
+ - Push the release to RubyGems: `rake release`.
7
+ - Check the RubyGems [twitter account](https://twitter.com/rubygems) to publicize the release.
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/bundle ADDED
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+
28
+ bundler_version = nil
29
+ update_index = nil
30
+ ARGV.each_with_index do |a, i|
31
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32
+ bundler_version = a
33
+ end
34
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
35
+
36
+ bundler_version = Regexp.last_match(1)
37
+ update_index = i
38
+ end
39
+ bundler_version
40
+ end
41
+
42
+ def gemfile
43
+ gemfile = ENV["BUNDLE_GEMFILE"]
44
+ return gemfile if gemfile && !gemfile.empty?
45
+
46
+ File.expand_path("../Gemfile", __dir__)
47
+ end
48
+
49
+ def lockfile
50
+ lockfile =
51
+ case File.basename(gemfile)
52
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
53
+ else "#{gemfile}.lock"
54
+ end
55
+ File.expand_path(lockfile)
56
+ end
57
+
58
+ def lockfile_version
59
+ return unless File.file?(lockfile)
60
+
61
+ lockfile_contents = File.read(lockfile)
62
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
63
+
64
+ Regexp.last_match(1)
65
+ end
66
+
67
+ def bundler_version
68
+ @bundler_version ||=
69
+ env_var_version || cli_arg_version ||
70
+ lockfile_version
71
+ end
72
+
73
+ def bundler_requirement
74
+ return "#{Gem::Requirement.default}.a" unless bundler_version
75
+
76
+ bundler_gem_version = Gem::Version.new(bundler_version)
77
+
78
+ requirement = bundler_gem_version.approximate_recommendation
79
+
80
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
81
+
82
+ requirement += ".a" if bundler_gem_version.prerelease?
83
+
84
+ requirement
85
+ end
86
+
87
+ def load_bundler!
88
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
89
+
90
+ activate_bundler
91
+ end
92
+
93
+ def activate_bundler
94
+ gem_error = activation_error_handling do
95
+ gem "bundler", bundler_requirement
96
+ end
97
+ return if gem_error.nil?
98
+
99
+ require_error = activation_error_handling do
100
+ require "bundler/version"
101
+ end
102
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
103
+
104
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
105
+ exit 42
106
+ end
107
+
108
+ def activation_error_handling
109
+ yield
110
+ nil
111
+ rescue StandardError, LoadError => e
112
+ e
113
+ end
114
+ end
115
+
116
+ m.load_bundler!
117
+
118
+ if m.invoked_as_script?
119
+ load Gem.bin_path("bundler", "bundle")
120
+ end
data/bin/pronto ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'pronto' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("pronto", "pronto")
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
data/gnarails.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "gnarails/version"
4
4
 
@@ -19,16 +19,26 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.required_ruby_version = ">= 2.5.0"
22
+ spec.required_ruby_version = ">= 2.7.4"
23
23
 
24
- spec.add_dependency "rails", "~> 5.1.5"
25
- spec.add_dependency "rspec-rails"
24
+ spec.add_dependency "rails", "~> 7.0.0"
26
25
  spec.add_dependency "thor"
27
26
 
28
- spec.add_development_dependency "bundler", "~> 1.16"
27
+ spec.add_development_dependency "bundler", ">= 1.16", "< 3.0"
29
28
  spec.add_development_dependency "gnar-style"
30
29
  spec.add_development_dependency "pronto"
31
30
  spec.add_development_dependency "pronto-rubocop"
32
- spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rake", "~> 13.0"
33
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.metadata["rubygems_mfa_required"] = "true"
34
+ spec.post_install_message = %(
35
+ ==============================
36
+ THIS GEM HAS BEEN DEPRECATED!
37
+ ==============================
38
+ If you are looking to initialize
39
+ Rails apps with Gnarly Opinions,
40
+ check out Gnar-CLI:
41
+
42
+ https://www.github.com/theGnarCo/gnar-cli
43
+ )
34
44
  end