panacea-rails 0.1.2 → 0.1.3

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: 63388e83e357176bb1ef22ce0c950a30180bb89b08598faab5e9a7dbf81e8be4
4
- data.tar.gz: 228587348d6d34e2d675adf678afb42c6c794083b82e806af8399ea8d8957178
3
+ metadata.gz: 4987b34bb96e2b84ad9e1a92b8f7e7112ad61b2472e9f1749387ee277954f397
4
+ data.tar.gz: 0aaf0bfd695851df8371fbb0ad038665b42d2db4dedb7176a75282e67f52f087
5
5
  SHA512:
6
- metadata.gz: 0e1483c884fabc80f97978935e50871de32f20812a1f833a59d2a71bb64dc7270c9e6dd4188c7783b94937fd6bb238f343c3c149d300ba4452985d13f253f08a
7
- data.tar.gz: '0019d15f77ffc5e461e588bb3a9b97f79a15a97d6ffa241c23b3016f939f26055158c377945ff34ee8167ba19626bf34a5d832dee3264037ab5bbf4df5987c99'
6
+ metadata.gz: 74681cb4461f6f5df988f7c824c9b10ffaf05cab3e5b49ea62ccfa43606561e1bf3637ceb3cf23952c292f14e3be16916402aac39c2875d974fa382da88dba8a
7
+ data.tar.gz: dff9d7e491c0807b390a137d7f129d983302893454fc4f49416f5d215530f5b7cdabcf1413759746ac1c973604767f2f9113fe2a42cf07c7bebabaea9a4e8967
data/config/questions.yml CHANGED
@@ -235,6 +235,33 @@ webpack:
235
235
  - elm
236
236
  - stimulus
237
237
 
238
+ bootswatch:
239
+ title: Do you want to use a Bootswatch 3 template?
240
+ default: false
241
+ type: boolean
242
+ disable_with: webpack
243
+ subquestions:
244
+ bootswatch_template_name:
245
+ title: Which template do you want to setup?
246
+ type: select
247
+ options:
248
+ - cerulean
249
+ - cosmo
250
+ - cyborg
251
+ - darkly
252
+ - flatly
253
+ - journal
254
+ - lumen
255
+ - paper
256
+ - readable
257
+ - sandstone
258
+ - simplex
259
+ - slate
260
+ - spacelab
261
+ - superhero
262
+ - united
263
+ - yeti
264
+
238
265
  pg_search:
239
266
  title: Do you want to use pg_search gem to enable PostgreSQL's full text search?
240
267
  default: false
@@ -98,7 +98,9 @@ module Panacea # :nodoc:
98
98
 
99
99
  def ask_questions(questions = load_questions)
100
100
  questions.each do |key, question|
101
- answer = ask_question(key, question)
101
+ disable_with = questions.dig(key, "disable_with")
102
+
103
+ answer = ask_question(key, question) unless answers.dig(disable_with)
102
104
  subquestions = question.dig("subquestions")
103
105
 
104
106
  ask_questions(subquestions) if !subquestions.nil? && answer
@@ -138,7 +140,7 @@ module Panacea # :nodoc:
138
140
 
139
141
  def load_questions
140
142
  questions_file = File.join(File.expand_path("../../../config", __dir__), "questions.yml")
141
- @questions = YAML.safe_load(File.read(questions_file))
143
+ @questions ||= YAML.safe_load(File.read(questions_file))
142
144
  end
143
145
 
144
146
  def save_answers
@@ -36,7 +36,7 @@ module Panacea # :nodoc:
36
36
 
37
37
  ###
38
38
  # Send any unknown method to the Rails::Generators::AppGenerator context.
39
- # That context also know Thor actions.
39
+ # That context also knows Thor actions.
40
40
  def method_missing(method_name, *args, &block)
41
41
  super unless app_generator.respond_to?(method_name)
42
42
  app_generator.send(method_name, *args, &block)
@@ -51,6 +51,7 @@ module Panacea # :nodoc:
51
51
  after_bundle generate rails_command template
52
52
  run git source_paths empty_directory append_to_file
53
53
  environment application say inject_into_class
54
+ inject_into_file directory
54
55
  ].include?(method_name) || super
55
56
  end
56
57
 
@@ -167,7 +168,7 @@ module Panacea # :nodoc:
167
168
  route "mount Resque::Server, at: '/jobs'"
168
169
  route "require 'resque/server'"
169
170
 
170
- template("templates/Rakefile.tt", "Rakefile", force: true)
171
+ template "templates/Rakefile.tt", "Rakefile", force: true
171
172
  end
172
173
  end
173
174
 
@@ -201,6 +202,12 @@ module Panacea # :nodoc:
201
202
  template "templates/default_locale.tt", "config/locales/#{locale}.yml" if locale != "en"
202
203
  end
203
204
 
205
+ ###
206
+ # Create database
207
+ def create_database
208
+ rails_command "db:create"
209
+ end
210
+
204
211
  ###
205
212
  # Setup Bullet gem
206
213
  def setup_bullet
@@ -239,15 +246,43 @@ module Panacea # :nodoc:
239
246
  def setup_devise
240
247
  model_name = config.dig("devise_model_name").downcase
241
248
  plural_model_name = model_name.downcase.pluralize
249
+ locale = config.dig("locale").split("- ").last
242
250
 
243
251
  generate "devise:install"
244
252
  generate "devise", model_name
245
- generate "devise:views", plural_model_name if config.dig("devise_override_views")
253
+ generate "devise:i18n:views", plural_model_name if config.dig("devise_override_views")
254
+ generate "devise:i18n:locale", locale
246
255
 
247
- rails_command "db:create"
248
256
  rails_command "db:migrate"
249
257
  end
250
258
 
259
+ ###
260
+ # Setup booswatch-rails gem.
261
+ def setup_bootswatch
262
+ run "rm app/assets/stylesheets/application.css"
263
+ template "templates/bootswatch/stylesheets/application.scss.tt", "app/assets/stylesheets/application.scss"
264
+
265
+ inject_into_file "app/assets/javascripts/application.js", after: "//= require turbolinks" do
266
+ <<~CONFS
267
+
268
+ // Requires for Bootswatch
269
+ //= require jquery
270
+ //= require bootstrap-sprockets
271
+ CONFS
272
+ end
273
+
274
+ run "rm app/views/layouts/application.html.erb"
275
+
276
+ template "templates/bootswatch/views/shared/_navbar.html.haml", "app/views/shared/_navbar.html.haml"
277
+ template "templates/bootswatch/views/shared/_flash_messages.html.haml", "app/views/shared/_flash_messages.html.haml"
278
+ template "templates/bootswatch/views/layouts/application.html.haml", "app/views/layouts/application.html.haml", force: true
279
+
280
+ generate "controller home index"
281
+ inject_into_file "config/routes.rb", "\nroot to: 'home#index'", after: "Rails.application.routes.draw do"
282
+
283
+ directory "templates/devise/views/", "app/views/devise/", force: true if config.dig("devise_override_views")
284
+ end
285
+
251
286
  ###
252
287
  # Setup money_rails gem.
253
288
  def setup_money_rails
@@ -272,7 +307,7 @@ module Panacea # :nodoc:
272
307
  def setup_foreman
273
308
  run "gem install foreman" unless system("gem list -i foreman")
274
309
 
275
- template("templates/Procfile.tt", "Procfile")
310
+ template "templates/Procfile.tt", "Procfile"
276
311
  end
277
312
 
278
313
  ###
@@ -30,6 +30,7 @@ panacea_generator.setup_rubocop
30
30
  panacea_generator.setup_letter_opener
31
31
  panacea_generator.setup_timezone
32
32
  panacea_generator.setup_default_locale
33
+ panacea_generator.create_database
33
34
  panacea_generator.setup_oj if panacea_config.dig("oj")
34
35
  panacea_generator.setup_dotenv if panacea_config.dig("dotenv")
35
36
 
@@ -44,6 +45,7 @@ panacea_generator.after_bundle_hook do |generator|
44
45
  generator.setup_money_rails if panacea_config.dig("money_rails")
45
46
  generator.setup_kaminari if panacea_config.dig("kaminari")
46
47
  generator.setup_webpack if panacea_config.dig("webpack")
48
+ generator.setup_bootswatch if panacea_config.dig("bootswatch")
47
49
  generator.setup_foreman if panacea_config.dig("foreman")
48
50
  generator.setup_pundit if panacea_config.dig("pundit")
49
51
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Panacea # :nodoc:
4
4
  module Rails # :nodoc:
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/templates/Gemfile.tt CHANGED
@@ -11,6 +11,7 @@ gem "<%= db_gem.name %>"<%= %(, '#{db_gem.version}') if db_gem.version %>
11
11
  gem "bootsnap", ">= 1.1.0", require: false
12
12
  <% if @panacea.dig("devise") -%>
13
13
  gem "devise"
14
+ gem "devise-i18n"
14
15
  <% end -%>
15
16
  gem "haml-rails"
16
17
  gem "interactor-rails"
@@ -45,6 +46,14 @@ gem "webpacker"
45
46
  gem "<%= @panacea.dig("background_job") %>"
46
47
  <% end -%>
47
48
 
49
+ <% if @panacea.dig("bootswatch") %>
50
+ # Bootswatch Dependencies
51
+ gem "bootstrap-sass", "~> 3.3.7"
52
+ gem "bootswatch-rails"
53
+ gem "font-awesome-rails"
54
+ gem "jquery-rails"
55
+ <% end %>
56
+
48
57
  # Test Suite Gem
49
58
  gem "<%= @panacea.dig("test_suite") %>-rails", group: [:development, :test]
50
59
 
@@ -0,0 +1,7 @@
1
+ <%- template_name = @panacea.dig("bootswatch_template_name") %>
2
+ @import "bootstrap-sprockets";
3
+ @import <%= "'bootswatch/#{template_name}/variables';" %>
4
+ @import "bootstrap";
5
+ @import <%= "'bootswatch/#{template_name}/bootswatch';" %>
6
+
7
+ @import "font-awesome";
@@ -0,0 +1,15 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
+ %title <%= app_name.titleize %>
6
+ = csrf_meta_tags
7
+ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
8
+ = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
9
+ %body
10
+ = render partial: 'shared/navbar'
11
+
12
+ .container
13
+ = render partial: 'shared/flash_messages'
14
+
15
+ = yield
@@ -0,0 +1,8 @@
1
+ - if alert
2
+ .alert.alert-dismissible.alert-danger
3
+ %button.close{ type: 'button', 'data-dismiss': 'alert' } &times;
4
+ = alert
5
+ - if notice
6
+ .alert.alert-dismissible.alert-success
7
+ %button.close{ type: 'button', 'data-dismiss': 'alert' } &times;
8
+ = notice
@@ -0,0 +1,10 @@
1
+ %nav.navbar.navbar-default
2
+ .container-fluid
3
+ .navbar-header
4
+ %button.navbar-toggle.collapsed{ type: 'button', 'data-toggle': 'collapse',
5
+ 'data-target': '#navbar', 'aria-expanded': false }
6
+
7
+ = link_to '<%= "#{app_name.titleize}" %>', root_path, class: 'navbar-brand light'
8
+
9
+ .collapse.navbar-collapse#navbar
10
+ %ul.nav.navbar-nav.navbar-right
@@ -0,0 +1,18 @@
1
+ %legend.center= t("resend_confirmation_instructions")
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
6
+ = devise_error_messages!
7
+
8
+ %fielset.form-group
9
+ .col-md-12
10
+ = f.label :email
11
+ = f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control"
12
+ value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email)
13
+
14
+ .col-md-12
15
+ %br
16
+ = f.submit t(".resend_confirmation_instructions")
17
+
18
+ = render "devise/shared/links"
@@ -0,0 +1,5 @@
1
+ %p= t(".greeting", recipient: email)
2
+
3
+ %p= t(".instruction")
4
+
5
+ %p= link_to t(".action"), confirmation_url(@resource, confirmation_token: @token)
@@ -0,0 +1,6 @@
1
+ %p= t(".greeting", recipient: @email)
2
+
3
+ - if @resource.try(:unconfirmed_email?)
4
+ %p= t(".message", email: @resource.unconfirmed_email)
5
+ - else
6
+ %p= t(".message", email: @resource.email)
@@ -0,0 +1,3 @@
1
+ %p= t(".greeting", recipient: @resource.email)
2
+
3
+ %p= t(".message")
@@ -0,0 +1,9 @@
1
+ %p= t(".greeting", recipient: @resource.email)
2
+
3
+ %p= t(".instruction")
4
+
5
+ %p= link_to t(".action"), edit_password_url(@resource, reset_password_token: @token)
6
+
7
+ %p= t(".instruction_2")
8
+
9
+ %p= t(".instruction_3")
@@ -0,0 +1,8 @@
1
+ %p= t(".greeting", recipient: @resource.email)
2
+
3
+ %p= t(".message")
4
+
5
+ %p= t(".instruction")
6
+
7
+ %p= link_to t(".action"), unlock_url(@resource, unlock_token: @token)
8
+
@@ -0,0 +1,25 @@
1
+ %legend.center= t(".change_your_password')
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
6
+ = devise_error_messages!
7
+
8
+ %fielset.form-group
9
+ = f.hidden_field :reset_password_token
10
+ .col-md-12
11
+ = f.label :password, t(".new_password')
12
+ %br/
13
+ - if @minimum_password_length
14
+ %em= t("devise.shared.minimum_password_length", count: @minimum_password_length)
15
+ = f.password_field :password, autofocus: true, autocomplete: "off", class: "form-control"
16
+
17
+ .col-md-12
18
+ = f.label :password_confirmation, t(".confirm_new_password")
19
+ = f.password_field :password_confirmation, autocomplete: "off", class: "form-control"
20
+
21
+ .col-md-12
22
+ %br
23
+ = f.submit t(".change_my_password")
24
+
25
+ = render "devise/shared/links"
@@ -0,0 +1,17 @@
1
+ %legend.center= t(".forgot_your_password")
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
6
+ = devise_error_messages!
7
+
8
+ %fielset.form-group
9
+ .col-md-12
10
+ = f.label :email
11
+ = f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control"
12
+
13
+ .col-md-12
14
+ %br
15
+ = f.submit t(".send_me_reset_password_instructions"), class: "btn btn-success"
16
+
17
+ = render "devise/shared/links"
@@ -0,0 +1,44 @@
1
+ %legend.center= t(".title", resource: resource_name.to_s.humanize)
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
6
+ = devise_error_messages!
7
+
8
+ %fieldset.form-group
9
+ .col-md-12
10
+ = f.label :email
11
+ = f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control"
12
+
13
+ - if devise_mapping.confirmable? && resource.pending_reconfirmation?
14
+ %div= t(".currently_waiting_confirmation_for_email", email: resource.unconfirmed_email)
15
+
16
+ .col-md-12
17
+ = f.label :password
18
+ %br
19
+ %i= t(".leave_blank_if_you_don_t_want_to_change_it")
20
+ = f.password_field :password, autocomplete: "off", class: "form-control"
21
+ - if @minimum_password_length
22
+ %em= t("devise.shared.minimum_password_length"), count: @minimum_password_length
23
+
24
+ .col-md-12
25
+ = f.label :password_confirmation
26
+ = f.password_field :password_confirmation, autocomplete: "off", class: "form-control"
27
+
28
+ .col-md-12
29
+ = f.label :current_password
30
+ %br
31
+ %i= t(".we_need_your_current_password_to_confirm_your_changes")
32
+ = f.password_field :current_password, autocomplete: "off", class: "form-control"
33
+
34
+ .col-md-12
35
+ %br
36
+ = f.submit t(".update"), class: "btn btn-success"
37
+
38
+ = link_to t("devise.shared.links.back"), :back
39
+
40
+ .row.center
41
+ %hr
42
+ %h4= t(".cancel_my_account")
43
+ %p= t(".unhappy")
44
+ = button_to t("cancel_my_account"), registration_path(resource_name), data: { confirm: t(".are_you_sure") }, method: :delete, class: "btn btn-sm btn-danger" }
@@ -0,0 +1,27 @@
1
+ %legend.center= t(".sign_up")
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
6
+ = devise_error_messages!
7
+
8
+ %fieldset.form-group
9
+ .col-md-12
10
+ = f.label :email
11
+ = f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control"
12
+
13
+ .col-md-12
14
+ = f.label :password
15
+ - if @minimum_password_length
16
+ %em= t("devise.shared.minimum_password_length", count: @minimum_password_length)
17
+ = f.password_field :password, autocomplete: "off", class: "form-control"
18
+
19
+ .col-md-12
20
+ = f.label :password_confirmation
21
+ = f.password_field :password_confirmation, autocomplete: "off", class: "form-control"
22
+
23
+ .col-md-12
24
+ %br
25
+ = f.submit t(".sign_up"), class: "btn btn-success"
26
+
27
+ = render "devise/shared/links"
@@ -0,0 +1,24 @@
1
+ %legend.center= t(".sign_in")
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
6
+ %fielset.form-group
7
+ .col-md-12
8
+ = f.label :email
9
+ = f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control"
10
+
11
+ .col-md-12
12
+ = f.label :password
13
+ = f.password_field :password, autocomplete: "off", class: "form-control"
14
+
15
+ - if devise_mapping.rememberable?
16
+ .col-md-12
17
+ %br
18
+ = f.check_box :remember_me
19
+ = f.label :remember_me
20
+
21
+ .col-md-12
22
+ = f.submit t(".sign_in"), class: "btn btn-success"
23
+
24
+ = render "devise/shared/links"
@@ -0,0 +1,24 @@
1
+ - if controller_name != 'sessions'
2
+ = link_to t(".sign_in"), new_session_path(resource_name)
3
+ %br/
4
+
5
+ - if devise_mapping.registerable? && controller_name != 'registrations'
6
+ = link_to t(".sign_up"), new_registration_path(resource_name)
7
+ %br/
8
+
9
+ - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
10
+ = link_to t(".forgot_your_password"), new_password_path(resource_name)
11
+ %br/
12
+
13
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
14
+ = link_to t(".didn_t_receive_confirmation_instructions"), new_confirmation_path(resource_name)
15
+ %br/
16
+
17
+ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
18
+ = link_to t(".didn_t_receive_unlock_instructions"), new_unlock_path(resource_name)
19
+ %br/
20
+
21
+ - if devise_mapping.omniauthable?
22
+ - resource_class.omniauth_providers.each do |provider|
23
+ = link_to t(".sign_in_with_provider", provider: "#{OmniAuth::Utils.camelize(provider)}"), omniauth_authorize_path(resource_name, provider)
24
+ %br/
@@ -0,0 +1,17 @@
1
+ %legend.center= t(".resend_unlock_instructions")
2
+
3
+ .col-md-4.col-md-offset-4
4
+ .well
5
+ = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
6
+ = devise_error_messages!
7
+
8
+ %fielset.form-group
9
+ .col-md-12
10
+ = f.label :email
11
+ = f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control"
12
+
13
+ .col-md-12
14
+ %br
15
+ = f.submit t(".resend_unlock_instructions)", class: "btn btn-success"
16
+
17
+ = render "devise/shared/links"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panacea-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillermo Moreno
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-09-19 00:00:00.000000000 Z
13
+ date: 2018-09-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -148,7 +148,24 @@ files:
148
148
  - templates/README.tt
149
149
  - templates/Rakefile.tt
150
150
  - templates/application_system_test.tt
151
+ - templates/bootswatch/stylesheets/application.scss.tt
152
+ - templates/bootswatch/views/layouts/application.html.haml
153
+ - templates/bootswatch/views/shared/_flash_messages.html.haml
154
+ - templates/bootswatch/views/shared/_navbar.html.haml
151
155
  - templates/default_locale.tt
156
+ - templates/devise/views/confirmations/new.html.haml
157
+ - templates/devise/views/mailer/confirmation_instructions.html.haml
158
+ - templates/devise/views/mailer/email_changed.html.haml
159
+ - templates/devise/views/mailer/password_change.html.haml
160
+ - templates/devise/views/mailer/reset_password_instructions.html.haml
161
+ - templates/devise/views/mailer/unlock_instructions.html.haml
162
+ - templates/devise/views/passwords/edit.html.haml
163
+ - templates/devise/views/passwords/new.html.haml
164
+ - templates/devise/views/registrations/edit.html.haml
165
+ - templates/devise/views/registrations/new.html.haml
166
+ - templates/devise/views/sessions/new.html.haml
167
+ - templates/devise/views/shared/_links.html.haml
168
+ - templates/devise/views/unlocks/new.html.haml
152
169
  - templates/dotenv.tt
153
170
  - templates/githook.tt
154
171
  - templates/minitest_test_helper.tt