happy_seed 0.0.19 → 0.0.21

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 (190) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -69
  3. data/bin/rails +12 -0
  4. data/bin/rspec +16 -0
  5. data/happy_seed.rb +5 -1
  6. data/happy_seed.txt +25 -18
  7. data/lib/generators/happy_seed/admin/admin_generator.rb +40 -5
  8. data/lib/generators/happy_seed/admin/templates/app/admin/campaigns.rb +10 -14
  9. data/lib/generators/happy_seed/admin/templates/app/admin/newsletter.rb +2 -2
  10. data/lib/generators/happy_seed/admin/templates/app/admin/user.rb +4 -1
  11. data/lib/generators/happy_seed/admin/templates/app/controllers/admin/stats_controller.rb +1 -1
  12. data/lib/generators/happy_seed/admin/templates/docs/README.07.admin.rdoc +33 -4
  13. data/lib/generators/happy_seed/angular_view/templates/docs/README.11.angular_view.rdoc +2 -4
  14. data/lib/generators/happy_seed/api/api_generator.rb +38 -39
  15. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/base_controller.rb +4 -5
  16. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb +3 -20
  17. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/user_tokens_controller.rb +13 -36
  18. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/users_controller.rb +14 -40
  19. data/lib/generators/happy_seed/api/templates/config/initializers/apitome.rb +1 -1
  20. data/lib/generators/happy_seed/api/templates/docs/README.01.api.rdoc +4 -1
  21. data/lib/generators/happy_seed/api/templates/docs/api.md +2 -2
  22. data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/user_tokens_spec.rb +10 -53
  23. data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/users_spec.rb +17 -61
  24. data/lib/generators/happy_seed/base/base_generator.rb +47 -19
  25. data/lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb +1 -1
  26. data/lib/generators/happy_seed/base/templates/app/views/setup/index.html.haml +6 -3
  27. data/lib/generators/happy_seed/base/templates/application_controller.rb +1 -1
  28. data/lib/generators/happy_seed/base/templates/docs/README.00.base.rdoc +3 -3
  29. data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +5 -2
  30. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application.scss +5 -1
  31. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_profile_panels.scss +62 -0
  32. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_slideup_header.scss +51 -0
  33. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/shared/_grid.scss +0 -12
  34. data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_javascripts.html.haml +7 -4
  35. data/lib/generators/happy_seed/bootstrap/templates/docs/README.01.bootstrap.rdoc +3 -0
  36. data/lib/generators/happy_seed/ckeditor/ckeditor_generator.rb +31 -0
  37. data/lib/generators/happy_seed/ckeditor/templates/docs/README.01.ckeditor.rdoc +35 -0
  38. data/lib/generators/happy_seed/devise/devise_generator.rb +12 -19
  39. data/lib/generators/happy_seed/devise/templates/app/views/devise/confirmations/new.html.haml +17 -0
  40. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.html.erb +14 -0
  41. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.text.rhtml +7 -0
  42. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/password_change.html.erb +3 -0
  43. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.html.erb +15 -0
  44. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.text.erb +11 -0
  45. data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  46. data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/edit.html.haml +14 -13
  47. data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/new.html.haml +12 -16
  48. data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/edit.html.haml +28 -40
  49. data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +16 -24
  50. data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +13 -18
  51. data/lib/generators/happy_seed/devise/templates/app/views/devise/shared/_links.html.erb +25 -0
  52. data/lib/generators/happy_seed/devise/templates/app/views/devise/unlocks/new.html.erb +16 -0
  53. data/lib/generators/happy_seed/devise/templates/docs/README.03.devise.rdoc +2 -2
  54. data/lib/generators/happy_seed/devise/templates/spec/factories/users.rb +5 -4
  55. data/lib/generators/happy_seed/devise/templates/spec/features/registration_spec.rb +149 -0
  56. data/lib/generators/happy_seed/devise/templates/spec/mailers/previews/devise_preview.rb +28 -0
  57. data/lib/generators/happy_seed/devise_confirmable/devise_confirmable_generator.rb +45 -0
  58. data/lib/generators/happy_seed/devise_confirmable/templates/add_confirmable_to_devise.rb +24 -0
  59. data/lib/generators/happy_seed/devise_confirmable/templates/app/controllers/confirmations_controller.rb +10 -0
  60. data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/edit.html.haml +22 -0
  61. data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/new.html.haml +20 -0
  62. data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
  63. data/lib/generators/happy_seed/devise_confirmable/templates/docs/README.03.devise_confirmable.rdoc +23 -0
  64. data/lib/generators/happy_seed/devise_invitable/devise_invitable_generator.rb +3 -1
  65. data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/edit.html.haml +3 -2
  66. data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/new.html.haml +3 -2
  67. data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
  68. data/lib/generators/happy_seed/devise_invitable/templates/spec/features/invitations_spec.rb +61 -0
  69. data/lib/generators/happy_seed/facebook/facebook_generator.rb +2 -0
  70. data/lib/generators/happy_seed/facebook/templates/spec/features/facebook_registration_spec.rb +72 -0
  71. data/lib/generators/happy_seed/googleoauth/googleoauth_generator.rb +1 -1
  72. data/lib/generators/happy_seed/happy_seed_generator.rb +1 -3
  73. data/lib/generators/happy_seed/html_email/html_email_generator.rb +32 -0
  74. data/lib/generators/happy_seed/html_email/templates/app/views/layouts/mailer.html.erb +244 -0
  75. data/lib/generators/happy_seed/html_email/templates/docs/README.01.html_email.rdoc +25 -0
  76. data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +4 -2
  77. data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +3 -13
  78. data/lib/generators/happy_seed/omniauth/templates/app/models/identity.rb +13 -9
  79. data/lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc +5 -5
  80. data/lib/generators/happy_seed/omniauth/templates/spec/factories/oauth.rb +6 -1
  81. data/lib/generators/happy_seed/omniauth/templates/spec/features/oauth_registration_spec.rb +80 -0
  82. data/lib/generators/happy_seed/omniauth/templates/spec/models/identity_spec.rb +39 -12
  83. data/lib/generators/happy_seed/omniauth/templates/{app/models/form_user.rb → user.rb} +4 -5
  84. data/lib/generators/happy_seed/plugin/plugin_generator.rb +13 -11
  85. data/lib/generators/happy_seed/react/react_generator.rb +36 -0
  86. data/lib/generators/happy_seed/react/templates/docs/README.10.react.rdoc +20 -0
  87. data/lib/generators/happy_seed/roles/roles_generator.rb +38 -0
  88. data/lib/generators/happy_seed/roles/templates/ability.rb +9 -0
  89. data/lib/generators/happy_seed/roles/templates/docs/README.03.roles.rdoc +23 -0
  90. data/lib/generators/happy_seed/simple_cms/simple_cms_generator.rb +41 -0
  91. data/lib/generators/happy_seed/simple_cms/templates/app/admin/simple_content.rb +42 -0
  92. data/lib/generators/happy_seed/simple_cms/templates/app/controllers/simple_content_controller.rb +7 -0
  93. data/lib/generators/happy_seed/simple_cms/templates/app/models/simple_content.rb +5 -0
  94. data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/faq.html.haml +13 -0
  95. data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/index.html.haml +79 -0
  96. data/lib/generators/happy_seed/simple_cms/templates/application_helper.rb +18 -0
  97. data/lib/generators/happy_seed/simple_cms/templates/create_simple_contents.rb +14 -0
  98. data/lib/generators/happy_seed/simple_cms/templates/docs/README.04.simple_cms.rdoc +32 -0
  99. data/lib/generators/happy_seed/simple_cms/templates/spec/factories/oauth.rb +10 -0
  100. data/lib/generators/happy_seed/simple_cms/templates/spec/features/oauth_registration_spec.rb +80 -0
  101. data/lib/generators/happy_seed/simple_cms/templates/spec/models/identity_spec.rb +49 -0
  102. data/lib/generators/happy_seed/splash/templates/app/assets/stylesheets/splash.css.scss +119 -84
  103. data/lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb +1 -1
  104. data/lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml +15 -18
  105. data/lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml +54 -92
  106. data/lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc +2 -2
  107. data/lib/generators/happy_seed/splash/templates/spec/controllers/splash_controller_spec.rb +11 -3
  108. data/lib/generators/happy_seed/static/templates/source/stylesheets/application.css.scss +1 -1
  109. data/lib/generators/happy_seed/static_blog/templates/Gemfile.lock +45 -49
  110. data/lib/generators/happy_seed/twitter/templates/spec/features/twitter_oauth_registration_spec.rb +57 -0
  111. data/lib/generators/happy_seed/twitter/twitter_generator.rb +2 -1
  112. data/lib/happy_seed/cli.rb +1 -1
  113. data/lib/happy_seed/engine.rb +12 -0
  114. data/lib/happy_seed/version.rb +1 -1
  115. data/lib/tasks/seed.rake +56 -0
  116. data/{test → spec}/dummy/Rakefile +0 -0
  117. data/spec/dummy/app/assets/config/manifest.js +5 -0
  118. data/{test → spec}/dummy/app/assets/javascripts/application.js +3 -3
  119. data/spec/dummy/app/assets/javascripts/cable.coffee +11 -0
  120. data/{test → spec}/dummy/app/assets/stylesheets/application.css +4 -4
  121. data/spec/dummy/app/channels/application_cable/channel.rb +5 -0
  122. data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
  123. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  124. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  125. data/spec/dummy/app/jobs/application_job.rb +2 -0
  126. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  127. data/spec/dummy/app/models/application_record.rb +3 -0
  128. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  129. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  130. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  131. data/{test → spec}/dummy/bin/bundle +0 -0
  132. data/{test → spec}/dummy/bin/rails +1 -1
  133. data/{test → spec}/dummy/bin/rake +0 -0
  134. data/spec/dummy/bin/setup +34 -0
  135. data/spec/dummy/bin/update +29 -0
  136. data/spec/dummy/config.ru +8 -0
  137. data/spec/dummy/config/application.rb +21 -0
  138. data/{test → spec}/dummy/config/boot.rb +0 -0
  139. data/spec/dummy/config/cable.yml +10 -0
  140. data/{test → spec}/dummy/config/database.yml +0 -0
  141. data/{test → spec}/dummy/config/environment.rb +0 -0
  142. data/{test → spec}/dummy/config/environments/development.rb +28 -3
  143. data/{test → spec}/dummy/config/environments/production.rb +29 -24
  144. data/{test → spec}/dummy/config/environments/test.rb +6 -3
  145. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
  146. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  147. data/{test → spec}/dummy/config/initializers/assets.rb +3 -0
  148. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  149. data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
  150. data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +3 -1
  151. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  152. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  153. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  154. data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
  155. data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
  156. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  157. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +2 -2
  158. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  159. data/spec/dummy/config/puma.rb +47 -0
  160. data/spec/dummy/config/routes.rb +3 -0
  161. data/{test → spec}/dummy/config/secrets.yml +3 -3
  162. data/spec/dummy/db/schema.rb +16 -0
  163. data/{test → spec}/dummy/public/404.html +0 -0
  164. data/{test → spec}/dummy/public/422.html +0 -0
  165. data/{test → spec}/dummy/public/500.html +0 -0
  166. data/{test/dummy/public/favicon.ico → spec/dummy/public/apple-touch-icon-precomposed.png} +0 -0
  167. data/spec/dummy/public/apple-touch-icon.png +0 -0
  168. data/spec/dummy/public/favicon.ico +0 -0
  169. data/spec/rails_helper.rb +58 -0
  170. data/spec/spec_helper.rb +91 -0
  171. metadata +195 -89
  172. data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/configurations_controller.rb +0 -11
  173. data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/configurations_spec.rb +0 -21
  174. data/lib/generators/happy_seed/base/templates/config/puma.rb +0 -15
  175. data/lib/generators/happy_seed/base/templates/spec/support/controller_helpers.rb +0 -12
  176. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/sections/_profile_page.scss +0 -9
  177. data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/_form.html.haml +0 -5
  178. data/lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb +0 -54
  179. data/lib/generators/happy_seed/devise/templates/test/mailers/previews/devise_preview.rb +0 -13
  180. data/lib/generators/happy_seed/omniauth/templates/spec/features/registration_spec.rb +0 -81
  181. data/lib/generators/happy_seed/static/templates/Gemfile.lock +0 -158
  182. data/lib/tasks/seed_tasks.rake +0 -4
  183. data/test/dummy/README.rdoc +0 -28
  184. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  185. data/test/dummy/config.ru +0 -4
  186. data/test/dummy/config/application.rb +0 -23
  187. data/test/dummy/config/initializers/jazz_hands.rb +0 -5
  188. data/test/dummy/config/routes.rb +0 -56
  189. data/test/seed_test.rb +0 -7
  190. data/test/test_helper.rb +0 -15
@@ -0,0 +1,57 @@
1
+ require 'rails_helper'
2
+
3
+ feature "TwitterOAuthRegistration", :type => :feature do
4
+ include Warden::Test::Helpers
5
+
6
+ before do
7
+ OmniAuth.config.test_mode = true
8
+ sign_out :user
9
+ end
10
+
11
+ after do
12
+ Warden.test_reset!
13
+ Rails.application.env_config["omniauth.auth"] = nil
14
+ end
15
+
16
+ it "should create a new user for a twitter user" do
17
+ OmniAuth.config.add_mock(:twitter, {
18
+ uid: '12345',
19
+ info: {
20
+ name: "Will Schenk",
21
+ nickname: "wschenk",
22
+ }
23
+ });
24
+
25
+ visit user_twitter_omniauth_callback_path
26
+
27
+ i = Identity.first
28
+ expect( i.uid ).to eq( '12345' )
29
+ expect( i.nickname ).to eq( 'wschenk' )
30
+ expect( i.name ).to eq( 'Will Schenk' )
31
+
32
+ expect( page.body ).to include( 'Successfully authenticated from Twitter account.' )
33
+ end
34
+
35
+ it "should merge the identity if the user already exists" do
36
+ u = create( :user )
37
+ login_as u, scope: :user
38
+
39
+ expect( User.count ).to eq(1)
40
+ expect( Identity.count ).to eq(0)
41
+
42
+ OmniAuth.config.add_mock(:twitter, {
43
+ uid: '12345',
44
+ info: {
45
+ name: "Will Schenk",
46
+ nickname: "wschenk",
47
+ }
48
+ });
49
+
50
+ visit user_twitter_omniauth_callback_path
51
+
52
+ expect( User.count ).to eq(1)
53
+ expect( Identity.count ).to eq(1)
54
+
55
+ expect( Identity.first.user_id ).to eq( u.id )
56
+ end
57
+ end
@@ -26,7 +26,8 @@ module HappySeed
26
26
  add_omniauth :twitter
27
27
 
28
28
  directory "docs"
29
- insert_into_file "app/models/identity.rb", "\n identity.secrettoken = auth.credentials.secret", after: "identity.accesstoken = auth.credentials.token"
29
+ directory "spec"
30
+ insert_into_file "app/models/identity.rb", " identity.secrettoken = auth.credentials.secret\n", after: "identity.accesstoken = auth.credentials.token\n"
30
31
  migration_template("add_secret_token_to_identity.rb", "db/migrate/add_secret_token_to_identity.rb" )
31
32
 
32
33
  gsub_file( "app/models/user.rb", "Twitter.client( access_token: twitter.accesstoken )",
@@ -11,7 +11,7 @@ module HappySeed
11
11
  desc "rails APPNAME", "Generate a new rails application"
12
12
  def rails( *args )
13
13
  seedrb = gem_file_path( "happy_seed.rb")
14
- system "rails new -m #{seedrb} #{args.join( " " )} --skip-turbolinks"
14
+ system "rails new -m #{seedrb} #{args.join( " " )} --skip-turbolinks --skip-test-unit"
15
15
  end
16
16
 
17
17
  desc "plugin NAME", "Generate a new rails plugin"
@@ -0,0 +1,12 @@
1
+ module HappySeed
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace HappySeed
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec, fixture: false
7
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
8
+ g.assets false
9
+ g.helper false
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module HappySeed
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.21"
3
3
  end
@@ -0,0 +1,56 @@
1
+ namespace :happy_seed do
2
+ desc 'Copy readme files into the doc directory'
3
+ task :sync_docs do
4
+ system('mkdir -p website/source/docs')
5
+ `find lib -name README\\* -print`.each_line do |file|
6
+ file.gsub!(/\n/, '')
7
+ out = file.gsub(/.*\//, '').gsub(/.rdoc/, '.html.markdown')
8
+ # puts file, out
9
+ system("cp #{file} website/source/docs/#{out}")
10
+ end
11
+ end
12
+
13
+ desc 'Generate dependancy graph'
14
+ task :generator_dependancies do
15
+ require 'active_support/inflector'
16
+
17
+ Dir.glob('lib/generators/**/*_generator.rb').each do |f|
18
+ data = File.read f
19
+ # name = data.lines.select { |x| x =~ /class/ }.first.gsub( /.*class (.*?)Generator.*/m, '\1' ).underscore
20
+ name = data.grep(/class/).first.gsub(/.*class (.*?)Generator.*/m, '\1').underscore
21
+
22
+ if name != 'happy_seed'
23
+ print = false
24
+
25
+ if data.grep(/require_omniauth/).size > 0
26
+ puts "[#{name}] -> [omniauth]"
27
+ print = true
28
+ end
29
+
30
+ data.grep(/generate .happy_seed/).each do |line|
31
+ dep = line.gsub(/.*happy_seed:([^"' ]*).*/m, '\1')
32
+ puts "[#{name}] -> [#{dep}]"
33
+ print = true
34
+ end
35
+
36
+ if name == 'base'
37
+ puts "[base]"
38
+ print = true
39
+ end
40
+
41
+ if ['plugin', 'static', 'static_blog'].index(name)
42
+ # puts "Skipping #{name}"
43
+ print = true
44
+ end
45
+
46
+ puts "[#{name}] -> [base]" unless print
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ class String
53
+ def grep(regex)
54
+ lines.select { |x| x =~ regex }
55
+ end
56
+ end
File without changes
@@ -0,0 +1,5 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
5
+ //= link happy_seed_manifest.js
@@ -2,12 +2,12 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
13
  //= require_tree .
@@ -0,0 +1,11 @@
1
+ # Action Cable provides the framework to deal with WebSockets in Rails.
2
+ # You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ #
4
+ # Turn on the cable connection by removing the comments after the require statements (and ensure it's also on in config/routes.rb).
5
+ #
6
+ #= require action_cable
7
+ #= require_self
8
+ #= require_tree ./channels
9
+ #
10
+ # @App ||= {}
11
+ # App.cable = ActionCable.createConsumer()
@@ -3,12 +3,12 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
12
  *
13
13
  *= require_tree .
14
14
  *= require_self
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2
+ module ApplicationCable
3
+ class Channel < ActionCable::Channel::Base
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2
+ module ApplicationCable
3
+ class Connection < ActionCable::Connection::Base
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= action_cable_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload' %>
9
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
File without changes
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
File without changes
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a starting point to setup your application.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') or system!('bundle install')
20
+
21
+ # puts "\n== Copying sample files =="
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
24
+ # end
25
+
26
+ puts "\n== Preparing database =="
27
+ system! 'bin/rails db:setup'
28
+
29
+ puts "\n== Removing old logs and tempfiles =="
30
+ system! 'bin/rails log:clear tmp:clear'
31
+
32
+ puts "\n== Restarting application server =="
33
+ system! 'bin/rails restart'
34
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a way to update your development environment automatically.
15
+ # Add necessary update steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system 'bundle check' or system! 'bundle install'
20
+
21
+ puts "\n== Updating database =="
22
+ system! 'bin/rails db:migrate'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system! 'bin/rails log:clear tmp:clear'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system! 'bin/rails restart'
29
+ end
@@ -0,0 +1,8 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+
5
+ # Action Cable requires that all classes are loaded in advance
6
+ Rails.application.eager_load!
7
+
8
+ run Rails.application
@@ -0,0 +1,21 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "happy_seed"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+ end
20
+ end
21
+
File without changes
@@ -0,0 +1,10 @@
1
+ # Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket.
2
+ production:
3
+ adapter: redis
4
+ url: redis://localhost:6379/1
5
+
6
+ development:
7
+ adapter: async
8
+
9
+ test:
10
+ adapter: async
File without changes
@@ -9,9 +9,26 @@ Rails.application.configure do
9
9
  # Do not eager load code on boot.
10
10
  config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ if Rails.root.join('tmp/caching-dev.txt').exist?
17
+ config.action_controller.perform_caching = true
18
+
19
+ config.action_mailer.perform_caching = false
20
+
21
+ config.cache_store = :memory_store
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => 'public, max-age=172800'
24
+ }
25
+ else
26
+ config.action_controller.perform_caching = false
27
+
28
+ config.action_mailer.perform_caching = false
29
+
30
+ config.cache_store = :null_store
31
+ end
15
32
 
16
33
  # Don't care if the mailer can't send.
17
34
  config.action_mailer.raise_delivery_errors = false
@@ -27,6 +44,10 @@ Rails.application.configure do
27
44
  # number of complex assets.
28
45
  config.assets.debug = true
29
46
 
47
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
48
+ # yet still be able to expire them through the digest params.
49
+ config.assets.digest = true
50
+
30
51
  # Adds additional error checking when serving assets at runtime.
31
52
  # Checks for improperly declared sprockets dependencies.
32
53
  # Raises helpful error messages.
@@ -34,4 +55,8 @@ Rails.application.configure do
34
55
 
35
56
  # Raises error for missing translations
36
57
  # config.action_view.raise_on_missing_translations = true
58
+
59
+ # Use an evented file watcher to asynchronously detect changes in source code,
60
+ # routes, locales, etc. This feature depends on the listen gem.
61
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
37
62
  end