happy_seed 0.0.19 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -69
- data/bin/rails +12 -0
- data/bin/rspec +16 -0
- data/happy_seed.rb +5 -1
- data/happy_seed.txt +25 -18
- data/lib/generators/happy_seed/admin/admin_generator.rb +40 -5
- data/lib/generators/happy_seed/admin/templates/app/admin/campaigns.rb +10 -14
- data/lib/generators/happy_seed/admin/templates/app/admin/newsletter.rb +2 -2
- data/lib/generators/happy_seed/admin/templates/app/admin/user.rb +4 -1
- data/lib/generators/happy_seed/admin/templates/app/controllers/admin/stats_controller.rb +1 -1
- data/lib/generators/happy_seed/admin/templates/docs/README.07.admin.rdoc +33 -4
- data/lib/generators/happy_seed/angular_view/templates/docs/README.11.angular_view.rdoc +2 -4
- data/lib/generators/happy_seed/api/api_generator.rb +38 -39
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/base_controller.rb +4 -5
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb +3 -20
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/user_tokens_controller.rb +13 -36
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/users_controller.rb +14 -40
- data/lib/generators/happy_seed/api/templates/config/initializers/apitome.rb +1 -1
- data/lib/generators/happy_seed/api/templates/docs/README.01.api.rdoc +4 -1
- data/lib/generators/happy_seed/api/templates/docs/api.md +2 -2
- data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/user_tokens_spec.rb +10 -53
- data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/users_spec.rb +17 -61
- data/lib/generators/happy_seed/base/base_generator.rb +47 -19
- data/lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb +1 -1
- data/lib/generators/happy_seed/base/templates/app/views/setup/index.html.haml +6 -3
- data/lib/generators/happy_seed/base/templates/application_controller.rb +1 -1
- data/lib/generators/happy_seed/base/templates/docs/README.00.base.rdoc +3 -3
- data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +5 -2
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application.scss +5 -1
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_profile_panels.scss +62 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_slideup_header.scss +51 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/shared/_grid.scss +0 -12
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_javascripts.html.haml +7 -4
- data/lib/generators/happy_seed/bootstrap/templates/docs/README.01.bootstrap.rdoc +3 -0
- data/lib/generators/happy_seed/ckeditor/ckeditor_generator.rb +31 -0
- data/lib/generators/happy_seed/ckeditor/templates/docs/README.01.ckeditor.rdoc +35 -0
- data/lib/generators/happy_seed/devise/devise_generator.rb +12 -19
- data/lib/generators/happy_seed/devise/templates/app/views/devise/confirmations/new.html.haml +17 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.html.erb +14 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.text.rhtml +7 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/password_change.html.erb +3 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.html.erb +15 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.text.erb +11 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/edit.html.haml +14 -13
- data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/new.html.haml +12 -16
- data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/edit.html.haml +28 -40
- data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +16 -24
- data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +13 -18
- data/lib/generators/happy_seed/devise/templates/app/views/devise/shared/_links.html.erb +25 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/unlocks/new.html.erb +16 -0
- data/lib/generators/happy_seed/devise/templates/docs/README.03.devise.rdoc +2 -2
- data/lib/generators/happy_seed/devise/templates/spec/factories/users.rb +5 -4
- data/lib/generators/happy_seed/devise/templates/spec/features/registration_spec.rb +149 -0
- data/lib/generators/happy_seed/devise/templates/spec/mailers/previews/devise_preview.rb +28 -0
- data/lib/generators/happy_seed/devise_confirmable/devise_confirmable_generator.rb +45 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/add_confirmable_to_devise.rb +24 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/controllers/confirmations_controller.rb +10 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/edit.html.haml +22 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/new.html.haml +20 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/docs/README.03.devise_confirmable.rdoc +23 -0
- data/lib/generators/happy_seed/devise_invitable/devise_invitable_generator.rb +3 -1
- data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/edit.html.haml +3 -2
- data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/new.html.haml +3 -2
- data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
- data/lib/generators/happy_seed/devise_invitable/templates/spec/features/invitations_spec.rb +61 -0
- data/lib/generators/happy_seed/facebook/facebook_generator.rb +2 -0
- data/lib/generators/happy_seed/facebook/templates/spec/features/facebook_registration_spec.rb +72 -0
- data/lib/generators/happy_seed/googleoauth/googleoauth_generator.rb +1 -1
- data/lib/generators/happy_seed/happy_seed_generator.rb +1 -3
- data/lib/generators/happy_seed/html_email/html_email_generator.rb +32 -0
- data/lib/generators/happy_seed/html_email/templates/app/views/layouts/mailer.html.erb +244 -0
- data/lib/generators/happy_seed/html_email/templates/docs/README.01.html_email.rdoc +25 -0
- data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +4 -2
- data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +3 -13
- data/lib/generators/happy_seed/omniauth/templates/app/models/identity.rb +13 -9
- data/lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc +5 -5
- data/lib/generators/happy_seed/omniauth/templates/spec/factories/oauth.rb +6 -1
- data/lib/generators/happy_seed/omniauth/templates/spec/features/oauth_registration_spec.rb +80 -0
- data/lib/generators/happy_seed/omniauth/templates/spec/models/identity_spec.rb +39 -12
- data/lib/generators/happy_seed/omniauth/templates/{app/models/form_user.rb → user.rb} +4 -5
- data/lib/generators/happy_seed/plugin/plugin_generator.rb +13 -11
- data/lib/generators/happy_seed/react/react_generator.rb +36 -0
- data/lib/generators/happy_seed/react/templates/docs/README.10.react.rdoc +20 -0
- data/lib/generators/happy_seed/roles/roles_generator.rb +38 -0
- data/lib/generators/happy_seed/roles/templates/ability.rb +9 -0
- data/lib/generators/happy_seed/roles/templates/docs/README.03.roles.rdoc +23 -0
- data/lib/generators/happy_seed/simple_cms/simple_cms_generator.rb +41 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/admin/simple_content.rb +42 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/controllers/simple_content_controller.rb +7 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/models/simple_content.rb +5 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/faq.html.haml +13 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/index.html.haml +79 -0
- data/lib/generators/happy_seed/simple_cms/templates/application_helper.rb +18 -0
- data/lib/generators/happy_seed/simple_cms/templates/create_simple_contents.rb +14 -0
- data/lib/generators/happy_seed/simple_cms/templates/docs/README.04.simple_cms.rdoc +32 -0
- data/lib/generators/happy_seed/simple_cms/templates/spec/factories/oauth.rb +10 -0
- data/lib/generators/happy_seed/simple_cms/templates/spec/features/oauth_registration_spec.rb +80 -0
- data/lib/generators/happy_seed/simple_cms/templates/spec/models/identity_spec.rb +49 -0
- data/lib/generators/happy_seed/splash/templates/app/assets/stylesheets/splash.css.scss +119 -84
- data/lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb +1 -1
- data/lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml +15 -18
- data/lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml +54 -92
- data/lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc +2 -2
- data/lib/generators/happy_seed/splash/templates/spec/controllers/splash_controller_spec.rb +11 -3
- data/lib/generators/happy_seed/static/templates/source/stylesheets/application.css.scss +1 -1
- data/lib/generators/happy_seed/static_blog/templates/Gemfile.lock +45 -49
- data/lib/generators/happy_seed/twitter/templates/spec/features/twitter_oauth_registration_spec.rb +57 -0
- data/lib/generators/happy_seed/twitter/twitter_generator.rb +2 -1
- data/lib/happy_seed/cli.rb +1 -1
- data/lib/happy_seed/engine.rb +12 -0
- data/lib/happy_seed/version.rb +1 -1
- data/lib/tasks/seed.rake +56 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/spec/dummy/app/assets/config/manifest.js +5 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +3 -3
- data/spec/dummy/app/assets/javascripts/cable.coffee +11 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +4 -4
- data/spec/dummy/app/channels/application_cable/channel.rb +5 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/{test → spec}/dummy/bin/bundle +0 -0
- data/{test → spec}/dummy/bin/rails +1 -1
- data/{test → spec}/dummy/bin/rake +0 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config.ru +8 -0
- data/spec/dummy/config/application.rb +21 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +28 -3
- data/{test → spec}/dummy/config/environments/production.rb +29 -24
- data/{test → spec}/dummy/config/environments/test.rb +6 -3
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/{test → spec}/dummy/config/initializers/assets.rb +3 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
- data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +3 -1
- data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
- data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/{test → spec}/dummy/config/secrets.yml +3 -3
- data/spec/dummy/db/schema.rb +16 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test/dummy/public/favicon.ico → spec/dummy/public/apple-touch-icon-precomposed.png} +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +58 -0
- data/spec/spec_helper.rb +91 -0
- metadata +195 -89
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/configurations_controller.rb +0 -11
- data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/configurations_spec.rb +0 -21
- data/lib/generators/happy_seed/base/templates/config/puma.rb +0 -15
- data/lib/generators/happy_seed/base/templates/spec/support/controller_helpers.rb +0 -12
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/sections/_profile_page.scss +0 -9
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/_form.html.haml +0 -5
- data/lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb +0 -54
- data/lib/generators/happy_seed/devise/templates/test/mailers/previews/devise_preview.rb +0 -13
- data/lib/generators/happy_seed/omniauth/templates/spec/features/registration_spec.rb +0 -81
- data/lib/generators/happy_seed/static/templates/Gemfile.lock +0 -158
- data/lib/tasks/seed_tasks.rake +0 -4
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -23
- data/test/dummy/config/initializers/jazz_hands.rb +0 -5
- data/test/dummy/config/routes.rb +0 -56
- data/test/seed_test.rb +0 -7
- data/test/test_helper.rb +0 -15
@@ -14,13 +14,9 @@ Rails.application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
16
|
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
20
|
-
# config.action_dispatch.rack_cache = true
|
21
|
-
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
config.serve_static_assets = false
|
17
|
+
# Disable serving static files from the `/public` folder by default since
|
18
|
+
# Apache or NGINX already handles this.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
24
20
|
|
25
21
|
# Compress JavaScripts and CSS.
|
26
22
|
config.assets.js_compressor = :uglifier
|
@@ -29,36 +25,48 @@ Rails.application.configure do
|
|
29
25
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
26
|
config.assets.compile = false
|
31
27
|
|
32
|
-
#
|
28
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
29
|
+
# yet still be able to expire them through the digest params.
|
33
30
|
config.assets.digest = true
|
34
31
|
|
35
|
-
# `config.assets.precompile`
|
32
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
35
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
36
36
|
|
37
37
|
# Specifies the header that your server uses for sending files.
|
38
|
-
# config.action_dispatch.x_sendfile_header =
|
39
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for
|
38
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
39
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
40
|
+
|
41
|
+
# Action Cable endpoint configuration
|
42
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
43
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
40
44
|
|
41
45
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
42
46
|
# config.force_ssl = true
|
43
47
|
|
44
|
-
#
|
45
|
-
|
48
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
49
|
+
# when problems arise.
|
50
|
+
config.log_level = :debug
|
46
51
|
|
47
52
|
# Prepend all log lines with the following tags.
|
48
|
-
|
53
|
+
config.log_tags = [ :request_id ]
|
49
54
|
|
50
55
|
# Use a different logger for distributed setups.
|
51
|
-
#
|
56
|
+
# require 'syslog/logger'
|
57
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
58
|
+
|
59
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
60
|
+
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
|
61
|
+
end
|
52
62
|
|
53
63
|
# Use a different cache store in production.
|
54
64
|
# config.cache_store = :mem_cache_store
|
55
65
|
|
56
|
-
#
|
57
|
-
# config.
|
58
|
-
|
59
|
-
|
60
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
61
|
-
# config.assets.precompile += %w( search.js )
|
66
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
67
|
+
# config.active_job.queue_adapter = :resque
|
68
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
69
|
+
config.action_mailer.perform_caching = false
|
62
70
|
|
63
71
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
72
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -71,9 +79,6 @@ Rails.application.configure do
|
|
71
79
|
# Send deprecation notices to registered listeners.
|
72
80
|
config.active_support.deprecation = :notify
|
73
81
|
|
74
|
-
# Disable automatic flushing of the log to improve performance.
|
75
|
-
# config.autoflush_log = false
|
76
|
-
|
77
82
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
78
83
|
config.log_formatter = ::Logger::Formatter.new
|
79
84
|
|
@@ -12,9 +12,11 @@ Rails.application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
# Configure
|
16
|
-
config.
|
17
|
-
config.
|
15
|
+
# Configure public file server for tests with Cache-Control for performance.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => 'public, max-age=3600'
|
19
|
+
}
|
18
20
|
|
19
21
|
# Show full error reports and disable caching.
|
20
22
|
config.consider_all_requests_local = true
|
@@ -25,6 +27,7 @@ Rails.application.configure do
|
|
25
27
|
|
26
28
|
# Disable request forgery protection in test environment.
|
27
29
|
config.action_controller.allow_forgery_protection = false
|
30
|
+
config.action_mailer.perform_caching = false
|
28
31
|
|
29
32
|
# Tell Action Mailer not to deliver emails to the real world.
|
30
33
|
# The :test delivery method accumulates sent emails in the
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Require `belongs_to` associations by default. This is a new Rails 5.0
|
4
|
+
# default, so it is introduced as a configuration option to ensure that apps
|
5
|
+
# made on earlier versions of Rails are not affected when upgrading.
|
6
|
+
Rails.application.config.active_record.belongs_to_required_by_default = true
|
@@ -3,6 +3,9 @@
|
|
3
3
|
# Version of your assets, change this if you want to expire all your assets.
|
4
4
|
Rails.application.config.assets.version = '1.0'
|
5
5
|
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
6
9
|
# Precompile additional assets.
|
7
10
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
8
11
|
# Rails.application.config.assets.precompile += %w( search.js )
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Do not halt callback chains when a callback returns false. This is a new
|
4
|
+
# Rails 5.0 default, so it is introduced as a configuration option to ensure
|
5
|
+
# that apps made with earlier versions of Rails are not affected when upgrading.
|
6
|
+
ActiveSupport.halt_callback_chains_on_return_false = false
|
@@ -1,3 +1,5 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
|
3
|
+
# Specify a serializer for the signed and encrypted cookie jars.
|
4
|
+
# Valid options are :json, :marshal, and :hybrid.
|
5
|
+
Rails.application.config.action_dispatch.cookies_serializer = :json
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,10 +5,10 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# To enable root element in JSON for ActiveRecord objects.
|
12
12
|
# ActiveSupport.on_load(:active_record) do
|
13
|
-
#
|
13
|
+
# self.include_root_in_json = true
|
14
14
|
# end
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum, this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
8
|
+
threads threads_count, threads_count
|
9
|
+
|
10
|
+
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
11
|
+
#
|
12
|
+
port ENV.fetch("PORT") { 3000 }
|
13
|
+
|
14
|
+
# Specifies the `environment` that Puma will run in.
|
15
|
+
#
|
16
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
17
|
+
|
18
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
19
|
+
# Workers are forked webserver processes. If using threads and workers together
|
20
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
21
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
22
|
+
# processes).
|
23
|
+
#
|
24
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
25
|
+
|
26
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
27
|
+
# This directive tells Puma to first boot the application and load code
|
28
|
+
# before forking the application. This takes advantage of Copy On Write
|
29
|
+
# process behavior so workers use less memory. If you use this option
|
30
|
+
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
31
|
+
# block.
|
32
|
+
#
|
33
|
+
# preload_app!
|
34
|
+
|
35
|
+
# The code in the `on_worker_boot` will be called if you are using
|
36
|
+
# clustered mode by specifying a number of `workers`. After each worker
|
37
|
+
# process is booted this block will be run, if you are using `preload_app!`
|
38
|
+
# option you will want to use this block to reconnect to any threads
|
39
|
+
# or connections that may have been created at application boot, Ruby
|
40
|
+
# cannot share connections between processes.
|
41
|
+
#
|
42
|
+
# on_worker_boot do
|
43
|
+
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
44
|
+
# end
|
45
|
+
|
46
|
+
# Allow puma to be restarted by `rails restart` command.
|
47
|
+
plugin :tmp_restart
|
@@ -5,16 +5,16 @@
|
|
5
5
|
|
6
6
|
# Make sure the secret is at least 30 characters and all random,
|
7
7
|
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `
|
8
|
+
# You can use `rails secret` to generate a secure secret key.
|
9
9
|
|
10
10
|
# Make sure the secrets in this file are kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
12
|
|
13
13
|
development:
|
14
|
-
secret_key_base:
|
14
|
+
secret_key_base: b94dd413b6a186116fdde2d5d10d17d2e50a103a8de01b6dcd305e6d4ccc44b369b558224d33ce6c680e83e41332d398383a3eef2a4ad87a2095b9f275af9738
|
15
15
|
|
16
16
|
test:
|
17
|
-
secret_key_base:
|
17
|
+
secret_key_base: 54218459a46d04d45842a43f1508c9892a51ea5e51df193c7d8320310909e44343a7b835be999c3df65471d6a1a22b8e2b9234a698926528875fa3bf33df1609
|
18
18
|
|
19
19
|
# Do not keep production secrets in the repository,
|
20
20
|
# instead read values from the environment.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 0) do
|
15
|
+
|
16
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
4
|
+
|
5
|
+
# Prevent database truncation if the environment is production
|
6
|
+
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'rspec/rails'
|
9
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
10
|
+
|
11
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
12
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
13
|
+
# run as spec files by default. This means that files in spec/support that end
|
14
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
15
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
16
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
17
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
18
|
+
|
19
|
+
# The following line is provided for convenience purposes. It has the downside
|
20
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
21
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
22
|
+
# require only the support files necessary.
|
23
|
+
|
24
|
+
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
25
|
+
|
26
|
+
# Checks for pending migration and applies them before tests are run.
|
27
|
+
# If you are not using ActiveRecord, you can remove this line.
|
28
|
+
ActiveRecord::Migration.maintain_test_schema!
|
29
|
+
|
30
|
+
RSpec.configure do |config|
|
31
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
32
|
+
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
33
|
+
|
34
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
35
|
+
# examples within a transaction, remove the following line or assign false
|
36
|
+
# instead of true.
|
37
|
+
config.use_transactional_fixtures = true
|
38
|
+
|
39
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
40
|
+
# based on their file location, for example enabling you to call `get` and
|
41
|
+
# `post` in specs under `spec/controllers`.
|
42
|
+
|
43
|
+
# You can disable this behaviour by removing the line below, and instead
|
44
|
+
# explicitly tag your specs with their type, e.g.:
|
45
|
+
#
|
46
|
+
# RSpec.describe UsersController, :type => :controller do
|
47
|
+
# # ...
|
48
|
+
# end
|
49
|
+
|
50
|
+
# The different available types are documented in the features, such as in
|
51
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
52
|
+
# config.infer_spec_type_from_file_location!
|
53
|
+
|
54
|
+
# Filter lines from Rails gems in backtraces.
|
55
|
+
config.filter_rails_from_backtrace!
|
56
|
+
# arbitrary gems may also be filtered via:
|
57
|
+
# config.filter_gems_from_backtrace("gem name")
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
# The settings below are suggested to provide a good initial experience
|
44
|
+
# with RSpec, but feel free to customize to your heart's content.
|
45
|
+
|
46
|
+
# This allows you to limit a spec run to individual examples or groups
|
47
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
48
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
49
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
50
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
51
|
+
config.filter_run_when_matching :focus
|
52
|
+
|
53
|
+
# Allows RSpec to persist some state between runs in order to support
|
54
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
55
|
+
# you configure your source control system to ignore this file.
|
56
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
57
|
+
|
58
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
59
|
+
# recommended. For more details, see:
|
60
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
61
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
62
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
63
|
+
config.disable_monkey_patching!
|
64
|
+
|
65
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
66
|
+
# file, and it's useful to allow more verbose output when running an
|
67
|
+
# individual spec file.
|
68
|
+
if config.files_to_run.one?
|
69
|
+
# Use the documentation formatter for detailed output,
|
70
|
+
# unless a formatter has already been configured
|
71
|
+
# (e.g. via a command-line flag).
|
72
|
+
config.default_formatter = 'doc'
|
73
|
+
end
|
74
|
+
|
75
|
+
# Print the 10 slowest examples and example groups at the
|
76
|
+
# end of the spec run, to help surface which specs are running
|
77
|
+
# particularly slow.
|
78
|
+
config.profile_examples = 10
|
79
|
+
|
80
|
+
# Run specs in random order to surface order dependencies. If you find an
|
81
|
+
# order dependency and want to debug it, you can fix the order by providing
|
82
|
+
# the seed, which is printed after each run.
|
83
|
+
# --seed 1234
|
84
|
+
config.order = :random
|
85
|
+
|
86
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
87
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
88
|
+
# test failures related to randomization by passing the same `--seed` value
|
89
|
+
# as the one that triggered the failure.
|
90
|
+
Kernel.srand config.seed
|
91
|
+
end
|