underlay 1.50.1 → 1.52.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fe8523d018762fed74e94b455407b356d91c32e26558db70044b366e4971ae3
4
- data.tar.gz: a3e90a69b043ba06d48e694b34d16da30f7fb7f8f41b391bc2d96df66e599f27
3
+ metadata.gz: 9dde78cb7d8ba8f2c8c7f93250425fb19b24ebb44907faacf37453e5d293a109
4
+ data.tar.gz: 1a5a24be479c3750e32430ffa8e08fe2eb595e7a4c6657d06cd9661c76dfa247
5
5
  SHA512:
6
- metadata.gz: cc80e1ba6629d92fb1977b5159e850ff4f3d9dd5579025e28e245f9cbacd7bfd321e9f2d8b221dfc8ccf268dd096088cebaeaad848e2f7da6e0208a9af276665
7
- data.tar.gz: 7c6d8069f5b175fd5495181a714fa87b5bf4ab6a753a838aa43df888a354656a62592d435cf46c0cdc2f62004d891a186e586be04c46ab6dc2057b8c6ec9f35f
6
+ metadata.gz: fbd4a1c9931e083852d4d11af6b644a735ee9ea4f83b5ec956d38de51e2360f7e1bcd1799b58e6bf15c0740c78246797b31d21b25375d5c042a16b0819f20608
7
+ data.tar.gz: cba387c279816491b9ea3fac214480750b48391842baf47d26e8bc2bd34cfde93700f50dc5278d6400d74d229cee1c6c997137ddb81439b8abb48ec2798b6c81
data/README.md CHANGED
@@ -12,7 +12,7 @@ Then run:
12
12
 
13
13
  underlay projectname
14
14
 
15
- This will create a Rails app in `projectname` using the latest version of Rails.
15
+ This will create a Rails API app in `projectname` using the latest version of Rails.
16
16
 
17
17
  ### Associated services
18
18
 
@@ -155,13 +155,13 @@ around stale code not being refreshed.
155
155
  If you think your application is running old code, run `spring stop`.
156
156
  And if you'd rather not use spring, add `DISABLE_SPRING=1` to your login file.
157
157
 
158
- ## Api
158
+ ## Application mode
159
159
 
160
- You can set app to API mode:
160
+ You can set Application mode:
161
161
 
162
- `underlay app --api true`
162
+ `underlay app --application_mode true`
163
163
 
164
- This creates API application without assets and action cable.
164
+ This creates full Rails application including assets and action cable.
165
165
 
166
166
  ## Dependencies
167
167
 
@@ -173,10 +173,10 @@ PostgreSQL needs to be installed and running for the `db:create` rake task.
173
173
 
174
174
  - [X] Install TwilioBase gem (if the option is set)
175
175
  - [x] Remove duplicate application.html.erb layout
176
- - [ ] Fix issue with flashes.scss partial not being added to assets
176
+ - [X] Fix issue with flashes.scss partial not being added to assets
177
177
  - [ ] Configure s3 buckets and ENV vars
178
- - [ ] Manually check all files are created and in place
179
- - [ ] Configure Redis on heroku (with config vars + initializer)
178
+ - [X] Manually check all files are created and in place
179
+ - [X] Configure Redis on heroku (with config vars + initializer)
180
180
  - [X] Update rake (in generated project) to run lints
181
181
  - [X] Prevent views and static sites from generating in API mode
182
182
  - [ ] Setup default front-end libraries and depencies
@@ -429,6 +429,7 @@ module Underlay
429
429
  copy_file 'errors.rb', 'config/initializers/errors.rb'
430
430
  copy_file 'json_encoding.rb', 'config/initializers/json_encoding.rb'
431
431
  copy_file 'lograge.rb', 'config/initializers/lograge.rb'
432
+ copy_file 'redis.rb', 'config/initializers/redis.rb'
432
433
  copy_file 'sentry.rb', 'config/initializers/sentry.rb'
433
434
  end
434
435
 
@@ -504,7 +505,7 @@ module Underlay
504
505
  "if Rails.root.join('tmp', 'caching-dev.txt').exist?"
505
506
  )
506
507
 
507
- simple_form_corrections unless options[:api]
508
+ simple_form_corrections unless api_mode?
508
509
  end
509
510
 
510
511
  def non_api_files_removal
@@ -546,11 +547,15 @@ module Underlay
546
547
  end
547
548
 
548
549
  def mode_dependent_files
549
- if options[:api]
550
+ if api_mode?
550
551
  ['initializers/cors.rb']
551
552
  else
552
553
  ['initializers/simple_form.rb']
553
554
  end
554
555
  end
556
+
557
+ def api_mode?
558
+ options[:application_mode].blank?
559
+ end
555
560
  end
556
561
  end
@@ -7,6 +7,10 @@ module Underlay
7
7
  class AppGenerator < Rails::Generators::AppGenerator
8
8
  hide!
9
9
 
10
+ class_option :application_mode,
11
+ type: :boolean, default: false,
12
+ desc: 'Application mode is enabled'
13
+
10
14
  class_option :database,
11
15
  type: :string, aliases: '-d', default: 'postgresql',
12
16
  desc: "Configure for selected database (options: #{DATABASES.join('/')})"
@@ -47,6 +51,18 @@ module Underlay
47
51
  type: :boolean, aliases: '-v', group: :underlay,
48
52
  desc: 'Show Underlay version number and quit'
49
53
 
54
+ def initialize(*args)
55
+ super
56
+
57
+ if api_mode?
58
+ self.options = options.merge(
59
+ api: true,
60
+ skip_sprockets: true,
61
+ skip_javascript: true
62
+ ).freeze
63
+ end
64
+ end
65
+
50
66
  def finish_template
51
67
  invoke :underlay_customization
52
68
  super
@@ -266,15 +282,19 @@ module Underlay
266
282
  end
267
283
 
268
284
  def build_for_non_api(args)
269
- return if options[:api]
285
+ return if api_mode?
270
286
 
271
287
  build args
272
288
  end
273
289
 
274
290
  def build_for_api(args)
275
- return unless options[:api]
291
+ return unless api_mode?
276
292
 
277
293
  build args
278
294
  end
295
+
296
+ def api_mode?
297
+ options[:application_mode].blank?
298
+ end
279
299
  end
280
300
  end
@@ -6,5 +6,5 @@ module Underlay
6
6
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
7
7
  .strip
8
8
  .freeze
9
- VERSION = '1.50.1'
9
+ VERSION = '1.52.1'
10
10
  end
@@ -55,6 +55,7 @@ group :development, :test do
55
55
  gem 'pry-rails'
56
56
  gem 'rspec-rails', '~> 3.6'
57
57
  gem 'rubocop', require: false
58
+ gem 'underlay'
58
59
  <% unless options[:api] -%>
59
60
  gem 'scss_lint', require: false
60
61
  gem 'slim_lint', require: false
@@ -4,6 +4,7 @@ default: &default
4
4
  PORT: '3000'
5
5
  RACK_ENV: 'development'
6
6
  RACK_MINI_PROFILER: '0'
7
+ REDISTOGO_URL: 'redis://localhost'
7
8
  SECRET_KEY_BASE: 'development_secret'
8
9
  EXECJS_RUNTIME: 'Node'
9
10
  SMTP_ADDRESS: ''
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ uri = URI.parse(ENV.fetch('REDISTOGO_URL'))
4
+ REDIS = Redis.new(url: uri)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: underlay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.50.1
4
+ version: 1.52.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dvelp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-03 00:00:00.000000000 Z
11
+ date: 2019-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,6 +138,7 @@ files:
138
138
  - templates/puma.rb
139
139
  - templates/rack_mini_profiler.rb
140
140
  - templates/rails_helper.rb
141
+ - templates/redis.rb
141
142
  - templates/rubocop.yml.erb
142
143
  - templates/scss-lint.yml.erb
143
144
  - templates/secrets.yml