spina-admin-conferences-blog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +42 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/config/spina_admin_conferences_blog_manifest.js +0 -0
  6. data/app/controllers/spina/admin/conferences/blog/categories_controller.rb +80 -0
  7. data/app/controllers/spina/admin/conferences/blog/posts_controller.rb +103 -0
  8. data/app/decorators/spina/admin/conferences/blog/post_decorator.rb +26 -0
  9. data/app/helpers/spina/admin/conferences/blog/posts_helper.rb +18 -0
  10. data/app/models/spina/admin/conferences/blog/application_record.rb +12 -0
  11. data/app/models/spina/admin/conferences/blog/category.rb +23 -0
  12. data/app/models/spina/admin/conferences/blog/post.rb +52 -0
  13. data/app/models/spina/admin/conferences/blog.rb +10 -0
  14. data/app/views/layouts/spina/admin/conferences/blog/blog.html.haml +29 -0
  15. data/app/views/layouts/spina/admin/conferences/blog/categories.html.haml +10 -0
  16. data/app/views/spina/admin/conferences/blog/categories/_category.html.haml +8 -0
  17. data/app/views/spina/admin/conferences/blog/categories/_form.html.haml +42 -0
  18. data/app/views/spina/admin/conferences/blog/categories/edit.html.haml +3 -0
  19. data/app/views/spina/admin/conferences/blog/categories/index.html.haml +23 -0
  20. data/app/views/spina/admin/conferences/blog/categories/new.html.haml +2 -0
  21. data/app/views/spina/admin/conferences/blog/posts/_form.html.haml +43 -0
  22. data/app/views/spina/admin/conferences/blog/posts/_form_post_configuration.html.haml +50 -0
  23. data/app/views/spina/admin/conferences/blog/posts/_form_post_content.html.haml +46 -0
  24. data/app/views/spina/admin/conferences/blog/posts/_form_post_seo.html.haml +14 -0
  25. data/app/views/spina/admin/conferences/blog/posts/_post.html.haml +19 -0
  26. data/app/views/spina/admin/conferences/blog/posts/edit.html.haml +3 -0
  27. data/app/views/spina/admin/conferences/blog/posts/index.html.haml +23 -0
  28. data/app/views/spina/admin/conferences/blog/posts/new.html.haml +2 -0
  29. data/app/views/spina/admin/hooks/conferences/blog/_primary_navigation.html.haml +10 -0
  30. data/config/initializers/friendly_id.rb +94 -0
  31. data/config/locales/en.yml +41 -0
  32. data/config/locales/nl.yml +42 -0
  33. data/config/locales/pt-BR.yml +41 -0
  34. data/config/routes.rb +32 -0
  35. data/db/migrate/1_create_spina_blog_posts.rb +18 -0
  36. data/db/migrate/2_create_spina_blog_friendly_id_slugs.rb +19 -0
  37. data/db/migrate/3_create_spina_blog_categories.rb +12 -0
  38. data/db/migrate/4_add_category_id_to_spina_blog_posts.rb +7 -0
  39. data/db/migrate/5_add_featured_to_spina_blog_posts.rb +9 -0
  40. data/db/migrate/6_add_seo_fields.rb +11 -0
  41. data/lib/generators/spina_admin_conferences_blog/install_generator.rb +24 -0
  42. data/lib/spina/admin/conferences/blog/configuration.rb +17 -0
  43. data/lib/spina/admin/conferences/blog/engine.rb +24 -0
  44. data/lib/spina/admin/conferences/blog/version.rb +8 -0
  45. data/lib/spina/admin/conferences/blog.rb +18 -0
  46. data/lib/spina/admin/conferences.rb +6 -0
  47. data/lib/spina/admin.rb +5 -0
  48. data/lib/tasks/spina/admin/conferences/blog_tasks.rake +14 -0
  49. data/spec/controllers/spina/admin/conferences/blog/categories_controller_spec.rb +99 -0
  50. data/spec/controllers/spina/admin/conferences/blog/posts_controller_spec.rb +152 -0
  51. data/spec/dummy/Rakefile +8 -0
  52. data/spec/dummy/app/assets/config/manifest.js +4 -0
  53. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  54. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  55. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  56. data/spec/dummy/app/assets/stylesheets/default/application.css.sass +0 -0
  57. data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
  58. data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
  59. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  60. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  61. data/spec/dummy/app/jobs/application_job.rb +4 -0
  62. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  63. data/spec/dummy/app/models/application_record.rb +6 -0
  64. data/spec/dummy/app/views/default/pages/homepage.html.haml +2 -0
  65. data/spec/dummy/app/views/default/pages/show.html.haml +3 -0
  66. data/spec/dummy/app/views/default/shared/_navigation.html.haml +2 -0
  67. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  68. data/spec/dummy/app/views/layouts/default/application.html.haml +11 -0
  69. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  70. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  71. data/spec/dummy/bin/bundle +5 -0
  72. data/spec/dummy/bin/rails +6 -0
  73. data/spec/dummy/bin/rake +6 -0
  74. data/spec/dummy/bin/setup +36 -0
  75. data/spec/dummy/bin/update +31 -0
  76. data/spec/dummy/config/application.rb +16 -0
  77. data/spec/dummy/config/boot.rb +7 -0
  78. data/spec/dummy/config/cable.yml +9 -0
  79. data/spec/dummy/config/database.yml +17 -0
  80. data/spec/dummy/config/environment.rb +7 -0
  81. data/spec/dummy/config/environments/development.rb +56 -0
  82. data/spec/dummy/config/environments/production.rb +88 -0
  83. data/spec/dummy/config/environments/test.rb +44 -0
  84. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  85. data/spec/dummy/config/initializers/assets.rb +13 -0
  86. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  87. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  88. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  89. data/spec/dummy/config/initializers/inflections.rb +18 -0
  90. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  91. data/spec/dummy/config/initializers/mobility.rb +16 -0
  92. data/spec/dummy/config/initializers/new_framework_defaults.rb +25 -0
  93. data/spec/dummy/config/initializers/session_store.rb +5 -0
  94. data/spec/dummy/config/initializers/spina.rb +22 -0
  95. data/spec/dummy/config/initializers/themes/default.rb +32 -0
  96. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  97. data/spec/dummy/config/locales/en.yml +23 -0
  98. data/spec/dummy/config/puma.rb +49 -0
  99. data/spec/dummy/config/routes.rb +6 -0
  100. data/spec/dummy/config/secrets.yml +22 -0
  101. data/spec/dummy/config/spring.rb +8 -0
  102. data/spec/dummy/config.ru +7 -0
  103. data/spec/dummy/db/migrate/20190513103729_create_spina_tables.spina.rb +132 -0
  104. data/spec/dummy/db/migrate/20190513103730_create_spina_translation_tables.spina.rb +46 -0
  105. data/spec/dummy/db/migrate/20190513103731_create_spina_navigations.spina.rb +24 -0
  106. data/spec/dummy/db/migrate/20190513103732_add_password_reset_token_to_spina_users.spina.rb +9 -0
  107. data/spec/dummy/db/migrate/20190513103733_remove_translated_columns.spina.rb +14 -0
  108. data/spec/dummy/db/migrate/20190513103734_create_spina_options.spina.rb +11 -0
  109. data/spec/dummy/db/migrate/20190513103735_create_spina_settings.spina.rb +14 -0
  110. data/spec/dummy/db/migrate/20190513103736_create_spina_media_folders.spina.rb +11 -0
  111. data/spec/dummy/db/migrate/20190513103737_create_spina_images.spina.rb +13 -0
  112. data/spec/dummy/db/migrate/20190513103738_create_spina_image_collections.spina.rb +17 -0
  113. data/spec/dummy/db/migrate/20190513103739_create_spina_resources.spina.rb +18 -0
  114. data/spec/dummy/db/schema.rb +288 -0
  115. data/spec/dummy/db/seeds.rb +4 -0
  116. data/spec/dummy/public/404.html +67 -0
  117. data/spec/dummy/public/422.html +67 -0
  118. data/spec/dummy/public/500.html +66 -0
  119. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  120. data/spec/dummy/public/apple-touch-icon.png +0 -0
  121. data/spec/dummy/public/favicon.ico +0 -0
  122. data/spec/factories/spina/admin/conferences/blog/categories.rb +11 -0
  123. data/spec/factories/spina/admin/conferences/blog/posts.rb +16 -0
  124. data/spec/models/spina/admin/conferences/blog/category_spec.rb +21 -0
  125. data/spec/models/spina/admin/conferences/blog/post_spec.rb +39 -0
  126. data/spec/rails_helper.rb +68 -0
  127. data/spec/spec_helper.rb +97 -0
  128. data/spec/support/capybara.rb +25 -0
  129. data/spec/support/controller_helpers.rb +25 -0
  130. data/spec/support/controller_routes.rb +13 -0
  131. data/spec/support/factory_bot.rb +5 -0
  132. data/spec/support/rails_controller_testing.rb +13 -0
  133. data/spec/support/system_tests.rb +11 -0
  134. data/spec/system/spina/admin/conferences/blog/posts_spec.rb +34 -0
  135. data/spec/system/support/image.png +0 -0
  136. metadata +508 -0
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ RSpec.describe Spina::Admin::Conferences::Blog::CategoriesController, type: :controller do
6
+ let(:categories) { create_list(:spina_blog_category, 3) }
7
+ let(:category) { create(:spina_blog_category) }
8
+ let(:category_attributes) { attributes_for(:spina_blog_category) }
9
+
10
+ routes { Spina::Engine.routes }
11
+
12
+ context 'when signed in as an admin' do
13
+ before { sign_in }
14
+
15
+ describe 'GET #index' do
16
+ subject { get :index }
17
+
18
+ it { is_expected.to be_successful }
19
+ it { is_expected.to render_template :index }
20
+ it {
21
+ subject
22
+ expect(assigns(:categories)).to match_array categories
23
+ }
24
+ end
25
+
26
+ describe 'GET #new' do
27
+ subject { get :new }
28
+
29
+ it { is_expected.to be_successful }
30
+ it { is_expected.to render_template :new }
31
+ end
32
+
33
+ describe 'POST #create' do
34
+ subject { post :create, params: { category: category_attributes } }
35
+
36
+ it { is_expected.to have_http_status :redirect }
37
+ it {
38
+ subject
39
+ expect(flash[:notice]).to eq 'Category saved'
40
+ }
41
+ it { expect { subject }.to change(Spina::Admin::Conferences::Blog::Category, :count).by(1) }
42
+
43
+ context 'with invalid attributes' do
44
+ subject { post :create, params: { category: { name: '' } } }
45
+
46
+ it { is_expected.to_not have_http_status :redirect }
47
+ it { expect { subject }.to_not change(Spina::Admin::Conferences::Blog::Category, :count) }
48
+ it { is_expected.to render_template :new }
49
+ end
50
+ end
51
+
52
+ describe 'GET #edit' do
53
+ subject { get :edit, params: { id: category.id } }
54
+
55
+ it { is_expected.to be_successful }
56
+ it { is_expected.to render_template :edit }
57
+ end
58
+
59
+ describe 'PATCH #update' do
60
+ subject do
61
+ patch :update,
62
+ params: { id: category.id, category: category_attributes }
63
+ end
64
+
65
+ it { is_expected.to have_http_status :redirect }
66
+ it {
67
+ subject
68
+ expect(flash[:notice]).to eq 'Category saved'
69
+ }
70
+ it { expect { subject }.to(change { category.reload.name }) }
71
+
72
+ context 'with invalid attributes' do
73
+ subject do
74
+ patch :update, params: { id: category.id, category: { name: '' } }
75
+ end
76
+
77
+ it { is_expected.to_not have_http_status :redirect }
78
+ it { is_expected.to render_template :edit }
79
+ it { expect { subject }.not_to(change { category.reload.name }) }
80
+ end
81
+ end
82
+
83
+ describe 'DELETE #destroy' do
84
+ let!(:category) { create(:spina_blog_category) }
85
+
86
+ subject { delete :destroy, params: { id: category.id } }
87
+
88
+ it { expect { subject }.to change(Spina::Admin::Conferences::Blog::Category, :count).by(-1) }
89
+ end
90
+ end
91
+
92
+ context 'signed out' do
93
+ describe 'GET #index' do
94
+ subject { get :index }
95
+ it { is_expected.to have_http_status :redirect }
96
+ it { is_expected.to_not render_template :index }
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,152 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ RSpec.describe Spina::Admin::Conferences::Blog::PostsController, type: :controller do
6
+ let(:posts) { create_list(:spina_blog_post, 3) }
7
+ let(:blog_post) { create(:spina_blog_post) }
8
+ let(:draft_posts) { create_list(:spina_blog_post, 3, draft: true) }
9
+ let(:live_posts) { create_list(:spina_blog_post, 3, draft: false) }
10
+ let(:post_attributes) { attributes_for(:spina_blog_post) }
11
+
12
+ routes { Spina::Engine.routes }
13
+
14
+ context 'signed in as an admin' do
15
+ before { sign_in }
16
+
17
+ describe 'GET #index' do
18
+ subject { get :index }
19
+
20
+ it { is_expected.to be_successful }
21
+ it { is_expected.to render_template :index }
22
+ it {
23
+ subject
24
+ expect(assigns(:posts)).to match_array posts
25
+ }
26
+ end
27
+
28
+ describe 'GET #live' do
29
+ subject { get :live }
30
+
31
+ it { is_expected.to be_successful }
32
+ it { is_expected.to render_template :index }
33
+ it {
34
+ subject
35
+ expect(assigns(:posts)).to match_array live_posts
36
+ }
37
+ it {
38
+ subject
39
+ expect(assigns(:posts)).to_not match_array draft_posts
40
+ }
41
+ end
42
+
43
+ describe 'GET #draft' do
44
+ subject { get :draft }
45
+
46
+ it { is_expected.to be_successful }
47
+ it { is_expected.to render_template :index }
48
+ it {
49
+ subject
50
+ expect(assigns(:posts)).to match_array draft_posts
51
+ }
52
+ it {
53
+ subject
54
+ expect(assigns(:posts)).to_not match_array live_posts
55
+ }
56
+ end
57
+
58
+ describe 'GET #future' do
59
+ let(:past_posts) do
60
+ create_list(:spina_blog_post, 3, published_at: Time.zone.today - 10)
61
+ end
62
+ let(:future_posts) do
63
+ create_list(:spina_blog_post, 3, published_at: Time.zone.today + 10)
64
+ end
65
+
66
+ subject { get :future }
67
+
68
+ it { is_expected.to be_successful }
69
+ it { is_expected.to render_template :index }
70
+ it {
71
+ subject
72
+ expect(assigns(:posts)).to match_array future_posts
73
+ }
74
+ it {
75
+ subject
76
+ expect(assigns(:posts)).to_not match_array past_posts
77
+ }
78
+ end
79
+
80
+ describe 'GET #new' do
81
+ subject { get :new }
82
+
83
+ it { is_expected.to be_successful }
84
+ it { is_expected.to render_template :new }
85
+ end
86
+
87
+ describe 'POST #create' do
88
+ subject { post :create, params: { post: post_attributes } }
89
+
90
+ it { is_expected.to have_http_status :redirect }
91
+ it {
92
+ subject
93
+ expect(flash[:notice]).to eq 'Post saved'
94
+ }
95
+ it { expect { subject }.to change(Spina::Admin::Conferences::Blog::Post, :count).by(1) }
96
+
97
+ context 'with invalid attributes' do
98
+ subject { post :create, params: { post: { content: 'foo' } } }
99
+
100
+ it { is_expected.to_not have_http_status :redirect }
101
+ it { expect { subject }.to_not change(Spina::Admin::Conferences::Blog::Post, :count) }
102
+ it { is_expected.to render_template :new }
103
+ end
104
+ end
105
+
106
+ describe 'GET #edit' do
107
+ subject { get :edit, params: { id: blog_post.id } }
108
+
109
+ it { is_expected.to be_successful }
110
+ it { is_expected.to render_template :edit }
111
+ end
112
+
113
+ describe 'PATCH #update' do
114
+ subject do
115
+ patch :update, params: { id: blog_post.id, post: post_attributes }
116
+ end
117
+
118
+ it { is_expected.to have_http_status :redirect }
119
+ it do
120
+ subject
121
+ expect(flash[:notice]).to eq 'Post saved'
122
+ end
123
+ it { expect { subject }.to(change { blog_post.reload.title }) }
124
+
125
+ context 'with invalid attributes' do
126
+ subject do
127
+ patch :update, params: { id: blog_post.id, post: { title: '' } }
128
+ end
129
+
130
+ it { is_expected.to_not have_http_status :redirect }
131
+ it { is_expected.to render_template :edit }
132
+ it { expect { subject }.not_to(change { blog_post.reload.title }) }
133
+ end
134
+ end
135
+
136
+ describe 'DELETE #destroy' do
137
+ let!(:blog_post) { FactoryBot.create :spina_blog_post }
138
+
139
+ subject { delete :destroy, params: { id: blog_post.id } }
140
+
141
+ it { expect { subject }.to change(Spina::Admin::Conferences::Blog::Post, :count).by(-1) }
142
+ end
143
+ end
144
+
145
+ context 'signed out' do
146
+ describe 'GET #index' do
147
+ subject { get :index }
148
+ it { is_expected.to have_http_status :redirect }
149
+ it { is_expected.to_not render_template :index }
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative 'config/application'
7
+
8
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
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. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
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
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
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 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
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: 'from@example.com'
5
+ layout 'mailer'
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ extend Mobility
5
+ self.abstract_class = true
6
+ end
@@ -0,0 +1,2 @@
1
+ %h1= @page.title
2
+ = @page.content(:text).try(:html_safe)
@@ -0,0 +1,3 @@
1
+ %h1= @page.title
2
+ = @page.content(:text).try(:html_safe)
3
+
@@ -0,0 +1,2 @@
1
+ - presenter = Spina::MenuPresenter.new(Spina::Page.all)
2
+ = presenter.to_html
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+
7
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,11 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title= current_account.name
5
+ = stylesheet_link_tag 'default/application', media: 'all', 'data-turbolinks-track' => true
6
+ = javascript_include_tag 'application', 'data-turbolinks-track' => true
7
+ = csrf_meta_tags
8
+ %body
9
+ .container
10
+ = render 'default/shared/navigation'
11
+ = yield
@@ -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 %>
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_PATH = File.expand_path('../config/application', __dir__)
5
+ require_relative '../config/boot'
6
+ require 'rails/commands'
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../config/boot'
5
+ require 'rake'
6
+ Rake.application.run
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pathname'
5
+ require 'fileutils'
6
+ include FileUtils
7
+
8
+ # path to your application root.
9
+ APP_ROOT = Pathname.new File.expand_path('..', __dir__)
10
+
11
+ def system!(*args)
12
+ system(*args) || abort("\n== Command #{args} failed ==")
13
+ end
14
+
15
+ chdir APP_ROOT do
16
+ # This script is a starting point to setup your application.
17
+ # Add necessary setup steps to this file.
18
+
19
+ puts '== Installing dependencies =='
20
+ system! 'gem install bundler --conservative'
21
+ system('bundle check') || system!('bundle install')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:setup'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pathname'
5
+ require 'fileutils'
6
+ include FileUtils
7
+
8
+ # path to your application root.
9
+ APP_ROOT = Pathname.new File.expand_path('..', __dir__)
10
+
11
+ def system!(*args)
12
+ system(*args) || abort("\n== Command #{args} failed ==")
13
+ end
14
+
15
+ chdir APP_ROOT do
16
+ # This script is a way to update your development environment automatically.
17
+ # Add necessary update steps to this file.
18
+
19
+ puts '== Installing dependencies =='
20
+ system! 'gem install bundler --conservative'
21
+ system('bundle check') || system!('bundle install')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails/all'
6
+
7
+ Bundler.require(*Rails.groups)
8
+ require 'spina/admin/conferences/blog'
9
+
10
+ module Dummy
11
+ class Application < Rails::Application
12
+ # Settings in config/environments/* take precedence over those specified here.
13
+ # Application configuration should go into files in config/initializers
14
+ # -- all .rb files in that directory are automatically loaded.
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
5
+
6
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
7
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -0,0 +1,9 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: redis://localhost:6379/1
@@ -0,0 +1,17 @@
1
+ #
2
+ default: &default
3
+ adapter: postgresql
4
+ encoding: unicode
5
+ pool: 5
6
+ host: localhost
7
+
8
+ development:
9
+ <<: *default
10
+ database: spina_blog_development
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ <<: *default
17
+ database: spina_blog_test
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded on
7
+ # every request. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ if Rails.root.join('tmp/caching-dev.txt').exist?
19
+ config.action_controller.perform_caching = true
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.cache_store = :null_store
29
+ end
30
+
31
+ # Don't care if the mailer can't send.
32
+ config.action_mailer.raise_delivery_errors = false
33
+
34
+ config.action_mailer.perform_caching = false
35
+
36
+ # Print deprecation notices to the Rails logger.
37
+ config.active_support.deprecation = :log
38
+
39
+ # Raise an error on page load if there are pending migrations.
40
+ config.active_record.migration_error = :page_load
41
+
42
+ # Debug mode disables concatenation and preprocessing of assets.
43
+ # This option may cause significant delays in view rendering with a large
44
+ # number of complex assets.
45
+ config.assets.debug = true
46
+
47
+ # Suppress logger output for asset requests.
48
+ config.assets.quiet = true
49
+
50
+ # Raises error for missing translations
51
+ # config.action_view.raise_on_missing_translations = true
52
+
53
+ # Use an evented file watcher to asynchronously detect changes in source code,
54
+ # routes, locales, etc. This feature depends on the listen gem.
55
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
56
+ end