orats 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/orats/cli.rb +5 -5
- data/lib/orats/shell.rb +26 -26
- data/lib/orats/templates/auth.rb +27 -27
- data/lib/orats/templates/base.rb +196 -106
- data/lib/orats/templates/includes/Gemfile +0 -2
- data/lib/orats/templates/includes/inventory/group_vars/all.yml +37 -34
- data/lib/orats/templates/play.rb +3 -3
- data/lib/orats/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86701c9d3879d19d5be1fdae7ba6322db003c08f
|
4
|
+
data.tar.gz: 2eca54c7c2359e3c71da893813cd61360f484951
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ee825ee47eaa23e1f240280f0d023b06c1256cb858d2c577acd822d5a744858cb5c26c2e2ec0542934aeafc5da6c8ce6096e6e1b4b373f0aa3f9f56255f94c
|
7
|
+
data.tar.gz: 93721d778eb7063a2b393735fbfd101d55841116972d6f72583acf0aa6b0c33dc7b229a92458abf69a0bb93053f72f8a53c396dd61aafd56a4c4326a508bf57a
|
data/README.md
CHANGED
@@ -86,8 +86,8 @@ running `orats <command name> help` from your terminal. You can also type `orats
|
|
86
86
|
|
87
87
|
- Detect whether or not orats, the playbook or inventory is outdated
|
88
88
|
- `orats outdated [options]`
|
89
|
-
- Optionally takes: `--playbook
|
90
|
-
- Optionally takes: `--inventory
|
89
|
+
- Optionally takes: `--playbook []`
|
90
|
+
- Optionally takes: `--inventory []`
|
91
91
|
|
92
92
|
#### Why is it asking me for my development postgres password?
|
93
93
|
|
@@ -102,7 +102,7 @@ Remember, this is only your development postgres password. It will **never** ask
|
|
102
102
|
The version comparisons can be fully trusted but when comparing a specific playbook or inventory file it's not really
|
103
103
|
possible to guarantee a valid comparison.
|
104
104
|
|
105
|
-
When passing in `--playbook
|
105
|
+
When passing in `--playbook` or `--inventory` it will look for certain keywords in the file. If it finds the
|
106
106
|
keyword then it will assume that keyword is working and up to date. Since you can edit these files freely there may be
|
107
107
|
cases where it reports a false positive.
|
108
108
|
|
@@ -130,7 +130,6 @@ it includes these features and when I do not want a specific thing it is much qu
|
|
130
130
|
- Use foreman in development mode to manage starting both the rails server using puma and sidekiq.
|
131
131
|
- Set the production asset precompiler to include fonts and png files.
|
132
132
|
- Set the production logger to rotate the logs daily.
|
133
|
-
- Use DHH's config gem to store application wide configuration variables.
|
134
133
|
- Set the timezone to EST.
|
135
134
|
- Change how validation errors are reported by having them be displayed inline for each element.
|
136
135
|
- Dry out the `database.yml` and use postgres.
|
@@ -140,7 +139,8 @@ it includes these features and when I do not want a specific thing it is much qu
|
|
140
139
|
- Add 2 view helpers, `humanize_boolean` and `css_for_boolean` to nicely output true/false values and they can be changed easily.
|
141
140
|
- Add 3 view helpers to easily set a page's title, meta description and page heading. All of which are optional.
|
142
141
|
- Bootstrap ~3 layout file with conditionally loaded `html5shiv`, `json3` and `respondjs` libs for IE < 9 support.
|
143
|
-
- Separate the navigation, navigation links, flash messages
|
142
|
+
- Separate the navigation, navigation links, flash messages and footer partials.
|
143
|
+
- Add partials and environment variables for both google analytics and disqus.
|
144
144
|
- Public 404, 422, 500 and 502 pages so they can be served directly from your web server.
|
145
145
|
- Use sass and coffeescript.
|
146
146
|
- jquery 1.10.x loaded through a CDN.
|
data/lib/orats/cli.rb
CHANGED
@@ -72,11 +72,11 @@ module Orats
|
|
72
72
|
Command.new(app_name, options).nuke
|
73
73
|
end
|
74
74
|
|
75
|
-
option :
|
76
|
-
option :
|
75
|
+
option :playbook, default: ''
|
76
|
+
option :inventory, default: ''
|
77
77
|
desc 'outdated [options]', ''
|
78
78
|
long_desc <<-D
|
79
|
-
`orats outdated` will run various comparisons on your ansible files.
|
79
|
+
`orats outdated` will run various comparisons on orats and your ansible files.
|
80
80
|
|
81
81
|
Help:
|
82
82
|
|
@@ -86,9 +86,9 @@ module Orats
|
|
86
86
|
|
87
87
|
Options:
|
88
88
|
|
89
|
-
`--playbook
|
89
|
+
`--playbook` to supply a playbook file for comparison []
|
90
90
|
|
91
|
-
`--inventory
|
91
|
+
`--inventory` to supply an inventory file for comparison []
|
92
92
|
D
|
93
93
|
def outdated
|
94
94
|
Command.new(nil, options).outdated
|
data/lib/orats/shell.rb
CHANGED
@@ -29,7 +29,7 @@ module Orats
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def git_commit(message)
|
32
|
-
run_from @active_path, "git add
|
32
|
+
run_from @active_path, "git add -A && git commit -m '#{message}'"
|
33
33
|
end
|
34
34
|
|
35
35
|
def gsub_postgres_info
|
@@ -43,7 +43,7 @@ module Orats
|
|
43
43
|
def gsub_redis_info
|
44
44
|
log_message 'root', 'Adding the redis password'
|
45
45
|
|
46
|
-
gsub_file "#{@active_path}/config/initializers/sidekiq.rb", '//', "//:#{ENV['
|
46
|
+
gsub_file "#{@active_path}/config/initializers/sidekiq.rb", '//', "//:#{ENV['CACHE_PASSWORD']}@"
|
47
47
|
gsub_file "#{@active_path}/.env", 'HE_PASSWORD: ', "HE_PASSWORD: #{@options[:redis_password]}"
|
48
48
|
gsub_file "#{@active_path}/.env", 'CACHE_HOST: localhost', "CACHE_HOST: #{@options[:redis_location]}"
|
49
49
|
gsub_file "#{@active_path}/config/application.rb", '# pass', 'pass'
|
@@ -191,20 +191,18 @@ module Orats
|
|
191
191
|
end
|
192
192
|
|
193
193
|
def outdated_init
|
194
|
-
|
194
|
+
latest_gem_version = compare_gem_version
|
195
|
+
|
196
|
+
github_repo = "https://raw.githubusercontent.com/nickjj/orats/#{latest_gem_version}/lib/orats"
|
195
197
|
|
196
|
-
version_url = "#{github_repo}/version.rb"
|
197
198
|
galaxy_url = "#{github_repo}/templates/includes/Galaxyfile"
|
198
199
|
playbook_url = "#{github_repo}/templates/play.rb"
|
199
200
|
inventory_url = "#{github_repo}/templates/includes/inventory/group_vars/all.yml"
|
200
201
|
|
201
|
-
remote_version_contents = url_to_string(version_url)
|
202
202
|
remote_galaxy_contents = url_to_string(galaxy_url)
|
203
203
|
remote_playbook_contents = url_to_string(playbook_url)
|
204
204
|
remote_inventory_contents = url_to_string(inventory_url)
|
205
205
|
|
206
|
-
compare_gem_version remote_version_contents
|
207
|
-
|
208
206
|
compare_remote_role_version_to_local remote_galaxy_contents
|
209
207
|
|
210
208
|
local_playbook = compare_remote_to_local('playbook',
|
@@ -217,15 +215,15 @@ module Orats
|
|
217
215
|
inventory_file_stats(remote_inventory_contents),
|
218
216
|
inventory_file_stats(IO.read(inventory_file_path)))
|
219
217
|
|
220
|
-
unless @options[:
|
221
|
-
compare_user_to_local('playbook', 'roles', @options[:
|
222
|
-
playbook_file_stats IO.read(@options[:
|
218
|
+
unless @options[:playbook].empty?
|
219
|
+
compare_user_to_local('playbook', 'roles', @options[:playbook], local_playbook) do
|
220
|
+
playbook_file_stats IO.read(@options[:playbook])
|
223
221
|
end
|
224
222
|
end
|
225
223
|
|
226
|
-
unless @options[:
|
227
|
-
compare_user_to_local('inventory', 'variables', @options[:
|
228
|
-
inventory_file_stats IO.read(@options[:
|
224
|
+
unless @options[:inventory].empty?
|
225
|
+
compare_user_to_local('inventory', 'variables', @options[:inventory], local_inventory) do
|
226
|
+
inventory_file_stats IO.read(@options[:inventory])
|
229
227
|
end
|
230
228
|
end
|
231
229
|
end
|
@@ -282,11 +280,21 @@ module Orats
|
|
282
280
|
roles_list.uniq
|
283
281
|
end
|
284
282
|
|
285
|
-
def compare_gem_version
|
286
|
-
|
283
|
+
def compare_gem_version
|
284
|
+
latest_gem_contents = `gem list orats --remote`.split.last
|
285
|
+
|
286
|
+
if latest_gem_contents.include?('ERROR')
|
287
|
+
say_status 'error', "\e[1mError running `gem list orats --remote`:\e[0m", :red
|
288
|
+
say_status 'msg', 'Chances are their API is down, try again soon', :yellow
|
289
|
+
exit 1
|
290
|
+
end
|
291
|
+
|
292
|
+
latest_gem_version = "v#{latest_gem_contents.split.first[1...-1]}"
|
287
293
|
|
288
294
|
log_status 'gem', 'Comparing this version of orats to the latest orats version:', :green
|
289
|
-
log_status_under 'version', "Latest:
|
295
|
+
log_status_under 'version', "Latest: #{latest_gem_version}, Yours: v#{VERSION}", :yellow
|
296
|
+
|
297
|
+
latest_gem_version
|
290
298
|
end
|
291
299
|
|
292
300
|
def compare_remote_role_version_to_local(remote_galaxy_contents)
|
@@ -353,9 +361,6 @@ module Orats
|
|
353
361
|
log_status label, "Comparing this version of orats' #{label} to #{just_file_name}:", :blue
|
354
362
|
log_status_under 'path', user_path, :cyan
|
355
363
|
|
356
|
-
# really ugly hack to not count rails ENV variables as "missing" for each inventory that was generated
|
357
|
-
local_list = local_list.join("\n").gsub!('TESTPROJ_', '').split("\n") if label == 'inventory'
|
358
|
-
|
359
364
|
missing_count = log_unmatched local_list, user_list, 'missing', :red
|
360
365
|
extra_count = log_unmatched user_list, local_list, 'extra', :yellow
|
361
366
|
|
@@ -394,15 +399,10 @@ module Orats
|
|
394
399
|
def log_unmatched(compare, against, label, color)
|
395
400
|
count = 0
|
396
401
|
|
397
|
-
against = against.join
|
398
|
-
|
399
402
|
compare.each do |item|
|
400
403
|
unless against.include?(item)
|
401
|
-
|
402
|
-
|
403
|
-
say_status label, item, color
|
404
|
-
count += 1
|
405
|
-
end
|
404
|
+
say_status label, item, color
|
405
|
+
count += 1
|
406
406
|
end
|
407
407
|
end
|
408
408
|
|
data/lib/orats/templates/auth.rb
CHANGED
@@ -44,7 +44,7 @@ gem 'pundit', '~> 0.2.3'
|
|
44
44
|
CODE
|
45
45
|
end
|
46
46
|
|
47
|
-
git add: '
|
47
|
+
git add: '-A'
|
48
48
|
git commit: "-m 'Add devise, devise-async and pundit gems'"
|
49
49
|
|
50
50
|
# ----- Run bundle install ----------------------------------------------------------------------------
|
@@ -66,7 +66,7 @@ append_file 'config/sidekiq.yml' do <<-FILE
|
|
66
66
|
FILE
|
67
67
|
end
|
68
68
|
|
69
|
-
git add: '
|
69
|
+
git add: '-A'
|
70
70
|
git commit: "-m 'Add the devise mailer queue to the sidekiq config'"
|
71
71
|
|
72
72
|
# ----- Create the account fixtures -------------------------------------------------------------------
|
@@ -105,7 +105,7 @@ beep:
|
|
105
105
|
CODE
|
106
106
|
end
|
107
107
|
|
108
|
-
git add: '
|
108
|
+
git add: '-A'
|
109
109
|
git commit: "-m 'Add the account model'"
|
110
110
|
|
111
111
|
# ----- Modify the test helper ------------------------------------------------------------------------
|
@@ -122,7 +122,7 @@ end
|
|
122
122
|
CODE
|
123
123
|
end
|
124
124
|
|
125
|
-
git add: '
|
125
|
+
git add: '-A'
|
126
126
|
git commit: "-m 'Add the devise helpers to test helper'"
|
127
127
|
|
128
128
|
# ----- Create the account unit tests -----------------------------------------------------------------
|
@@ -181,7 +181,7 @@ end
|
|
181
181
|
CODE
|
182
182
|
end
|
183
183
|
|
184
|
-
git add: '
|
184
|
+
git add: '-A'
|
185
185
|
git commit: "-m 'Add the account unit tests'"
|
186
186
|
|
187
187
|
# ----- Create the account model ----------------------------------------------------------------------
|
@@ -234,7 +234,7 @@ end
|
|
234
234
|
CODE
|
235
235
|
end
|
236
236
|
|
237
|
-
git add: '
|
237
|
+
git add: '-A'
|
238
238
|
git commit: "-m 'Add the account model'"
|
239
239
|
|
240
240
|
# ----- Create devise migration -----------------------------------------------------------------------
|
@@ -279,7 +279,7 @@ create_migration :accounts, %{
|
|
279
279
|
add_index :accounts, :unlock_token, :unique => true
|
280
280
|
}
|
281
281
|
|
282
|
-
git add: '
|
282
|
+
git add: '-A'
|
283
283
|
git commit: "-m 'Add devise model migration'"
|
284
284
|
|
285
285
|
# ----- Create a seed user ----------------------------------------------------------------------------
|
@@ -290,7 +290,7 @@ puts '-'*80, ''; sleep 0.25
|
|
290
290
|
|
291
291
|
append_file 'db/seeds.rb', "\nAccount.create({ email: \"admin@#{app_name}.com\", password: \"password\", role: \"admin\" })"
|
292
292
|
|
293
|
-
git add: '
|
293
|
+
git add: '-A'
|
294
294
|
git commit: "-m 'Add a seed user'"
|
295
295
|
|
296
296
|
# ----- Create en i18n entries ------------------------------------------------------------------------
|
@@ -307,7 +307,7 @@ authorization:
|
|
307
307
|
CODE
|
308
308
|
end
|
309
309
|
|
310
|
-
git add: '
|
310
|
+
git add: '-A'
|
311
311
|
git commit: "-m 'Add en i18n entries'"
|
312
312
|
|
313
313
|
# ----- Modify the application controller -------------------------------------------------------------
|
@@ -322,7 +322,7 @@ inject_into_file 'app/controllers/application_controller.rb', after: "::Base\n"
|
|
322
322
|
CODE
|
323
323
|
end
|
324
324
|
|
325
|
-
git add: '
|
325
|
+
git add: '-A'
|
326
326
|
git commit: "-m 'Alias current_user to current_account to play nice with other gems'"
|
327
327
|
|
328
328
|
inject_into_file 'app/controllers/application_controller.rb', before: "end\n" do <<-'CODE'
|
@@ -340,7 +340,7 @@ inject_into_file 'app/controllers/application_controller.rb', before: "end\n" do
|
|
340
340
|
CODE
|
341
341
|
end
|
342
342
|
|
343
|
-
git add: '
|
343
|
+
git add: '-A'
|
344
344
|
git commit: "-m 'Change the application controller to allow overriding the devise sign in path'"
|
345
345
|
|
346
346
|
# ----- Create the devise views -----------------------------------------------------------------------
|
@@ -677,7 +677,7 @@ file 'app/views/devise/shared/_links.html.erb' do <<-'HTML'
|
|
677
677
|
HTML
|
678
678
|
end
|
679
679
|
|
680
|
-
git add: '
|
680
|
+
git add: '-A'
|
681
681
|
git commit: "-m 'Add the devise views'"
|
682
682
|
|
683
683
|
# ----- Modify the layout files ------------------------------------------------------------------------
|
@@ -721,7 +721,7 @@ append_file 'app/assets/stylesheets/application.css.scss' do <<-CODE
|
|
721
721
|
CODE
|
722
722
|
end
|
723
723
|
|
724
|
-
git add: '
|
724
|
+
git add: '-A'
|
725
725
|
git commit: "-m 'Add account management links to the layout and add the necessary css selectors'"
|
726
726
|
|
727
727
|
# ----- Modify the .env file --------------------------------------------------------------------------
|
@@ -730,18 +730,18 @@ puts
|
|
730
730
|
say_status 'root', 'Modifying the .env file...', :yellow
|
731
731
|
puts '-'*80, ''; sleep 0.25
|
732
732
|
|
733
|
-
inject_into_file '.env', before: "\
|
734
|
-
|
735
|
-
|
733
|
+
inject_into_file '.env', before: "\nSMTP_ADDRESS" do <<-CODE
|
734
|
+
TOKEN_DEVISE_SECRET: #{generate_token}
|
735
|
+
TOKEN_DEVISE_PEPPER: #{generate_token}
|
736
736
|
CODE
|
737
737
|
end
|
738
738
|
|
739
|
-
inject_into_file '.env', before: "\
|
740
|
-
|
739
|
+
inject_into_file '.env', before: "\nDATABASE_NAME" do <<-CODE
|
740
|
+
ACTION_MAILER_DEVISE_DEFAULT_EMAIL: info@#{app_name}.com
|
741
741
|
CODE
|
742
742
|
end
|
743
743
|
|
744
|
-
git add: '
|
744
|
+
git add: '-A'
|
745
745
|
git commit: "-m 'Add the devise tokens and default email to the .env file'"
|
746
746
|
|
747
747
|
# ----- Create the config files -----------------------------------------------------------------------
|
@@ -753,7 +753,7 @@ puts '-'*80, ''; sleep 0.25
|
|
753
753
|
file 'config/initializers/devise_async.rb', 'Devise::Async.backend = :sidekiq'
|
754
754
|
generate 'devise:install'
|
755
755
|
|
756
|
-
git add: '
|
756
|
+
git add: '-A'
|
757
757
|
git commit: "-m 'Add the devise and devise async initializers'"
|
758
758
|
|
759
759
|
# ----- Modify the config files -----------------------------------------------------------------------
|
@@ -763,9 +763,9 @@ say_status 'config', 'Modifying the devise initializer...', :yellow
|
|
763
763
|
puts '-'*80, ''; sleep 0.25
|
764
764
|
|
765
765
|
gsub_file 'config/initializers/devise.rb',
|
766
|
-
"'please-change-me-at-config-initializers-devise@example.com'", "ENV['
|
767
|
-
gsub_file 'config/initializers/devise.rb', /(?<=key = )'\w{128}'/, "ENV['
|
768
|
-
gsub_file 'config/initializers/devise.rb', /(?<=pepper = )'\w{128}'/, "ENV['
|
766
|
+
"'please-change-me-at-config-initializers-devise@example.com'", "ENV['ACTION_MAILER_DEVISE_DEFAULT_EMAIL']"
|
767
|
+
gsub_file 'config/initializers/devise.rb', /(?<=key = )'\w{128}'/, "ENV['TOKEN_DEVISE_SECRET']"
|
768
|
+
gsub_file 'config/initializers/devise.rb', /(?<=pepper = )'\w{128}'/, "ENV['TOKEN_DEVISE_PEPPER']"
|
769
769
|
|
770
770
|
gsub_file 'config/initializers/devise.rb', '# config.timeout_in = 30.minutes',
|
771
771
|
'config.timeout_in = 2.hours'
|
@@ -788,7 +788,7 @@ gsub_file 'config/initializers/devise.rb', '# config.unlock_in = 1.hour',
|
|
788
788
|
gsub_file 'config/initializers/devise.rb', '# config.last_attempt_warning = false',
|
789
789
|
'config.last_attempt_warning = true'
|
790
790
|
|
791
|
-
git add: '
|
791
|
+
git add: '-A'
|
792
792
|
git commit: "-m 'Change the devise initializer default values'"
|
793
793
|
|
794
794
|
# ----- Modify the routes file ------------------------------------------------------------------------
|
@@ -815,7 +815,7 @@ inject_into_file 'config/routes.rb', after: "collection\n end\n" do <<-CODE
|
|
815
815
|
CODE
|
816
816
|
end
|
817
817
|
|
818
|
-
git add: '
|
818
|
+
git add: '-A'
|
819
819
|
git commit: "-m 'Add devise to the routes file'"
|
820
820
|
|
821
821
|
# ----- Add pundit support ----------------------------------------------------------------------------
|
@@ -826,7 +826,7 @@ puts '-'*80, ''; sleep 0.25
|
|
826
826
|
|
827
827
|
generate 'pundit:install'
|
828
828
|
|
829
|
-
git add: '
|
829
|
+
git add: '-A'
|
830
830
|
git commit: "-m 'Add pundit application policy'"
|
831
831
|
|
832
832
|
inject_into_file 'app/controllers/application_controller.rb', after: "::Base\n" do <<-'CODE'
|
@@ -849,5 +849,5 @@ inject_into_file 'app/controllers/application_controller.rb', after: " #end\n"
|
|
849
849
|
CODE
|
850
850
|
end
|
851
851
|
|
852
|
-
git add: '
|
852
|
+
git add: '-A'
|
853
853
|
git commit: "-m 'Add pundit logic to the application controller'"
|
data/lib/orats/templates/base.rb
CHANGED
@@ -23,7 +23,6 @@ def from_gem(source, destination = nil)
|
|
23
23
|
run "cp #{base_path}/#{file_name} #{destination}"
|
24
24
|
end
|
25
25
|
|
26
|
-
app_name_upper = app_name.upcase
|
27
26
|
app_name_class = app_name.humanize
|
28
27
|
|
29
28
|
# ----- Create the git repo ----------------------------------------------------------------------------
|
@@ -33,7 +32,7 @@ say_status 'git', 'Creating a new local git repo...', :yellow
|
|
33
32
|
puts '-'*80, ''; sleep 0.25
|
34
33
|
|
35
34
|
git :init
|
36
|
-
git add: '
|
35
|
+
git add: '-A'
|
37
36
|
git commit: "-m 'Initial commit'"
|
38
37
|
|
39
38
|
# ----- Modify the .gitignore file --------------------------------------------------------------------
|
@@ -61,7 +60,7 @@ append_to_file '.gitignore' do <<-TEXT
|
|
61
60
|
TEXT
|
62
61
|
end
|
63
62
|
|
64
|
-
git add: '
|
63
|
+
git add: '-A'
|
65
64
|
git commit: "-m 'Add common OS and editor files to the .gitignore file'"
|
66
65
|
|
67
66
|
# ----- Create a few root files -----------------------------------------------------------------------
|
@@ -72,7 +71,7 @@ puts '-'*80, ''; sleep 0.25
|
|
72
71
|
|
73
72
|
file '.ruby-version', '2.1.1'
|
74
73
|
|
75
|
-
git add: '
|
74
|
+
git add: '-A'
|
76
75
|
git commit: "-m 'Add .ruby-version file for common ruby version managers'"
|
77
76
|
|
78
77
|
file 'Procfile' do <<-CODE
|
@@ -81,7 +80,7 @@ worker: sidekiq -C config/sidekiq.yml
|
|
81
80
|
CODE
|
82
81
|
end
|
83
82
|
|
84
|
-
git add: '
|
83
|
+
git add: '-A'
|
85
84
|
git commit: "-m 'Add a basic Procfile to start the puma and sidekiq processes'"
|
86
85
|
|
87
86
|
# ----- Create an .env file ---------------------------------------------------------------------------
|
@@ -93,47 +92,76 @@ puts '-'*80, ''; sleep 0.25
|
|
93
92
|
file '.env' do <<-CODE
|
94
93
|
RAILS_ENV: development
|
95
94
|
|
96
|
-
|
95
|
+
PROJECT_PATH: /full/path/to/your/project
|
97
96
|
|
98
|
-
|
97
|
+
GOOGLE_ANALYTICS_UA:
|
98
|
+
DISQUS_SHORT_NAME:
|
99
99
|
|
100
|
-
#{
|
101
|
-
#{app_name_upper}_SMTP_PORT: 587
|
102
|
-
#{app_name_upper}_SMTP_DOMAIN: gmail.com
|
103
|
-
#{app_name_upper}_SMTP_USERNAME: #{app_name}@gmail.com
|
104
|
-
#{app_name_upper}_SMTP_PASSWORD: thebestpassword
|
105
|
-
#{app_name_upper}_SMTP_AUTH: plain
|
106
|
-
#{app_name_upper}_SMTP_STARTTTLS_AUTO: true
|
100
|
+
TOKEN_RAILS_SECRET: #{generate_token}
|
107
101
|
|
108
|
-
|
109
|
-
|
102
|
+
SMTP_ADDRESS: smtp.gmail.com
|
103
|
+
SMTP_PORT: 587
|
104
|
+
SMTP_DOMAIN: gmail.com
|
105
|
+
SMTP_USERNAME: #{app_name}@gmail.com
|
106
|
+
SMTP_PASSWORD: thebestpassword
|
107
|
+
SMTP_AUTH: plain
|
108
|
+
SMTP_STARTTTLS_AUTO: true
|
110
109
|
|
111
|
-
|
112
|
-
|
113
|
-
#{app_name_upper}_DATABASE_POOL: 25
|
114
|
-
#{app_name_upper}_DATABASE_TIMEOUT: 5000
|
115
|
-
#{app_name_upper}_DATABASE_USERNAME: postgres
|
116
|
-
#{app_name_upper}_DATABASE_PASSWORD: supersecrets
|
110
|
+
ACTION_MAILER_HOST: localhost:3000
|
111
|
+
ACTION_MAILER_DEFAULT_EMAIL: info@#{app_name}.com
|
117
112
|
|
118
|
-
#{
|
119
|
-
|
120
|
-
|
121
|
-
|
113
|
+
DATABASE_NAME: #{app_name}
|
114
|
+
DATABASE_HOST: localhost
|
115
|
+
DATABASE_POOL: 25
|
116
|
+
DATABASE_TIMEOUT: 5000
|
117
|
+
DATABASE_USERNAME: postgres
|
118
|
+
DATABASE_PASSWORD: supersecrets
|
122
119
|
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
CACHE_HOST: localhost
|
121
|
+
CACHE_PORT: 6379
|
122
|
+
CACHE_DATABASE: 0
|
123
|
+
CACHE_PASSWORD:
|
126
124
|
|
127
|
-
|
125
|
+
PUMA_THREADS_MIN: 0
|
126
|
+
PUMA_THREADS_MAX: 1
|
127
|
+
PUMA_WORKERS: 0
|
128
|
+
|
129
|
+
SIDEKIQ_CONCURRENCY: 25
|
128
130
|
CODE
|
129
131
|
end
|
130
132
|
|
131
133
|
# ----- Modify the secrets yaml file -----------------------------------------------------------------------
|
132
134
|
|
133
|
-
|
135
|
+
gsub_file 'config/secrets.yml', /.*\n/, ''
|
136
|
+
append_file 'config/secrets.yml' do <<-FILE
|
137
|
+
# Be sure to restart your server when you modify this file.
|
138
|
+
|
139
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
140
|
+
# If you change this key, all old signed cookies will become invalid!
|
141
|
+
|
142
|
+
# Make sure the secret is at least 30 characters and all random,
|
143
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
144
|
+
# You can use `rake secret` to generate a secure secret key.
|
145
|
+
|
146
|
+
# Make sure the secrets in this file are kept private
|
147
|
+
# if you're sharing your code publicly.
|
148
|
+
|
149
|
+
development: &default
|
150
|
+
secret_key_base: <%= ENV['TOKEN_RAILS_SECRET'] %>
|
151
|
+
|
152
|
+
test:
|
153
|
+
<<: *default
|
154
|
+
|
155
|
+
staging:
|
156
|
+
<<: *default
|
157
|
+
|
158
|
+
production:
|
159
|
+
<<: *default
|
160
|
+
FILE
|
161
|
+
end
|
134
162
|
|
135
|
-
|
136
|
-
|
163
|
+
git add: '-A'
|
164
|
+
git commit: "-m 'Dry up the secrets settings'"
|
137
165
|
|
138
166
|
# ----- Modify the application file -------------------------------------------------------------------
|
139
167
|
|
@@ -142,27 +170,23 @@ say_status 'config', 'Modifying the application file...', :yellow
|
|
142
170
|
puts '-'*80, ''; sleep 0.25
|
143
171
|
|
144
172
|
inject_into_file 'config/application.rb', after: "automatically loaded.\n" do <<-CODE
|
145
|
-
config.x.track.google_analytics = ''
|
146
|
-
config.x.track.disqus_shortname = 'test-#{app_name}'
|
147
|
-
config.x.email.default_to = ENV['#{app_name_upper}_ACTION_MAILER_DEFAULT_EMAIL']
|
148
|
-
|
149
173
|
config.action_mailer.delivery_method = :smtp
|
150
174
|
config.action_mailer.smtp_settings = {
|
151
|
-
:address => ENV['
|
152
|
-
:port => ENV['
|
153
|
-
:domain => ENV['
|
154
|
-
:user_name => ENV['
|
155
|
-
:password => ENV['
|
156
|
-
:authentication => ENV['
|
157
|
-
:enable_starttls_auto => ENV['
|
175
|
+
:address => ENV['SMTP_ADDRESS'],
|
176
|
+
:port => ENV['SMTP_PORT'].to_i,
|
177
|
+
:domain => ENV['SMTP_DOMAIN'],
|
178
|
+
:user_name => ENV['SMTP_USERNAME'],
|
179
|
+
:password => ENV['SMTP_PASSWORD'],
|
180
|
+
:authentication => ENV['SMTP_AUTH'],
|
181
|
+
:enable_starttls_auto => ENV['SMTP_STARTTTLS_AUTO'] == 'true'
|
158
182
|
}
|
159
183
|
|
160
|
-
config.action_mailer.default_url_options = { host: ENV['
|
184
|
+
config.action_mailer.default_url_options = { host: ENV['ACTION_MAILER_HOST'] }
|
161
185
|
|
162
|
-
config.cache_store = :redis_store, { host: ENV['
|
163
|
-
port: ENV['
|
164
|
-
db: ENV['
|
165
|
-
# password: ENV['
|
186
|
+
config.cache_store = :redis_store, { host: ENV['CACHE_HOST'],
|
187
|
+
port: ENV['CACHE_PORT'].to_i,
|
188
|
+
db: ENV['CACHE_DATABASE'].to_i,
|
189
|
+
# password: ENV['CACHE_PASSWORD'].to_i,
|
166
190
|
namespace: '#{app_name}::cache'
|
167
191
|
}
|
168
192
|
CODE
|
@@ -183,7 +207,7 @@ end
|
|
183
207
|
FILE
|
184
208
|
end
|
185
209
|
|
186
|
-
git add: '
|
210
|
+
git add: '-A'
|
187
211
|
git commit: "-m 'Add tweakable settings, update the timezone and change the way validation errors are shown'"
|
188
212
|
|
189
213
|
# ----- Modify the config files -----------------------------------------------------------------------
|
@@ -196,16 +220,16 @@ gsub_file 'config/database.yml', /.*\n/, ''
|
|
196
220
|
append_file 'config/database.yml' do <<-FILE
|
197
221
|
development: &default
|
198
222
|
adapter: postgresql
|
199
|
-
database: <%= ENV['
|
200
|
-
host: <%= ENV['
|
201
|
-
pool: <%= ENV['
|
202
|
-
timeout: <%= ENV['
|
203
|
-
username: <%= ENV['
|
204
|
-
password: <%= ENV['
|
223
|
+
database: <%= ENV['DATABASE_NAME'] %>
|
224
|
+
host: <%= ENV['DATABASE_HOST'] %>
|
225
|
+
pool: <%= ENV['DATABASE_POOL'] %>
|
226
|
+
timeout: <%= ENV['DATABASE_TIMEOUT'] %>
|
227
|
+
username: <%= ENV['DATABASE_USERNAME'] %>
|
228
|
+
password: <%= ENV['DATABASE_PASSWORD'] %>
|
205
229
|
|
206
230
|
test:
|
207
231
|
<<: *default
|
208
|
-
database: <%= ENV['
|
232
|
+
database: <%= ENV['DATABASE_NAME'] %>_test
|
209
233
|
|
210
234
|
staging:
|
211
235
|
<<: *default
|
@@ -215,19 +239,19 @@ production:
|
|
215
239
|
FILE
|
216
240
|
end
|
217
241
|
|
218
|
-
git add: '
|
242
|
+
git add: '-A'
|
219
243
|
git commit: "-m 'Dry up the database settings'"
|
220
244
|
|
221
245
|
file 'config/puma.rb', <<-'CODE'
|
222
246
|
environment ENV['RAILS_ENV']
|
223
247
|
|
224
|
-
threads ENV['
|
225
|
-
workers ENV['
|
248
|
+
threads ENV['PUMA_THREADS_MIN'].to_i,ENV['PUMA_THREADS_MAX'].to_i
|
249
|
+
workers ENV['PUMA_WORKERS'].to_i
|
226
250
|
|
227
|
-
pidfile "#{ENV['
|
251
|
+
pidfile "#{ENV['PROJECT_PATH']}/tmp/puma.pid"
|
228
252
|
|
229
253
|
if ENV['RAILS_ENV'] == 'production'
|
230
|
-
bind "unix://#{ENV['
|
254
|
+
bind "unix://#{ENV['PROJECT_PATH']}/tmp/puma.sock"
|
231
255
|
else
|
232
256
|
port '3000'
|
233
257
|
end
|
@@ -246,20 +270,18 @@ on_worker_boot do
|
|
246
270
|
end
|
247
271
|
CODE
|
248
272
|
|
249
|
-
|
250
|
-
|
251
|
-
git add: '.'
|
273
|
+
git add: '-A'
|
252
274
|
git commit: "-m 'Add the puma config'"
|
253
275
|
|
254
276
|
file 'config/sidekiq.yml', <<-CODE
|
255
277
|
---
|
256
|
-
:pidfile: <%= ENV['
|
257
|
-
:concurrency: <%= ENV['
|
278
|
+
:pidfile: <%= ENV['PROJECT_PATH'] %>/tmp/sidekiq.pid
|
279
|
+
:concurrency: <%= ENV['SIDEKIQ_CONCURRENCY'].to_i %>
|
258
280
|
:queues:
|
259
281
|
- default
|
260
282
|
CODE
|
261
283
|
|
262
|
-
git add: '
|
284
|
+
git add: '-A'
|
263
285
|
git commit: "-m 'Add the sidekiq config'"
|
264
286
|
|
265
287
|
file 'config/sitemap.rb', <<-'CODE'
|
@@ -287,7 +309,7 @@ CODE
|
|
287
309
|
|
288
310
|
gsub_file 'config/sitemap.rb', 'app_name', app_name
|
289
311
|
|
290
|
-
git add: '
|
312
|
+
git add: '-A'
|
291
313
|
git commit: "-m 'Add the sitemap config'"
|
292
314
|
|
293
315
|
file 'config/schedule.rb', <<-CODE
|
@@ -296,7 +318,7 @@ every 1.day, at: '4:00 am' do
|
|
296
318
|
end
|
297
319
|
CODE
|
298
320
|
|
299
|
-
git add: '
|
321
|
+
git add: '-A'
|
300
322
|
git commit: "-m 'Add a sitemap rake task that occurs at 4am'"
|
301
323
|
|
302
324
|
# ----- Modify the environment files ------------------------------------------------------------------
|
@@ -309,19 +331,12 @@ file 'config/environments/staging.rb', <<-CODE
|
|
309
331
|
require_relative 'production.rb'
|
310
332
|
|
311
333
|
#{app_name_class}::Application.configure do
|
312
|
-
|
313
|
-
config.x.track.disqus_shortname = 'test-#{app_name}'
|
334
|
+
# Overwrite any production settings here, or if you want to start from scratch then remove line 1.
|
314
335
|
end
|
315
336
|
CODE
|
316
337
|
|
317
|
-
git add: '
|
318
|
-
git commit: "-m 'Add
|
319
|
-
|
320
|
-
inject_into_file 'config/environments/production.rb', after: "config/application.rb.\n" do <<-"CODE"
|
321
|
-
config.x.track.google_analytics = 'YOUR_UA_CODE'
|
322
|
-
config.x.track.disqus_shortname = '#{app_name}'
|
323
|
-
CODE
|
324
|
-
end
|
338
|
+
git add: '-A'
|
339
|
+
git commit: "-m 'Add add staging environment'"
|
325
340
|
|
326
341
|
inject_into_file 'config/environments/production.rb', after: "config.log_level = :info\n" do <<-"CODE"
|
327
342
|
config.logger = Logger.new(config.paths['log'].first, 'daily')
|
@@ -337,8 +352,8 @@ inject_into_file 'config/environments/production.rb', after: "%w( search.js )\n"
|
|
337
352
|
CODE
|
338
353
|
end
|
339
354
|
|
340
|
-
git add: '
|
341
|
-
git commit: "-m '
|
355
|
+
git add: '-A'
|
356
|
+
git commit: "-m 'Change production config options'"
|
342
357
|
|
343
358
|
# ----- Modify the initializer files ------------------------------------------------------------------
|
344
359
|
|
@@ -348,7 +363,7 @@ puts '-'*80, ''; sleep 0.25
|
|
348
363
|
|
349
364
|
file 'config/initializers/sidekiq.rb', <<-'CODE'
|
350
365
|
sidekiq_config = {
|
351
|
-
url: "redis://#{ENV['
|
366
|
+
url: "redis://#{ENV['CACHE_HOST']}:#{ENV['CACHE_PORT']}/#{ENV['CACHE_DATABASE']}",
|
352
367
|
namespace: "ns_app::sidekiq_#{Rails.env}"
|
353
368
|
}
|
354
369
|
|
@@ -361,10 +376,9 @@ Sidekiq.configure_client do |config|
|
|
361
376
|
end
|
362
377
|
CODE
|
363
378
|
|
364
|
-
gsub_file 'config/initializers/sidekiq.rb', 'app_name', app_name_upper
|
365
379
|
gsub_file 'config/initializers/sidekiq.rb', 'ns_app', app_name
|
366
380
|
|
367
|
-
git add: '
|
381
|
+
git add: '-A'
|
368
382
|
git commit: "-m 'Add the sidekiq initializer'"
|
369
383
|
|
370
384
|
file 'config/initializers/mini_profiler.rb', <<-CODE
|
@@ -374,7 +388,7 @@ if defined? Rack::MiniProfiler
|
|
374
388
|
end
|
375
389
|
CODE
|
376
390
|
|
377
|
-
git add: '
|
391
|
+
git add: '-A'
|
378
392
|
git commit: "-m 'Add the rack mini profiler initializer'"
|
379
393
|
|
380
394
|
# ----- Modify the routes file ------------------------------------------------------------------------
|
@@ -385,7 +399,7 @@ puts '-'*80, ''; sleep 0.25
|
|
385
399
|
|
386
400
|
prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
|
387
401
|
|
388
|
-
git add: '
|
402
|
+
git add: '-A'
|
389
403
|
git commit: "-m 'Add sidekiq to the routes file'"
|
390
404
|
|
391
405
|
inject_into_file 'config/routes.rb', after: "draw do\n" do <<-CODE
|
@@ -395,7 +409,7 @@ inject_into_file 'config/routes.rb', after: "draw do\n" do <<-CODE
|
|
395
409
|
CODE
|
396
410
|
end
|
397
411
|
|
398
|
-
git add: '
|
412
|
+
git add: '-A'
|
399
413
|
git commit: "-m 'Add a route concern for pagination'"
|
400
414
|
|
401
415
|
# ----- Creating application tasks --------------------------------------------------------------------
|
@@ -434,7 +448,7 @@ namespace :assets do
|
|
434
448
|
end
|
435
449
|
CODE
|
436
450
|
|
437
|
-
git add: '
|
451
|
+
git add: '-A'
|
438
452
|
git commit: "-m 'Add a favicon generator task'"
|
439
453
|
|
440
454
|
# ----- Creating application helpers ------------------------------------------------------------------
|
@@ -494,7 +508,7 @@ inject_into_file 'app/helpers/application_helper.rb', after: "ApplicationHelper\
|
|
494
508
|
CODE
|
495
509
|
end
|
496
510
|
|
497
|
-
git add: '
|
511
|
+
git add: '-A'
|
498
512
|
git commit: "-m 'Add favicon and boolean view helpers'"
|
499
513
|
|
500
514
|
# ----- Creating view files ---------------------------------------------------------------------------
|
@@ -523,8 +537,10 @@ file 'app/views/layouts/application.html.erb', <<-HTML
|
|
523
537
|
<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.0/json3.min.js"></script>
|
524
538
|
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
|
525
539
|
<![endif]-->
|
540
|
+
<%= render 'layouts/google_analytics_snippet' %>
|
526
541
|
</head>
|
527
542
|
<body>
|
543
|
+
<%= render 'layouts/google_analytics_tracker' %>
|
528
544
|
<header>
|
529
545
|
<%= render 'layouts/navigation' %>
|
530
546
|
</header>
|
@@ -533,6 +549,26 @@ file 'app/views/layouts/application.html.erb', <<-HTML
|
|
533
549
|
<div class="page-header">
|
534
550
|
<h1><%= yield :heading %></h1>
|
535
551
|
</div>
|
552
|
+
<h4>Using disqus</h4>
|
553
|
+
<p>Disqus related html and javascript will only be loaded when the short name is not empty.</p>
|
554
|
+
<ul>
|
555
|
+
<li>Set the <code>DISQUS_SHORT_NAME</code> env variable in <code>.env</code> and restart the server</li>
|
556
|
+
<li>
|
557
|
+
To output the main comments (place this where you want it):
|
558
|
+
<ul><li><%= render 'layouts/disqus_comments_snippet' %></li></ul>
|
559
|
+
</li>
|
560
|
+
<li>
|
561
|
+
<strong>(optional)</strong> The count snippet is already right before </body>
|
562
|
+
<ul>
|
563
|
+
<li>
|
564
|
+
<strong>(optional)</strong> Append #disqus_thread to the href attribute in your links.<br />
|
565
|
+
This will tell Disqus which links to look up and return the comment count.<br />
|
566
|
+
For example: <a href="http://foo.com/bar.html#disqus_thread">Link</a>.
|
567
|
+
</li>
|
568
|
+
</ul>
|
569
|
+
</li>
|
570
|
+
</ul>
|
571
|
+
|
536
572
|
<%= render 'layouts/flash' %>
|
537
573
|
<%= yield %>
|
538
574
|
</main>
|
@@ -544,12 +580,12 @@ file 'app/views/layouts/application.html.erb', <<-HTML
|
|
544
580
|
</div>
|
545
581
|
</footer>
|
546
582
|
|
547
|
-
|
583
|
+
<%= render 'layouts/disqus_count_snippet' %>
|
548
584
|
</body>
|
549
585
|
</html>
|
550
586
|
HTML
|
551
587
|
|
552
|
-
git add: '
|
588
|
+
git add: '-A'
|
553
589
|
git commit: "-m 'Add new layout view'"
|
554
590
|
|
555
591
|
file 'app/views/layouts/_flash.html.erb', <<-'HTML'
|
@@ -565,7 +601,7 @@ file 'app/views/layouts/_flash.html.erb', <<-'HTML'
|
|
565
601
|
<% end %>
|
566
602
|
HTML
|
567
603
|
|
568
|
-
git add: '
|
604
|
+
git add: '-A'
|
569
605
|
git commit: "-m 'Add flash message partial'"
|
570
606
|
|
571
607
|
file 'app/views/layouts/_navigation.html.erb', <<-HTML
|
@@ -589,7 +625,7 @@ file 'app/views/layouts/_navigation.html.erb', <<-HTML
|
|
589
625
|
</nav>
|
590
626
|
HTML
|
591
627
|
|
592
|
-
git add: '
|
628
|
+
git add: '-A'
|
593
629
|
git commit: "-m 'Add navigation partial'"
|
594
630
|
|
595
631
|
file 'app/views/layouts/_navigation_links.html.erb', <<-HTML
|
@@ -598,21 +634,75 @@ file 'app/views/layouts/_navigation_links.html.erb', <<-HTML
|
|
598
634
|
</li>
|
599
635
|
HTML
|
600
636
|
|
601
|
-
git add: '
|
637
|
+
git add: '-A'
|
602
638
|
git commit: "-m 'Add navigation links partial'"
|
603
639
|
|
604
640
|
file 'app/views/layouts/_footer.html.erb', <<-HTML
|
605
641
|
<p class="text-muted">© #{Time.now.year.to_s} #{app_name} - All rights reserved</p>
|
606
642
|
HTML
|
607
643
|
|
608
|
-
git add: '
|
644
|
+
git add: '-A'
|
609
645
|
git commit: "-m 'Add footer partial'"
|
610
646
|
|
611
|
-
file 'app/views/layouts/
|
647
|
+
file 'app/views/layouts/_google_analytics_snippet.html.erb', <<-HTML
|
648
|
+
<script type="text/javascript">
|
649
|
+
var _gaq = _gaq || [];
|
650
|
+
<% if ENV['GOOGLE_ANALYTICS_UA'].present? %>
|
651
|
+
_gaq.push(['_setAccount', '<%= ENV["GOOGLE_ANALYTICS_UA"] %>']);
|
652
|
+
|
653
|
+
(function() {
|
654
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
655
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
656
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
657
|
+
})();
|
658
|
+
<% end %>
|
659
|
+
</script>
|
660
|
+
HTML
|
661
|
+
|
662
|
+
file 'app/views/layouts/_google_analytics_tracker.html.erb', <<-HTML
|
663
|
+
<script type="text/javascript">
|
664
|
+
// This is added in the body to track both turbolinks and regular hits.
|
665
|
+
_gaq.push(['_trackPageview']);
|
666
|
+
</script>
|
667
|
+
HTML
|
668
|
+
|
669
|
+
git add: '-A'
|
670
|
+
git commit: "-m 'Add google analytics partials'"
|
671
|
+
|
672
|
+
file 'app/views/layouts/_disqus_comments_snippet.html.erb', <<-HTML
|
673
|
+
<% if ENV['DISQUS_SHORT_NAME'].present? %>
|
674
|
+
<div id="disqus_thread"></div>
|
675
|
+
<script type="text/javascript">
|
676
|
+
var disqus_shortname = '<%= ENV["DISQUS_SHORT_NAME"] %>';
|
677
|
+
|
678
|
+
(function() {
|
679
|
+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
680
|
+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
681
|
+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
682
|
+
})();
|
683
|
+
</script>
|
684
|
+
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
685
|
+
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
686
|
+
<% end %>
|
687
|
+
HTML
|
688
|
+
|
689
|
+
file 'app/views/layouts/_disqus_count_snippet.html.erb', <<-HTML
|
690
|
+
<% if ENV['DISQUS_SHORT_NAME'].present? %>
|
691
|
+
<div id="disqus_thread"></div>
|
692
|
+
<script type="text/javascript">
|
693
|
+
var disqus_shortname = '<%= ENV["DISQUS_SHORT_NAME"] %>';
|
694
|
+
|
695
|
+
(function () {
|
696
|
+
var s = document.createElement('script'); s.async = true;
|
697
|
+
s.type = 'text/javascript';
|
698
|
+
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
|
699
|
+
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
700
|
+
}());
|
701
|
+
<% end %>
|
612
702
|
HTML
|
613
703
|
|
614
|
-
git add: '
|
615
|
-
git commit: "-m 'Add
|
704
|
+
git add: '-A'
|
705
|
+
git commit: "-m 'Add disqus partials'"
|
616
706
|
|
617
707
|
# ----- Creating public files -------------------------------------------------------------------------
|
618
708
|
|
@@ -688,7 +778,7 @@ file 'public/502.html', <<-HTML
|
|
688
778
|
</html>
|
689
779
|
HTML
|
690
780
|
|
691
|
-
git add: '
|
781
|
+
git add: '-A'
|
692
782
|
git commit: "-m 'Add public 404, 422, 500 and 502 error pages'"
|
693
783
|
|
694
784
|
# ----- Modifying sass files --------------------------------------------------------------------------
|
@@ -699,7 +789,7 @@ puts '-'*80, ''; sleep 0.25
|
|
699
789
|
|
700
790
|
run 'mv app/assets/stylesheets/application.css app/assets/stylesheets/application.css.scss'
|
701
791
|
|
702
|
-
git add: '
|
792
|
+
git add: '-A'
|
703
793
|
git commit: "-m 'Rename application.css to application.scss'"
|
704
794
|
git add: '-u'
|
705
795
|
|
@@ -707,7 +797,7 @@ inject_into_file 'app/assets/stylesheets/application.css.scss',
|
|
707
797
|
" *= require font-awesome\n",
|
708
798
|
before: " *= require_self\n"
|
709
799
|
|
710
|
-
git add: '
|
800
|
+
git add: '-A'
|
711
801
|
git commit: "-m 'Add font-awesome to the application.scss file'"
|
712
802
|
|
713
803
|
append_file 'app/assets/stylesheets/application.css.scss' do <<-SCSS
|
@@ -791,14 +881,14 @@ puts '-'*80, ''; sleep 0.25
|
|
791
881
|
|
792
882
|
gsub_file 'app/assets/javascripts/application.js', "//= require jquery\n", ''
|
793
883
|
|
794
|
-
git add: '
|
884
|
+
git add: '-A'
|
795
885
|
git commit: "-m 'Remove jquery from the application.js file because it is loaded from a CDN'"
|
796
886
|
|
797
887
|
inject_into_file 'app/assets/javascripts/application.js',
|
798
888
|
"//= require jquery.turbolinks\n",
|
799
889
|
before: "//= require_tree .\n"
|
800
890
|
|
801
|
-
git add: '
|
891
|
+
git add: '-A'
|
802
892
|
git commit: "-m 'Add jquery-turbolinks to the application.js file'"
|
803
893
|
|
804
894
|
inject_into_file 'app/assets/javascripts/application.js', before: "//= require_tree .\n" do <<-CODE
|
@@ -817,7 +907,7 @@ inject_into_file 'app/assets/javascripts/application.js', before: "//= require_t
|
|
817
907
|
CODE
|
818
908
|
end
|
819
909
|
|
820
|
-
git add: '
|
910
|
+
git add: '-A'
|
821
911
|
git commit: "-m 'Add bootstrap to the application.js file'"
|
822
912
|
|
823
913
|
# ----- Modifying gem file ----------------------------------------------------------------------------
|
@@ -829,5 +919,5 @@ puts '-'*80, ''; sleep 0.25
|
|
829
919
|
run 'rm -f Gemfile'
|
830
920
|
from_gem 'Gemfile', 'Gemfile'
|
831
921
|
|
832
|
-
git add: '
|
922
|
+
git add: '-A'
|
833
923
|
git commit: "-m 'Add basic gems to the Gemfile'"
|
@@ -48,43 +48,46 @@ rails_deploy_migrate_master_host: "{{ groups['app'][0] }}"
|
|
48
48
|
rails_deploy_env:
|
49
49
|
RAILS_ENV: production
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
51
|
+
PROJECT_PATH: "{{ rails_deploy_path }}"
|
52
|
+
|
53
|
+
GOOGLE_ANALYTICS_UA:
|
54
|
+
DISQUS_SHORT_NAME:
|
55
|
+
|
56
|
+
DATABASE_HOST: localhost
|
57
|
+
DATABASE_NAME: "{{ rails_deploy_app_name }}"
|
58
|
+
DATABASE_USERNAME: "{{ postgres_user }}"
|
59
|
+
DATABASE_PASSWORD: "{{ postgres_password }}"
|
60
|
+
DATABASE_POOL: 25
|
61
|
+
DATABASE_TIMEOUT: 5000
|
62
|
+
|
63
|
+
CACHE_HOST: "{{ redis_bind }}"
|
64
|
+
CACHE_PORT: "{{ redis_port }}"
|
65
|
+
CACHE_DATABASE: 0
|
66
|
+
CACHE_PASSWORD: "{{ secrets_redis_password }}"
|
67
|
+
|
68
|
+
TOKEN_RAILS_SECRET: "{{ secrets_rails_token }}"
|
69
|
+
TOKEN_DEVISE_SECRET: "{{ secrets_devise_token }}"
|
70
|
+
TOKEN_DEVISE_PEPPER: "{{ secrets_devise_pepper_token }}"
|
71
|
+
|
72
|
+
SMTP_ADDRESS: smtp.testproj.com
|
73
|
+
SMTP_PORT: 25
|
74
|
+
SMTP_DOMAIN: testproj.com
|
75
|
+
SMTP_USERNAME: info@testproj.com
|
76
|
+
SMTP_PASSWORD: "{{ secrets_mail_password }}"
|
77
|
+
SMTP_AUTH: plain
|
78
|
+
SMTP_STARTTTLS_AUTO: true
|
79
|
+
|
80
|
+
ACTION_MAILER_HOST: www.testproj.com
|
81
|
+
ACTION_MAILER_DEFAULT_EMAIL: info@testproj.com
|
82
|
+
ACTION_MAILER_DEVISE_DEFAULT_EMAIL: info@testproj.com
|
83
|
+
|
84
|
+
PUMA_THREADS_MIN: 0
|
85
|
+
PUMA_THREADS_MAX: 16
|
83
86
|
|
84
87
|
# ensure there are always at least 2 workers so puma can properly do phased restarts
|
85
|
-
|
88
|
+
PUMA_WORKERS: "{{ ansible_processor_cores if ansible_processor_cores > 1 else 2 }}"
|
86
89
|
|
87
|
-
|
90
|
+
SIDEKIQ_CONCURRENCY: 25
|
88
91
|
|
89
92
|
# nginx configuration
|
90
93
|
nginx_base_domain: 0.0.0.0
|
data/lib/orats/templates/play.rb
CHANGED
@@ -56,7 +56,7 @@ say_status 'git', 'Creating initial commit...', :yellow
|
|
56
56
|
puts '-'*80, ''; sleep 0.25
|
57
57
|
|
58
58
|
git :init
|
59
|
-
git add: '
|
59
|
+
git add: '-A'
|
60
60
|
git commit: "-m 'Initial commit'"
|
61
61
|
|
62
62
|
# ----- Create the license ----------------------------------------------------------------------------
|
@@ -93,7 +93,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
93
93
|
TEXT
|
94
94
|
end
|
95
95
|
|
96
|
-
git add: '
|
96
|
+
git add: '-A'
|
97
97
|
git commit: "-m 'Add MIT license'"
|
98
98
|
|
99
99
|
# ----- Create the site file --------------------------------------------------------------------------
|
@@ -159,7 +159,7 @@ file 'site.yml' do <<-TEXT
|
|
159
159
|
TEXT
|
160
160
|
end
|
161
161
|
|
162
|
-
git add: '
|
162
|
+
git add: '-A'
|
163
163
|
git commit: "-m 'Add site.yml file'"
|
164
164
|
|
165
165
|
# ----- Installation complete message -----------------------------------------------------------------
|
data/lib/orats/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Janetakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|