gnarails 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -90
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +50 -0
  5. data/README.md +1 -34
  6. data/bin/ci_pronto +1 -1
  7. data/gnarails.gemspec +2 -3
  8. data/gnarly.rb +44 -137
  9. data/lib/gnarails/version.rb +1 -1
  10. data/templates/.circleci/config.yml +7 -2
  11. data/templates/Procfile +1 -0
  12. data/templates/{script → bin}/brakeman +1 -1
  13. data/templates/{script → bin}/ci_pronto +1 -1
  14. data/test-app/app/views/layouts/application.html.erb +4 -2
  15. data/test-app/spec/factories/job_postings.rb +1 -1
  16. metadata +9 -64
  17. data/bin/generate-react-test-app.sh +0 -2
  18. data/templates/.ruby-version +0 -1
  19. data/templates/Dockerfile-assets +0 -24
  20. data/templates/docker-compose.yml/docker-compose-webpack.yml +0 -26
  21. data/templates/react/.babelrc +0 -18
  22. data/templates/react/.eslintrc.js +0 -45
  23. data/templates/react/controllers/home_controller.rb +0 -4
  24. data/templates/react/js/Router/Router.jsx +0 -22
  25. data/templates/react/js/Router/index.js +0 -3
  26. data/templates/react/js/api/index.js +0 -17
  27. data/templates/react/js/api/sessions.js +0 -8
  28. data/templates/react/js/app_constants/index.js +0 -6
  29. data/templates/react/js/components/App/App.jsx +0 -15
  30. data/templates/react/js/components/App/App.tests.jsx +0 -15
  31. data/templates/react/js/components/App/_styles.scss +0 -3
  32. data/templates/react/js/components/App/index.js +0 -3
  33. data/templates/react/js/index.scss +0 -2
  34. data/templates/react/js/packs/main.jsx +0 -13
  35. data/templates/react/js/redux/entity_getter.js +0 -7
  36. data/templates/react/js/redux/history.js +0 -5
  37. data/templates/react/js/redux/initial_state.js +0 -5
  38. data/templates/react/js/redux/middlewares/authentication_middleware/authentication_middleware.tests.js +0 -109
  39. data/templates/react/js/redux/middlewares/authentication_middleware/helpers.js +0 -21
  40. data/templates/react/js/redux/middlewares/authentication_middleware/helpers.tests.js +0 -84
  41. data/templates/react/js/redux/middlewares/authentication_middleware/index.js +0 -20
  42. data/templates/react/js/redux/middlewares/index.js +0 -11
  43. data/templates/react/js/redux/nodes/app/actions.js +0 -36
  44. data/templates/react/js/redux/nodes/app/config.js +0 -12
  45. data/templates/react/js/redux/nodes/app/reducer.js +0 -35
  46. data/templates/react/js/redux/nodes/app/reducer.tests.js +0 -78
  47. data/templates/react/js/redux/reducers.js +0 -11
  48. data/templates/react/js/redux/store.js +0 -14
  49. data/templates/react/js/storage.js +0 -15
  50. data/templates/react/js/styles/_variables.scss +0 -1
  51. data/templates/react/js/test/.setup.js +0 -51
  52. data/templates/react/js/test/connect_wrapper.jsx +0 -28
  53. data/templates/react/js/test/create_request_mock.js +0 -29
  54. data/templates/react/js/test/mock_store.js +0 -12
  55. data/templates/react/layout.html.erb +0 -16
  56. data/templates/react/rails_routes.rb +0 -5
  57. data/templates/react/views/home/default.html.erb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cd31f307743b9ca75ae90e5a5b19c09bd2f0c51e854bc19697af8631ee0b346
4
- data.tar.gz: 254ade5f49759aeec972194a50449b07befe517274816ffba42a031ef9cbafab
3
+ metadata.gz: 508e16eb10983b1d39462ab123c09081019afc3c638eee01ed6bc6e31f64caaf
4
+ data.tar.gz: fa1b674fa47b13c9048b87e82d8cbc27b0f4cff2ace07472d4ff8f16c0aad8b9
5
5
  SHA512:
6
- metadata.gz: 7e363ad5ea9e486580e4847fd4e94b47d645e5ed2058e40203c9e253057acfcd5d774be2af6a989edaa0000bb0b4380cc66c29791aa9cfc903de96a481440279
7
- data.tar.gz: 020a851839405931ce811221cd641bb30f348605f621821e340f6c655009a531dde0538b1b99b64c664771e4972f6cd5b154d5c30023e6a4405db27b336ca852
6
+ metadata.gz: 194b76bfabcafdd8920f048614c5ae51e15043d80b3e3adf23e71b1ff7549e593692b365da89853593c23591e72badb6d9c0ae5cc1d2554fa0dae5de6731f5fc
7
+ data.tar.gz: f09a6420fb5f2028c1b7057c1ca5fc50a25f1f75ceacf15fe8853ddb146e28130e0b10cac049573ba72cdab6c80277ec1ed65d60386bec5be5ffee748e2fbdeb
data/.circleci/config.yml CHANGED
@@ -6,17 +6,12 @@ version: 2
6
6
  jobs:
7
7
  unit_test:
8
8
  docker:
9
- - image: circleci/ruby:2.5.0-stretch-node-browsers
9
+ - image: circleci/ruby:2.6.1-stretch-node-browsers
10
10
  environment:
11
11
  RAILS_ENV: test
12
12
  steps:
13
13
  - checkout
14
14
 
15
- # Download and cache dependencies
16
- - restore_cache:
17
- keys:
18
- - gnarails-{{ checksum "gnarails.gemspec" }}
19
-
20
15
  # cmake is required by Rugged, a dependency of Pronto
21
16
  - run:
22
17
  name: Install cmake
@@ -25,13 +20,7 @@ jobs:
25
20
  # Bundle install dependencies
26
21
  - run:
27
22
  name: install dependencies
28
- command: bundle install --path vendor/bundle
29
-
30
- # Store bundle cache
31
- - save_cache:
32
- paths:
33
- - vendor/bundle
34
- key: gnarails-{{ checksum "gnarails.gemspec" }}
23
+ command: bundle install
35
24
 
36
25
  # Tests
37
26
  - run:
@@ -45,99 +34,55 @@ jobs:
45
34
 
46
35
  build-rails:
47
36
  docker:
48
- - image: ruby:2.5.0
37
+ - image: circleci/ruby:2.6.1-stretch-node-browsers
49
38
 
50
39
  steps:
51
40
  - checkout
52
41
 
53
- # Restore bundle cache
54
- - restore_cache:
55
- keys:
56
- - gnarails-build-rails-{{ checksum "gnarails.gemspec" }}
57
- # fallback to using the latest cache if no exact match is found
58
- - gnarails-build-rails-
59
-
60
42
  # cmake is required by Rugged, a dependency of Pronto
61
43
  - run:
62
44
  name: Install cmake
63
- command: apt-get -y -qq update && apt-get -y -qq install cmake
64
-
65
- # Bundle install dependencies
66
- - run:
67
- name: Install Dependencies
68
- command: bundle install --path vendor/bundle
69
-
70
- # Store bundle cache
71
- - save_cache:
72
- paths:
73
- - vendor/bundle
74
- key: gnarails-build-rails-{{ checksum "gnarails.gemspec" }}
45
+ command: sudo apt-get -y -qq update && sudo apt-get -y -qq install cmake
75
46
 
76
- # Generate test app
47
+ # Remove bundler 2
77
48
  - run:
78
- name: Generate Test App
79
- command: sh ./bin/generate-test-app.sh
49
+ name: Uninstall bundler
50
+ command: sudo gem uninstall bundler
80
51
 
81
- # Move test app
52
+ # Install specific version of bundler
82
53
  - run:
83
- name: Move Test App
84
- command: mkdir rails-app && cp -r ~/project/rails-test-app ~/project/rails-app/
85
-
86
- # Save to shared workspace
87
- - persist_to_workspace:
88
- root: rails-app
89
- paths:
90
- - rails-test-app
91
-
92
- build-rails-react:
93
- docker:
94
- - image: starefossen/ruby-node:2-8
54
+ name: Install bundler 1.17.2
55
+ command: sudo gem install bundler -v 1.17.2
95
56
 
96
- steps:
97
- - checkout
98
-
99
- # Restore bundle cache
100
- - restore_cache:
101
- keys:
102
- - gnarails-build-rails-react-{{ checksum "gnarails.gemspec" }}
103
- # fallback to using the latest cache if no exact match is found
104
- - gnarails-build-rails-react-
105
-
106
- # cmake is required by Rugged, a dependency of Pronto
57
+ # Install rake after installing specific version of bundler
107
58
  - run:
108
- name: Install cmake
109
- command: apt-get -y -qq update && apt-get -y -qq install cmake
59
+ name: Install rake
60
+ command: gem install rake
110
61
 
111
62
  # Bundle install dependencies
112
63
  - run:
113
64
  name: Install Dependencies
114
- command: bundle install --path vendor/bundle
115
-
116
- # Store bundle cache
117
- - save_cache:
118
- paths:
119
- - vendor/bundle
120
- key: gnarails-build-rails-react-{{ checksum "gnarails.gemspec" }}
65
+ command: bundle install
121
66
 
122
67
  # Generate test app
123
68
  - run:
124
69
  name: Generate Test App
125
- command: sh ./bin/generate-react-test-app.sh
70
+ command: sh ./bin/generate-test-app.sh
126
71
 
127
72
  # Move test app
128
73
  - run:
129
74
  name: Move Test App
130
- command: mkdir rails-app && cp -r ~/project/rails-react-test-app ~/project/rails-app/
75
+ command: mkdir rails-app && cp -r ~/project/rails-test-app ~/project/rails-app/
131
76
 
132
77
  # Save to shared workspace
133
78
  - persist_to_workspace:
134
79
  root: rails-app
135
80
  paths:
136
- - rails-react-test-app
81
+ - rails-test-app
137
82
 
138
83
  test-rails-app:
139
84
  docker:
140
- - image: circleci/ruby:2.5.0-stretch-node-browsers
85
+ - image: circleci/ruby:2.6.1-stretch-node-browsers
141
86
  environment:
142
87
  RAILS_ENV: test
143
88
  PG_HOST: localhost
@@ -157,13 +102,6 @@ jobs:
157
102
  name: Copy Test App
158
103
  command: cp -r /tmp/rails-test-app/rails-test-app/* ~/project
159
104
 
160
- # Restore bundle cache
161
- - restore_cache:
162
- keys:
163
- - gnarails-test-rails-app-{{ checksum "Gemfile.lock" }}
164
- # fallback to using the latest cache if no exact match is found
165
- - gnarails-test-rails-app-
166
-
167
105
  # cmake is required by Rugged, a dependency of Pronto
168
106
  - run:
169
107
  name: Install cmake
@@ -172,13 +110,7 @@ jobs:
172
110
  # Bundle install dependencies
173
111
  - run:
174
112
  name: install dependencies
175
- command: bundle install --path vendor/bundle
176
-
177
- # Store bundle cache
178
- - save_cache:
179
- paths:
180
- - vendor/bundle
181
- key: gnarails-test-rails-app-{{ checksum "Gemfile.lock" }}
113
+ command: bundle install
182
114
 
183
115
  # Database setup
184
116
  - run:
@@ -196,12 +128,12 @@ jobs:
196
128
  command: bundle exec bundle-audit update && bundle exec bundle-audit check
197
129
  - run:
198
130
  name: Brakeman
199
- command: ./script/brakeman
131
+ command: ./bin/brakeman
200
132
 
201
133
  # Pronto
202
134
  - run:
203
135
  name: Pronto
204
- command: ./script/ci_pronto
136
+ command: ./bin/ci_pronto
205
137
 
206
138
  # Save Brakeman
207
139
  - store_artifacts:
@@ -219,7 +151,6 @@ workflows:
219
151
  jobs:
220
152
  - unit_test
221
153
  - build-rails
222
- - build-rails-react
223
154
  - test-rails-app:
224
155
  requires:
225
156
  - build-rails
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.6.1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  ## Current release (in development)
2
2
 
3
+ ## 2.0.0 - 2019-03-01
4
+
5
+ * Support Ruby 2.6.1 [#134](https://github.com/TheGnarCo/gnarails/pull/134)
6
+
7
+ [Kevin Murphy](https://github.com/kevin-j-m)
8
+
9
+ * Install brakeman without `--rdoc` or `--ri` [#130](https://github.com/TheGnarCo/gnarails/pull/130)
10
+
11
+ [Kevin Murphy](https://github.com/kevin-j-m)
12
+
13
+ * Add Starting Procfile [#129](https://github.com/TheGnarCo/gnarails/pull/129)
14
+
15
+ [Blake Williams](https://github.com/BlakeWilliams)
16
+
17
+ * Set Pronto to report on Github PRs with the Review Formatter [#126](https://github.com/TheGnarCo/gnarails/pull/126)
18
+
19
+ [Kevin Murphy](https://github.com/kevin-j-m)
20
+
21
+ * Store Capybara screenshot failures as Circle CI Artifact [#123](https://github.com/TheGnarCo/gnarails/pull/123)
22
+
23
+ [Kevin Murphy](https://github.com/kevin-j-m)
24
+
25
+ * Support Ruby 2.5.1 [#122](https://github.com/TheGnarCo/gnarails/pull/122)
26
+
27
+ [Blake Williams](https://github.com/BlakeWilliams)
28
+
29
+ * 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)
30
+
31
+ [Blake Williams](https://github.com/BlakeWilliams)
32
+
33
+ * Ensure use of created application's Gemfile [#120](https://github.com/TheGnarCo/gnarails/pull/120)
34
+
35
+ [Blake Williams](https://github.com/BlakeWilliams)
36
+
37
+ * Support Rails 5.2.1 [#118](https://github.com/TheGnarCo/gnarails/pull/118)
38
+
39
+ [Blake Williams](https://github.com/BlakeWilliams)
40
+
41
+ * Remove React Support [#117](https://github.com/TheGnarCo/gnarails/pull/117)
42
+
43
+ [Blake Williams](https://github.com/BlakeWilliams)
44
+
45
+ * Use ruby's RUBY_VERSION [#115](https://github.com/TheGnarCo/gnarails/pull/115)
46
+
47
+ [Blake Williams](https://github.com/BlakeWilliams)
48
+
49
+ * Format ruby code with rubocop's auto-formatter [#112](https://github.com/TheGnarCo/gnarails/pull/112)
50
+
51
+ [Taylor Kearns](https://github.com/taylorkearns)
52
+
3
53
  ## 1.0.0 - 2018-03-28
4
54
 
5
55
  ## 0.9.3 - 2018-03-28
data/README.md CHANGED
@@ -28,23 +28,6 @@ $ rails new <APP_NAME> -m path/to/gnarly.rb --skip-test-unit --database=postgres
28
28
 
29
29
  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
30
 
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
31
  ## Post-Install
49
32
 
50
33
  ```sh
@@ -54,13 +37,6 @@ $ bin/rails db:create
54
37
  $ bin/rails db:migrate
55
38
  ```
56
39
 
57
- _For React Apps_
58
-
59
- ```sh
60
- $ bin/yarn
61
- $ bin/yarn test
62
- ```
63
-
64
40
  ### Setting up pronto on CI
65
41
 
66
42
  Pronto can be used to comment on pull requests for various automated checks of
@@ -83,8 +59,7 @@ every PR, and update the following:
83
59
 
84
60
  ## Usage with Docker
85
61
 
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.
62
+ A `Dockerfile` and `docker-compose.yml` file are created by default.
88
63
 
89
64
  To use Docker, run:
90
65
 
@@ -120,14 +95,6 @@ end
120
95
  $ bin/rails s
121
96
  ```
122
97
 
123
- _For React Apps_
124
-
125
- In a separate terminal window/tab
126
-
127
- ```sh
128
- $ bin/yarn start
129
- ```
130
-
131
98
  Visit `localhost:3000` in your browser
132
99
 
133
100
  ## About The Gnar Company
data/bin/ci_pronto CHANGED
@@ -3,4 +3,4 @@
3
3
  # Script for running pronto on CI
4
4
  export PRONTO_PULL_REQUEST_ID=${CI_PULL_REQUEST##*/}
5
5
 
6
- bundle exec pronto run -f text github_pr github_status -c origin/master
6
+ bundle exec pronto run -f text github_pr_review github_status -c origin/master
data/gnarails.gemspec CHANGED
@@ -19,10 +19,9 @@ 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.6.0"
23
23
 
24
- spec.add_dependency "rails", "~> 5.1.5"
25
- spec.add_dependency "rspec-rails"
24
+ spec.add_dependency "rails", "~> 5.2.1"
26
25
  spec.add_dependency "thor"
27
26
 
28
27
  spec.add_development_dependency "bundler", "~> 1.16"
data/gnarly.rb CHANGED
@@ -5,56 +5,32 @@ def source_paths
5
5
  [File.expand_path(File.dirname(__FILE__))]
6
6
  end
7
7
 
8
- RUBY_VERSION = "2.5.0".freeze
9
-
10
- JS_DEPENDENCIES = [
11
- "babel-preset-es2015".freeze,
12
- "babel-preset-stage-0".freeze,
13
- "classnames".freeze,
14
- "es6-object-assign".freeze,
15
- "es6-promise".freeze,
16
- "history".freeze,
17
- "lodash".freeze,
18
- "react-entity-getter".freeze,
19
- "react-redux".freeze,
20
- "react-router".freeze,
21
- "react-router-dom".freeze,
22
- "react-router-redux@next".freeze,
23
- "redux".freeze,
24
- "redux-form".freeze,
25
- "redux-thunk".freeze,
26
- "schlepp".freeze,
27
- ].freeze
28
-
29
- JS_DEV_DEPENDENCIES = [
30
- "babel-eslint".freeze,
31
- "enzyme".freeze,
32
- "enzyme-adapter-react-16".freeze,
33
- "eslint".freeze,
34
- "eslint-config-airbnb".freeze,
35
- "eslint-plugin-import".freeze,
36
- "eslint-plugin-jsx-a11y@^5.1.1".freeze,
37
- "eslint-plugin-react".freeze,
38
- "expect".freeze,
39
- "jsdom".freeze,
40
- "mocha".freeze,
41
- "nock".freeze,
42
- "react-dom".freeze,
43
- "react-test-renderer".freeze,
44
- "redux-mock-store".freeze,
45
- ].freeze
46
-
47
8
  def create_gnarly_rails_app
9
+ # This is a really unfortunate, but necessary, line of code that resets the
10
+ # cached Gemfile location so the generated application's Gemfile is used
11
+ # instead of the generators Gemfile.
12
+ ENV["BUNDLE_GEMFILE"] = nil
13
+
14
+ # Prevent spring cache when generating application
15
+ ENV["DISABLE_SPRING"] = "true"
16
+
48
17
  add_gems
49
- setup_database
50
- add_ruby_version
51
- setup_scss
52
- setup_gitignore
53
- setup_testing
54
- setup_analysis
55
- setup_environments
56
- setup_readme
57
- post_bundle
18
+
19
+ run "bundle install"
20
+
21
+ after_bundle do
22
+ setup_testing
23
+ setup_database
24
+ setup_scss
25
+ setup_gitignore
26
+ setup_analysis
27
+ setup_environments
28
+ setup_readme
29
+ remove_dir "test"
30
+ git :init
31
+ format_ruby
32
+ completion_notification
33
+ end
58
34
  end
59
35
 
60
36
  def add_gems
@@ -74,7 +50,7 @@ def add_gems
74
50
  gem 'pronto-scss', require: false
75
51
  gem 'pry-rails'
76
52
  gem 'rspec-its'
77
- gem 'rspec-rails'
53
+ gem 'rspec-rails', '~> 3.7'
78
54
  gem 'scss_lint', require: false
79
55
  gem 'selenium-webdriver'
80
56
  gem 'shoulda-matchers'
@@ -90,15 +66,6 @@ def setup_database
90
66
  gsub_file "Gemfile", /.*sqlite.*\n/, ""
91
67
  end
92
68
 
93
- def add_ruby_version
94
- insert_into_file "Gemfile", after: "source 'https://rubygems.org'" do
95
- "\nruby \"#{RUBY_VERSION}\""
96
- end
97
-
98
- copy_file "templates/.ruby-version", ".ruby-version"
99
- gsub_file ".ruby-version", "__ruby_version__", RUBY_VERSION
100
- end
101
-
102
69
  def setup_scss
103
70
  run "mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss"
104
71
  end
@@ -109,7 +76,6 @@ def setup_gitignore
109
76
  end
110
77
 
111
78
  def setup_testing
112
- run "bundle install"
113
79
  setup_rspec
114
80
  setup_factory_bot
115
81
  setup_system_tests
@@ -123,7 +89,7 @@ def setup_rspec
123
89
  remove_file ".rspec"
124
90
  copy_file "templates/.rspec", ".rspec"
125
91
  gsub_file "spec/rails_helper.rb",
126
- "# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }",
92
+ /# Dir\[Rails\.root\.join.*/,
127
93
  "Dir[Rails.root.join(\"spec/support/**/*.rb\")].each { |f| require f }"
128
94
  end
129
95
 
@@ -234,13 +200,13 @@ end
234
200
 
235
201
  def setup_pronto
236
202
  copy_file "templates/.pronto.yml", ".pronto.yml"
237
- copy_file "templates/script/ci_pronto", "script/ci_pronto"
238
- run "chmod +x script/ci_pronto"
203
+ copy_file "templates/bin/ci_pronto", "bin/ci_pronto"
204
+ run "chmod +x bin/ci_pronto"
239
205
  end
240
206
 
241
207
  def setup_brakeman
242
- copy_file "templates/script/brakeman", "script/brakeman"
243
- run "chmod +x script/brakeman"
208
+ copy_file "templates/bin/brakeman", "bin/brakeman"
209
+ run "chmod +x bin/brakeman"
244
210
  end
245
211
 
246
212
  def setup_simplecov
@@ -264,6 +230,7 @@ def setup_environments
264
230
  setup_dotenv
265
231
  setup_ci
266
232
  setup_docker
233
+ setup_procfile
267
234
  end
268
235
 
269
236
  def setup_dotenv
@@ -283,11 +250,11 @@ def setup_docker
283
250
  copy_file "templates/Dockerfile", "Dockerfile"
284
251
  gsub_file "Dockerfile", "__ruby_version__", RUBY_VERSION
285
252
 
286
- if react?
287
- setup_docker_react
288
- else
289
- setup_docker_standard
290
- end
253
+ setup_docker_standard
254
+ end
255
+
256
+ def setup_procfile
257
+ copy_file "templates/Procfile", "Procfile"
291
258
  end
292
259
 
293
260
  def setup_docker_standard
@@ -295,36 +262,12 @@ def setup_docker_standard
295
262
  copy_file "templates/docker-compose.yml/docker-compose-standard.yml", "docker-compose.yml"
296
263
  end
297
264
 
298
- def setup_docker_react
299
- copy_file "templates/Dockerfile-assets", "Dockerfile-assets"
300
- gsub_file "Dockerfile-assets", "__ruby_version__", RUBY_VERSION
301
- copy_file "templates/.env.docker/.env.docker-webpack", ".env.docker"
302
- copy_file "templates/.env.docker-assets", ".env.docker-assets"
303
- copy_file "templates/docker-compose.yml/docker-compose-webpack.yml", "docker-compose.yml"
304
- end
305
-
306
265
  def setup_readme
307
266
  remove_file "README.md"
308
267
  copy_file "templates/README.md", "README.md"
309
268
  gsub_file "README.md", "__application_name__", app_name
310
269
  end
311
270
 
312
- def react?
313
- options[:webpack] == "react"
314
- end
315
-
316
- def post_bundle
317
- after_bundle do
318
- setup_react if react?
319
- remove_dir "test"
320
- git :init
321
-
322
- puts ""
323
- ascii_art
324
- post_install_instructions
325
- end
326
- end
327
-
328
271
  def ascii_art
329
272
  puts " _____ __ _ ____ ____ "
330
273
  puts " / / \\ \\ | \\ | | / \\ | \\ "
@@ -347,50 +290,14 @@ def post_install_instructions
347
290
  puts " * https://github.com/TheGnarCo/gnarails#post-install"
348
291
  end
349
292
 
350
- def setup_react
351
- install_js_deps
352
- add_js_files
353
- modify_js_files
354
- modify_npm_scripts
355
- end
356
-
357
- def install_js_deps
358
- puts "Installing Gnar react packages"
359
- run "yarn add #{JS_DEPENDENCIES.join(' ')}"
360
- run "yarn add --dev #{JS_DEV_DEPENDENCIES.join(' ')}"
361
- end
362
-
363
- def add_js_files
364
- directory "templates/react/js", "app/javascript"
365
- directory "templates/react/views", "app/views"
366
- copy_file "templates/react/layout.html.erb", "app/views/layouts/application.html.erb", force: true
367
- copy_file "templates/react/rails_routes.rb", "config/routes.rb", force: true
368
- copy_file "templates/react/controllers/home_controller.rb", "app/controllers/home_controller.rb"
369
- copy_file "templates/react/.babelrc", ".babelrc", force: true
370
- copy_file "templates/react/.eslintrc.js", ".eslintrc.js", force: true
371
- end
372
-
373
- def modify_js_files
374
- gsub_file "app/views/layouts/application.html.erb",
375
- "placeholder_application_title",
376
- app_name.tr("-", "_").titleize
377
- gsub_file "app/javascript/app_constants/index.js",
378
- " APP_NAME: 'CHANGE_ME',",
379
- " APP_NAME: '#{app_name}',"
380
- remove_file "app/javascript/packs/application.js"
381
- end
382
-
383
- def modify_npm_scripts
384
- insert_into_file "package.json", before: " \"dependencies\": {\n" do
385
- <<-NPM_SCRIPTS
386
- "scripts": {
387
- "start": "./bin/webpack-dev-server",
388
- "mocha": "NODE_PATH=./app/javascript mocha --compilers js:babel-register --require babel-polyfill --require app/javascript/test/.setup.js --recursive './app/javascript/**/*.tests.js*'",
389
- "lint": "eslint app/javascript",
390
- "test": "npm run lint && npm run mocha"
391
- },
392
- NPM_SCRIPTS
393
- end
293
+ def format_ruby
294
+ run "bundle exec rubocop --auto-correct"
295
+ end
296
+
297
+ def completion_notification
298
+ puts ""
299
+ ascii_art
300
+ post_install_instructions
394
301
  end
395
302
 
396
303
  create_gnarly_rails_app