blueberry_rails 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -2
- data/.ruby-version +1 -0
- data/.travis.yml +1 -1
- data/README.md +4 -0
- data/lib/blueberry_rails/app_builder.rb +49 -18
- data/lib/blueberry_rails/generators/app_generator.rb +27 -5
- data/lib/blueberry_rails/version.rb +3 -3
- data/spec/blueberry_rails_spec.rb +18 -0
- data/templates/Gemfile_custom.erb +4 -4
- data/templates/Procfile +1 -0
- data/templates/app.json.erb +34 -0
- data/templates/assets/images/blueberry-logo.png +0 -0
- data/templates/circle.yml.erb +13 -0
- data/templates/config/initializers/airbrake.rb +6 -3
- data/templates/config/initializers/simple_form_bootstrap.rb +32 -7
- data/templates/controllers/errors_controller.rb +0 -2
- data/templates/helpers/admin_helper.rb +8 -0
- data/templates/helpers/body_class_helper.rb +0 -1
- data/templates/puma.rb +14 -0
- data/templates/setup +33 -0
- data/templates/spec/spec_helper.rb +1 -1
- data/templates/tasks/images.rake +1 -1
- data/templates/views/application/_gtm.html.slim +3 -5
- metadata +12 -9
- data/templates/helpers/gtm_helper.rb +0 -30
- data/templates/helpers/images_helper.rb +0 -13
- data/templates/travis.yml.erb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5596f930c3e53e38e875c66416bc9392965523c8
|
4
|
+
data.tar.gz: e2591af5b3a01d05746ee80085c723946ae4c7a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c22615911ac5ed27aea09cd160bff1bc1591ae8d9d45ddb20bbba44064d9b6b91158b47190def8843fda61d563483e1d5b191215134128bcd191adb6ab5e5112
|
7
|
+
data.tar.gz: 80afcd4d330b76fcdcb0b5447f4ebfc85e30ce2d2e6e76928d6e6debf942a8faac541bd15d7fc3965806ec566a3c13d0be64fdb70291543a1022cf48f09d0f4c
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,9 @@ AllCops:
|
|
2
2
|
Exclude:
|
3
3
|
- db/schema.rb
|
4
4
|
- bin/*
|
5
|
-
|
5
|
+
|
6
|
+
Rails:
|
7
|
+
Enabled: true
|
6
8
|
|
7
9
|
AbcSize:
|
8
10
|
Enabled: false
|
@@ -215,7 +217,7 @@ StringLiterals:
|
|
215
217
|
VariableInterpolation:
|
216
218
|
Enabled: false
|
217
219
|
|
218
|
-
|
220
|
+
TrailingCommaInLiteral:
|
219
221
|
Enabled: true
|
220
222
|
|
221
223
|
TrivialAccessors:
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module BlueberryRails
|
2
2
|
class AppBuilder < Rails::AppBuilder
|
3
|
-
|
4
3
|
include BlueberryRails::ActionHelpers
|
5
4
|
|
6
5
|
def readme
|
@@ -19,6 +18,13 @@ module BlueberryRails
|
|
19
18
|
template 'secret_token.rb.erb', 'config/initializers/secret_token.rb'
|
20
19
|
end
|
21
20
|
|
21
|
+
def setup_secret_token
|
22
|
+
inject_into_file 'config/secrets.yml',
|
23
|
+
"\nstaging:\n" \
|
24
|
+
" secret_key_base: <%= ENV[\"SECRET_KEY_BASE\"] %>\n",
|
25
|
+
after: " secret_key_base: <%= ENV[\"SECRET_KEY_BASE\"] %>\n"
|
26
|
+
end
|
27
|
+
|
22
28
|
def disable_xml_params
|
23
29
|
copy_file 'disable_xml_params.rb',
|
24
30
|
'config/initializers/disable_xml_params.rb'
|
@@ -37,8 +43,7 @@ module BlueberryRails
|
|
37
43
|
end
|
38
44
|
|
39
45
|
def use_postgres_config_template
|
40
|
-
template 'database.yml.erb', 'config/database.yml',
|
41
|
-
force: true
|
46
|
+
template 'database.yml.erb', 'config/database.yml', force: true
|
42
47
|
template 'database.yml.erb', 'config/database.yml.sample'
|
43
48
|
end
|
44
49
|
|
@@ -61,7 +66,7 @@ module BlueberryRails
|
|
61
66
|
"\n namespace :admin do\n" \
|
62
67
|
" root to: 'dashboard#show'\n" \
|
63
68
|
" end\n\n",
|
64
|
-
before:
|
69
|
+
before: ' root'
|
65
70
|
end
|
66
71
|
|
67
72
|
def create_partials_directory
|
@@ -74,9 +79,7 @@ module BlueberryRails
|
|
74
79
|
template 'views/layouts/application.html.slim.erb',
|
75
80
|
'app/views/layouts/application.html.slim'
|
76
81
|
|
77
|
-
|
78
|
-
copy_file 'helpers/application_helper.rb',
|
79
|
-
'app/helpers/application_helper.rb'
|
82
|
+
directory 'helpers', 'app/helpers', force: true
|
80
83
|
|
81
84
|
remove_file 'public/favicon.ico'
|
82
85
|
directory 'public/icons', 'public'
|
@@ -125,6 +128,14 @@ module BlueberryRails
|
|
125
128
|
copy_file 'pryrc.rb', '.pryrc'
|
126
129
|
end
|
127
130
|
|
131
|
+
def create_procfile
|
132
|
+
copy_file 'Procfile', 'Procfile'
|
133
|
+
end
|
134
|
+
|
135
|
+
def create_puma_config
|
136
|
+
copy_file 'puma.rb', 'config/puma.rb'
|
137
|
+
end
|
138
|
+
|
128
139
|
def create_database
|
129
140
|
bundle_command 'exec rake db:create'
|
130
141
|
end
|
@@ -158,6 +169,12 @@ module BlueberryRails
|
|
158
169
|
bundle_command 'exec guard init'
|
159
170
|
end
|
160
171
|
|
172
|
+
def setup_guard
|
173
|
+
config = 'watch(%r{^spec/factories/(.+)\.rb$}) { |m| rspec.spec.call("models/factories") }'
|
174
|
+
inject_into_file('Guardfile',
|
175
|
+
"\n\n #{config}", before: "\nend")
|
176
|
+
end
|
177
|
+
|
161
178
|
def raise_on_unpermitted_parameters
|
162
179
|
configure_environment 'development',
|
163
180
|
'config.action_controller.action_on_unpermitted_parameters = :raise'
|
@@ -206,8 +223,8 @@ module BlueberryRails
|
|
206
223
|
"Logger.new(Rails.root.join('log/i18n.log'))"
|
207
224
|
end
|
208
225
|
|
209
|
-
def
|
210
|
-
template '
|
226
|
+
def configure_circle
|
227
|
+
template 'circle.yml.erb', 'circle.yml'
|
211
228
|
end
|
212
229
|
|
213
230
|
def add_ruby_version_file
|
@@ -228,11 +245,7 @@ module BlueberryRails
|
|
228
245
|
|
229
246
|
def install_devise
|
230
247
|
generate 'devise:install'
|
231
|
-
|
232
|
-
remove_routes_comment_lines
|
233
|
-
inject_into_file 'config/routes.rb',
|
234
|
-
" root to: 'root#index'\n",
|
235
|
-
after: "Rails.application.routes.draw do\n"
|
248
|
+
generate_root_controller_and_route
|
236
249
|
if options[:devise_model].present?
|
237
250
|
generate 'devise', options[:devise_model]
|
238
251
|
end
|
@@ -287,6 +300,13 @@ module BlueberryRails
|
|
287
300
|
'spec/controllers/root_controller_spec.rb', force: true
|
288
301
|
end
|
289
302
|
|
303
|
+
def cache_and_compress
|
304
|
+
configure_environment 'production',
|
305
|
+
'config.static_cache_control = \'public, max-age=31536000\''
|
306
|
+
configure_environment 'production',
|
307
|
+
'config.middleware.insert_before ActionDispatch::Static, Rack::Deflater'
|
308
|
+
end
|
309
|
+
|
290
310
|
def setup_gitignore
|
291
311
|
[ 'spec/lib',
|
292
312
|
'spec/controllers',
|
@@ -332,11 +352,23 @@ module BlueberryRails
|
|
332
352
|
end
|
333
353
|
|
334
354
|
def configure_bin_setup
|
355
|
+
copy_file 'setup', 'bin/setup', force: true
|
356
|
+
end
|
335
357
|
|
336
|
-
|
337
|
-
|
358
|
+
def generate_root_controller_and_route
|
359
|
+
generate 'controller', 'root index'
|
360
|
+
remove_routes_comment_lines
|
361
|
+
inject_into_file 'config/routes.rb',
|
362
|
+
" root to: 'root#index'\n",
|
363
|
+
after: "Rails.application.routes.draw do\n"
|
364
|
+
end
|
338
365
|
|
339
|
-
|
366
|
+
def create_root_page
|
367
|
+
generate_root_controller_and_route
|
368
|
+
end
|
369
|
+
|
370
|
+
def reviews_app
|
371
|
+
template 'app.json.erb', 'app.json'
|
340
372
|
end
|
341
373
|
|
342
374
|
# Gulp
|
@@ -369,6 +401,5 @@ module BlueberryRails
|
|
369
401
|
copy_file 'gulp/gulpfile.js', 'gulpfile.js'
|
370
402
|
copy_file 'gulp/package.json', 'package.json'
|
371
403
|
end
|
372
|
-
|
373
404
|
end
|
374
405
|
end
|
@@ -3,7 +3,6 @@ require 'rails/generators/rails/app/app_generator'
|
|
3
3
|
|
4
4
|
module BlueberryRails
|
5
5
|
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
-
|
7
6
|
class_option :database, type: :string, aliases: '-d', default: 'postgresql',
|
8
7
|
desc: "Preconfigure for selected database " \
|
9
8
|
"(options: #{DATABASES.join('/')})"
|
@@ -24,10 +23,10 @@ module BlueberryRails
|
|
24
23
|
desc: 'Skip Test::Unit files'
|
25
24
|
|
26
25
|
class_option :skip_turbolinks, type: :boolean, default: true,
|
27
|
-
desc:
|
26
|
+
desc: 'Skip turbolinks gem'
|
28
27
|
|
29
|
-
class_option :skip_bundle, type: :boolean, aliases:
|
30
|
-
desc:
|
28
|
+
class_option :skip_bundle, type: :boolean, aliases: '-B', default: true,
|
29
|
+
desc: 'Don\'t run bundle install'
|
31
30
|
|
32
31
|
class_option :gulp, type: :boolean, aliases: '-g', default: false,
|
33
32
|
desc: 'Include Gulp asset pipeline'
|
@@ -47,6 +46,9 @@ module BlueberryRails
|
|
47
46
|
class_option :custom_errors, type: :boolean, aliases: '-ce', default: false,
|
48
47
|
desc: 'Include Errors Controller'
|
49
48
|
|
49
|
+
class_option :heroku, type: :boolean, aliases: '-he', default: true,
|
50
|
+
desc: 'Heroku reviews app config'
|
51
|
+
|
50
52
|
def finish_template
|
51
53
|
if options[:administration] && (!options[:devise] || !options[:bootstrap])
|
52
54
|
raise 'Administration depends on bootstrap and devise!'
|
@@ -73,6 +75,8 @@ module BlueberryRails
|
|
73
75
|
invoke :setup_custom_errors
|
74
76
|
invoke :setup_initializers
|
75
77
|
invoke :setup_fontcustom
|
78
|
+
invoke :setup_heroku
|
79
|
+
invoke :setup_cache_and_compress
|
76
80
|
end
|
77
81
|
|
78
82
|
def customize_gemfile
|
@@ -103,13 +107,15 @@ module BlueberryRails
|
|
103
107
|
build :configure_rspec
|
104
108
|
build :setup_rspec_support_files
|
105
109
|
build :test_factories_first
|
106
|
-
build :
|
110
|
+
build :configure_circle
|
107
111
|
build :init_guard
|
112
|
+
build :setup_guard
|
108
113
|
end
|
109
114
|
|
110
115
|
def setup_staging_environment
|
111
116
|
say 'Setting up the staging environment'
|
112
117
|
build :setup_staging_environment
|
118
|
+
build :setup_secret_token
|
113
119
|
end
|
114
120
|
|
115
121
|
def setup_initializers
|
@@ -155,6 +161,8 @@ module BlueberryRails
|
|
155
161
|
build :disable_xml_params
|
156
162
|
build :setup_mailer_hosts
|
157
163
|
build :create_pryrc
|
164
|
+
build :create_procfile
|
165
|
+
build :create_puma_config
|
158
166
|
build :add_ruby_version_file
|
159
167
|
build :hound_config
|
160
168
|
build :configure_i18n
|
@@ -165,6 +173,11 @@ module BlueberryRails
|
|
165
173
|
build :remove_routes_comment_lines
|
166
174
|
end
|
167
175
|
|
176
|
+
def setup_cache_and_compress
|
177
|
+
say 'Setting up compress and cache for production env'
|
178
|
+
build :cache_and_compress
|
179
|
+
end
|
180
|
+
|
168
181
|
def setup_gems
|
169
182
|
say 'Setting up SimpleForm'
|
170
183
|
build :configure_simple_form
|
@@ -173,6 +186,8 @@ module BlueberryRails
|
|
173
186
|
build :install_devise
|
174
187
|
build :replace_users_factory
|
175
188
|
build :replace_root_controller_spec
|
189
|
+
else
|
190
|
+
build :create_root_page
|
176
191
|
end
|
177
192
|
if options[:capistrano]
|
178
193
|
say 'Setting up Capistrano'
|
@@ -193,6 +208,13 @@ module BlueberryRails
|
|
193
208
|
end
|
194
209
|
end
|
195
210
|
|
211
|
+
def setup_heroku
|
212
|
+
if options[:heroku]
|
213
|
+
say 'Add heroku reviews apps config'
|
214
|
+
build :reviews_app
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
196
218
|
def rake_tasks
|
197
219
|
build :copy_rake_tasks
|
198
220
|
end
|
@@ -22,8 +22,19 @@ class BlueberryRailsTest < Minitest::Test
|
|
22
22
|
assert_exist_file 'config/initializers/simple_form.rb'
|
23
23
|
assert_exist_file '.hound.yml'
|
24
24
|
assert_exist_file '.rubocop.yml'
|
25
|
+
assert_exist_file 'circle.yml'
|
25
26
|
assert_exist_file '.rspec'
|
27
|
+
assert_exist_file 'app.json'
|
26
28
|
assert_file_have_content 'README.md', 'Test Project'
|
29
|
+
assert_file_have_content 'bin/setup', 'bundle install --deployment'
|
30
|
+
assert_file_have_content 'Procfile', 'bundle exec puma'
|
31
|
+
assert_file_have_content 'config/puma.rb', 'preload_app!'
|
32
|
+
assert_file_have_content 'config/environments/production.rb', 'static_cache_control'
|
33
|
+
assert_file_have_content 'config/environments/production.rb', 'Rack::Deflater'
|
34
|
+
assert_file_have_content 'Guardfile', 'factories'
|
35
|
+
assert_file_have_content 'config/secrets.yml', 'staging'
|
36
|
+
assert_file_have_content 'config/initializers/airbrake.rb', 'config.blacklist_keys'
|
37
|
+
|
27
38
|
assert run_rake
|
28
39
|
end
|
29
40
|
|
@@ -103,4 +114,11 @@ class BlueberryRailsTest < Minitest::Test
|
|
103
114
|
assert_exist_file 'package.json'
|
104
115
|
assert run_rake
|
105
116
|
end
|
117
|
+
|
118
|
+
def test_rake_runs_with_heroku_option
|
119
|
+
create_project '--heroku'
|
120
|
+
|
121
|
+
assert_exist_file 'app.json'
|
122
|
+
assert run_rake
|
123
|
+
end
|
106
124
|
end
|
@@ -16,15 +16,14 @@ gem 'jquery-rails'
|
|
16
16
|
gem 'metamagic'
|
17
17
|
gem 'pg'
|
18
18
|
gem 'rails', '~> <%= BlueberryRails::RAILS_VERSION %>'
|
19
|
-
gem '
|
19
|
+
gem 'sassc-rails'
|
20
20
|
gem 'simple_form'
|
21
21
|
gem 'slim-rails'
|
22
22
|
<% if options[:translation_engine] -%>
|
23
|
-
gem 'translation_engine',
|
24
|
-
git: 'https://github.com/blueberryapps/translation-engine.git'
|
23
|
+
gem 'translation_engine', github: 'blueberryapps/translation-engine'
|
25
24
|
<% end -%>
|
26
25
|
gem 'uglifier', '>= 1.3.0'
|
27
|
-
gem '
|
26
|
+
gem 'puma'
|
28
27
|
|
29
28
|
source 'https://rails-assets.org' do
|
30
29
|
<% if options[:bootstrap] -%>
|
@@ -47,6 +46,7 @@ group :development do
|
|
47
46
|
gem 'fontcustom'
|
48
47
|
<% end -%>
|
49
48
|
gem 'guard-rspec'
|
49
|
+
gem 'i18n_yaml_sorter'
|
50
50
|
gem 'image_optimizer', '~> 1.3.0'
|
51
51
|
gem 'mailcatcher'
|
52
52
|
gem 'pry-rails'
|
data/templates/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec puma -C config/puma.rb
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"name": "<%=app_name%>",
|
3
|
+
"scripts": {
|
4
|
+
},
|
5
|
+
"env": {
|
6
|
+
"AWS_ACCESS_KEY_ID": { "required": false },
|
7
|
+
"AWS_REGION": { "required": false },
|
8
|
+
"AWS_SECRET_ACCESS_KEY": { "required": false },
|
9
|
+
"DEPLOY_TASKS": { "required": false },
|
10
|
+
"HEROKU_APP_NAME": { "required": true },
|
11
|
+
"LANG": { "required": true },
|
12
|
+
"RACK_ENV": { "required": true },
|
13
|
+
"RAILS_ENV": { "required": true },
|
14
|
+
"RAILS_SERVE_STATIC_FILES": { "required": true },
|
15
|
+
"S3_BUCKET_NAME": { "required": false },
|
16
|
+
"SECRET_KEY_BASE": { "required": true },
|
17
|
+
"TZ": { "required": false }
|
18
|
+
},
|
19
|
+
"formation": {
|
20
|
+
"worker": { "quantity": 1 },
|
21
|
+
"web": { "quantity": 1 }
|
22
|
+
},
|
23
|
+
"addons": [
|
24
|
+
"heroku-postgresql"
|
25
|
+
],
|
26
|
+
"buildpacks": [
|
27
|
+
{
|
28
|
+
"url": "urn:buildpack:heroku/ruby"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"url": "https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks"
|
32
|
+
}
|
33
|
+
]
|
34
|
+
}
|
Binary file
|
@@ -1,6 +1,9 @@
|
|
1
1
|
Airbrake.configure do |config|
|
2
|
-
config.host
|
3
|
-
config.project_id
|
4
|
-
config.project_key
|
2
|
+
config.host = 'http://errors.blueberry.cz'
|
3
|
+
config.project_id = -1
|
4
|
+
config.project_key = 'API_KEY'
|
5
|
+
|
6
|
+
config.environment = Rails.env
|
5
7
|
config.ignore_environments = %w(development test)
|
8
|
+
config.blacklist_keys = [/password/i]
|
6
9
|
end
|
@@ -4,6 +4,31 @@ SimpleForm.setup do |config|
|
|
4
4
|
config.button_class = 'btn btn-default'
|
5
5
|
config.boolean_label_class = nil
|
6
6
|
|
7
|
+
config.wrappers :adaptive_placeholder, tag: 'div', class: 'form-group adaptive-placeholder', error_class: 'has-error' do |b|
|
8
|
+
b.use :html5
|
9
|
+
b.use :placeholder
|
10
|
+
b.optional :maxlength
|
11
|
+
b.optional :pattern
|
12
|
+
b.optional :min_max
|
13
|
+
b.optional :readonly
|
14
|
+
b.wrapper tag: 'div', class: 'form-control-wrapper' do |ba|
|
15
|
+
ba.use :input, class: 'form-control empty'
|
16
|
+
ba.use :label, class: 'control-label', tag: 'div'
|
17
|
+
ba.use :hint, wrap_with: { tag: 'div', class: 'hint' }
|
18
|
+
end
|
19
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
20
|
+
end
|
21
|
+
|
22
|
+
config.wrappers :styled_radio_and_checkboxes, tag: 'div', class: 'form-group',
|
23
|
+
item_wrapper_class: 'styled-checkbox', item_wrapper_tag: 'div', error_class: 'has-error', label: false do |b|
|
24
|
+
b.use :html5
|
25
|
+
b.optional :readonly
|
26
|
+
b.use :label, class: 'control-label'
|
27
|
+
b.use :input
|
28
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
29
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
30
|
+
end
|
31
|
+
|
7
32
|
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
8
33
|
b.use :html5
|
9
34
|
b.use :placeholder
|
@@ -138,14 +163,14 @@ SimpleForm.setup do |config|
|
|
138
163
|
# Check the Bootstrap docs (http://getbootstrap.com)
|
139
164
|
# to learn about the different styles for forms and inputs,
|
140
165
|
# buttons and other elements.
|
141
|
-
config.default_wrapper = :
|
166
|
+
config.default_wrapper = :adaptive_placeholder
|
142
167
|
config.wrapper_mappings = {
|
143
|
-
check_boxes:
|
168
|
+
check_boxes: :vertical_radio_and_checkboxes,
|
144
169
|
radio_buttons: :vertical_radio_and_checkboxes,
|
145
|
-
file:
|
146
|
-
boolean:
|
147
|
-
datetime:
|
148
|
-
date:
|
149
|
-
time:
|
170
|
+
file: :vertical_file_input,
|
171
|
+
boolean: :vertical_boolean,
|
172
|
+
datetime: :multi_select,
|
173
|
+
date: :multi_select,
|
174
|
+
time: :multi_select
|
150
175
|
}
|
151
176
|
end
|
@@ -5,7 +5,6 @@ module BodyClassHelper
|
|
5
5
|
basic_body_class = "#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}"
|
6
6
|
|
7
7
|
basic_body_class << ' development' if Rails.env.development?
|
8
|
-
basic_body_class << ' show-cookie' if cookies['cookie_eu_consented'] != 'true'
|
9
8
|
|
10
9
|
if content_for?(extra_body_classes_symbol)
|
11
10
|
[basic_body_class, content_for(extra_body_classes_symbol)].join(' ')
|
data/templates/puma.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
|
2
|
+
threads_count = Integer(ENV['MAX_THREADS'] || 5)
|
3
|
+
threads threads_count, threads_count
|
4
|
+
|
5
|
+
preload_app!
|
6
|
+
|
7
|
+
port ENV['PORT'] || 3000
|
8
|
+
environment ENV['RACK_ENV'] || 'development'
|
9
|
+
|
10
|
+
on_worker_boot do
|
11
|
+
# Worker specific setup for Rails 4.1+
|
12
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
13
|
+
ActiveRecord::Base.establish_connection
|
14
|
+
end
|
data/templates/setup
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
if ENV['CI']
|
14
|
+
system "bundle check || bundle install --deployment --path=vendor/bundle"
|
15
|
+
else
|
16
|
+
system "bundle check || bundle install"
|
17
|
+
end
|
18
|
+
|
19
|
+
puts "\n== Copying sample files =="
|
20
|
+
unless File.exist?("config/database.yml")
|
21
|
+
system "cp config/database.yml.sample config/database.yml"
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "\n== Preparing database =="
|
25
|
+
system "bin/rake db:setup"
|
26
|
+
|
27
|
+
puts "\n== Removing old logs and tempfiles =="
|
28
|
+
system "rm -f log/*"
|
29
|
+
system "rm -rf tmp/cache"
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system "touch tmp/restart.txt"
|
33
|
+
end
|
data/templates/tasks/images.rake
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
- if
|
2
|
-
/! Google Tag Manager
|
1
|
+
- if ENV['GTM_ID']
|
3
2
|
noscript
|
4
|
-
iframe height="0" src="//www.googletagmanager.com/ns.html?id
|
3
|
+
iframe height="0" src="//www.googletagmanager.com/ns.html?id=#{ENV['GTM_ID']}" style="display:none;visibility:hidden" width="0"
|
5
4
|
javascript:
|
6
|
-
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'
|
7
|
-
/! End Google Tag Manager
|
5
|
+
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer',"#{ENV['GTM_ID']}");
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueberry_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BlueberryApps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.2.
|
33
|
+
version: 4.2.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.2.
|
40
|
+
version: 4.2.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".hound.yml"
|
65
65
|
- ".rubocop.yml"
|
66
|
+
- ".ruby-version"
|
66
67
|
- ".travis.yml"
|
67
68
|
- Gemfile
|
68
69
|
- LICENSE.txt
|
@@ -79,6 +80,7 @@ files:
|
|
79
80
|
- spec/support/blueberry_rails_helpers.rb
|
80
81
|
- templates/Capfile
|
81
82
|
- templates/Gemfile_custom.erb
|
83
|
+
- templates/Procfile
|
82
84
|
- templates/README.md.erb
|
83
85
|
- templates/admin_assets/javascripts/admin.coffee
|
84
86
|
- templates/admin_assets/javascripts/admin/.keep
|
@@ -88,6 +90,7 @@ files:
|
|
88
90
|
- templates/admin_controllers/dashboard_controller.rb
|
89
91
|
- templates/admin_views/dashboard/show.html.slim
|
90
92
|
- templates/admin_views/partials/_menu.html.slim
|
93
|
+
- templates/app.json.erb
|
91
94
|
- templates/assets/icons/_font_icons.scss
|
92
95
|
- templates/assets/images/blueberry-logo.png
|
93
96
|
- templates/assets/javascripts/application.coffee
|
@@ -115,6 +118,7 @@ files:
|
|
115
118
|
- templates/assets/stylesheets/ie.sass
|
116
119
|
- templates/assets/stylesheets/print.sass
|
117
120
|
- templates/capistrano_dotenv.cap
|
121
|
+
- templates/circle.yml.erb
|
118
122
|
- templates/config/initializers/airbrake.rb
|
119
123
|
- templates/config/initializers/simple_form_bootstrap.rb
|
120
124
|
- templates/config/initializers/translation_engine.rb
|
@@ -153,10 +157,9 @@ files:
|
|
153
157
|
- templates/gulp/tasks/watchify.coffee
|
154
158
|
- templates/gulp/util/bundleLogger.coffee
|
155
159
|
- templates/gulp/util/handleErrors.coffee
|
160
|
+
- templates/helpers/admin_helper.rb
|
156
161
|
- templates/helpers/application_helper.rb
|
157
162
|
- templates/helpers/body_class_helper.rb
|
158
|
-
- templates/helpers/gtm_helper.rb
|
159
|
-
- templates/helpers/images_helper.rb
|
160
163
|
- templates/locales/cs/cs.devise.yml
|
161
164
|
- templates/locales/cs/cs.meta.yml
|
162
165
|
- templates/locales/cs/cs.rails.yml
|
@@ -189,7 +192,9 @@ files:
|
|
189
192
|
- templates/public/icons/ms-icon-150x150.png
|
190
193
|
- templates/public/icons/ms-icon-310x310.png
|
191
194
|
- templates/public/icons/ms-icon-70x70.png
|
195
|
+
- templates/puma.rb
|
192
196
|
- templates/secret_token.rb.erb
|
197
|
+
- templates/setup
|
193
198
|
- templates/spec/controllers/root_controller_spec.rb
|
194
199
|
- templates/spec/database_cleaner_setup.rb
|
195
200
|
- templates/spec/factories/administrators.rb
|
@@ -200,7 +205,6 @@ files:
|
|
200
205
|
- templates/spec/spec_helper.rb
|
201
206
|
- templates/tasks/icons.rake
|
202
207
|
- templates/tasks/images.rake
|
203
|
-
- templates/travis.yml.erb
|
204
208
|
- templates/views/application/_favicon.html.slim
|
205
209
|
- templates/views/application/_flashes.html.slim
|
206
210
|
- templates/views/application/_footer.html.slim
|
@@ -228,11 +232,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
232
|
version: '0'
|
229
233
|
requirements: []
|
230
234
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.5.1
|
232
236
|
signing_key:
|
233
237
|
specification_version: 4
|
234
238
|
summary: A Rails app template by BlueberryApps
|
235
239
|
test_files:
|
236
240
|
- spec/blueberry_rails_spec.rb
|
237
241
|
- spec/support/blueberry_rails_helpers.rb
|
238
|
-
has_rdoc:
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module GtmHelper
|
2
|
-
def addEvent(options = {})
|
3
|
-
args = map_options options
|
4
|
-
|
5
|
-
content_for :javascript do
|
6
|
-
javascript_tag("dataLayer.push({ #{args} });")
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def renderEvent(options = {})
|
11
|
-
args = map_options options
|
12
|
-
javascript_tag("dataLayer.push({ #{args} });")
|
13
|
-
end
|
14
|
-
|
15
|
-
def renderJsEvent(options = {})
|
16
|
-
args = map_options options
|
17
|
-
raw "dataLayer.push({ #{args} });"
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def map_options(options)
|
23
|
-
default_options = { 'event': 'GAevent' }
|
24
|
-
merged_options = default_options.merge(options)
|
25
|
-
mappings = { 'category': 'eventCategory', 'action': 'eventAction', 'label': 'eventLabel', 'value': 'eventValue', 'event': 'event' }
|
26
|
-
|
27
|
-
args = merged_options.map { |key, value| [mappings[key], value] }
|
28
|
-
.map { |a| "'#{a[0]}': '#{a[1]}'" }.join(', ')
|
29
|
-
end
|
30
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module ImagesHelper
|
2
|
-
# Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags
|
3
|
-
# for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers.
|
4
|
-
#
|
5
|
-
# image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image'
|
6
|
-
#
|
7
|
-
# => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image">
|
8
|
-
#
|
9
|
-
def image_set_tag(source, srcset = {}, options = {})
|
10
|
-
srcset = srcset.map { |src, size| "#{path_to_image(src)} #{size}" }.join(', ')
|
11
|
-
image_tag(source, options.merge(srcset: srcset))
|
12
|
-
end
|
13
|
-
end
|
data/templates/travis.yml.erb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- <%= BlueberryRails::RUBY_VERSION %>
|
7
|
-
|
8
|
-
install:
|
9
|
-
- bin/setup
|
10
|
-
|
11
|
-
cache:
|
12
|
-
- bundler
|
13
|
-
|
14
|
-
branches:
|
15
|
-
only:
|
16
|
-
- master
|
17
|
-
|
18
|
-
addons:
|
19
|
-
postgresql: '9.3'
|
20
|
-
|
21
|
-
env:
|
22
|
-
global:
|
23
|
-
- RAILS_ENV=test
|