anadea-spark 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spark/app_builder.rb +12 -3
- data/lib/spark/generators/app_generator.rb +26 -0
- data/lib/spark/version.rb +1 -1
- data/spec/features/new_project_spec.rb +1 -1
- data/templates/assets/{application.css.scss → application.scss} +0 -0
- data/templates/config/{locales_en.yml.erb → locales/en/formats.yml.erb} +0 -0
- data/templates/config/postgresql_database.yml.erb +4 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5152f8299a5da09137355aa4b6d6f9787cce496a
|
4
|
+
data.tar.gz: 258ac48e778aab7e06776084329b18566f30bdd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dfe24b9f4798511027a19c295ae8b7e8941d93873121881550d57c34266357f4bac2acc06d81a61e9214564a904c01501421a043278203af6c04c464cbd3a48
|
7
|
+
data.tar.gz: 306d3974368dd2eabc592cf75f90e855f8977dd08fbdf3fd35d3a35f868400a1b73f8b3fb952e63803ba28e3cf1fa26f8a2eed95ef931ce3559b93aa3a1bfdf3
|
data/lib/spark/app_builder.rb
CHANGED
@@ -197,7 +197,7 @@ module Spark
|
|
197
197
|
|
198
198
|
def configure_time_formats
|
199
199
|
remove_file "config/locales/en.yml"
|
200
|
-
template "config/
|
200
|
+
template "config/locales/en/formats.yml.erb", "config/locales/en/formats.yml"
|
201
201
|
end
|
202
202
|
|
203
203
|
def configure_simple_form
|
@@ -226,6 +226,15 @@ module Spark
|
|
226
226
|
inject_into_class 'config/application.rb', 'Application', config
|
227
227
|
end
|
228
228
|
|
229
|
+
def configure_locales_load_from_folders
|
230
|
+
config = <<-RUBY
|
231
|
+
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
|
232
|
+
RUBY
|
233
|
+
|
234
|
+
gsub_file 'config/application.rb', /config\.i18n\.load_path.+/, config
|
235
|
+
uncomment_lines 'config/application.rb', /config\.i18n\.load_path/
|
236
|
+
end
|
237
|
+
|
229
238
|
def generate_rspec
|
230
239
|
generate 'rspec:install'
|
231
240
|
end
|
@@ -240,8 +249,8 @@ module Spark
|
|
240
249
|
|
241
250
|
def setup_stylesheets
|
242
251
|
remove_file 'app/assets/stylesheets/application.css'
|
243
|
-
copy_file 'assets/application.
|
244
|
-
'app/assets/stylesheets/application.
|
252
|
+
copy_file 'assets/application.scss',
|
253
|
+
'app/assets/stylesheets/application.scss'
|
245
254
|
end
|
246
255
|
|
247
256
|
def setup_javascripts
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
require 'rails/generators'
|
2
3
|
require 'rails/generators/rails/app/app_generator'
|
3
4
|
|
@@ -114,6 +115,7 @@ module Spark
|
|
114
115
|
build :configure_simple_form
|
115
116
|
build :disable_xml_params
|
116
117
|
build :fix_i18n_deprecation_warning
|
118
|
+
build :configure_locales_load_from_folders
|
117
119
|
build :setup_default_rake_task
|
118
120
|
build :setup_foreman
|
119
121
|
end
|
@@ -184,6 +186,30 @@ module Spark
|
|
184
186
|
|
185
187
|
protected
|
186
188
|
|
189
|
+
def db_host
|
190
|
+
db_info.host
|
191
|
+
end
|
192
|
+
|
193
|
+
def db_port
|
194
|
+
db_info.port
|
195
|
+
end
|
196
|
+
|
197
|
+
def db_username
|
198
|
+
db_info.user
|
199
|
+
end
|
200
|
+
|
201
|
+
def db_password
|
202
|
+
db_info.password
|
203
|
+
end
|
204
|
+
|
205
|
+
def db_info
|
206
|
+
if ENV.key?("GENERATED_DATABASE_URL")
|
207
|
+
URI.parse(ENV["GENERATED_DATABASE_URL"])
|
208
|
+
else
|
209
|
+
OpenStruct.new
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
187
213
|
def get_builder_class
|
188
214
|
Spark::AppBuilder
|
189
215
|
end
|
data/lib/spark/version.rb
CHANGED
@@ -80,7 +80,7 @@ RSpec.feature 'Build a new project with default configuration' do
|
|
80
80
|
scenario "generated en.yml is evaluated" do
|
81
81
|
run_generator
|
82
82
|
|
83
|
-
locales_en_file = IO.read("#{project_path}/config/locales/en.yml")
|
83
|
+
locales_en_file = IO.read("#{project_path}/config/locales/en/formats.yml")
|
84
84
|
|
85
85
|
expect(locales_en_file).to match(/with_weekday/)
|
86
86
|
end
|
File without changes
|
File without changes
|
@@ -2,7 +2,10 @@ development: &default
|
|
2
2
|
adapter: postgresql
|
3
3
|
database: <%= app_name %>_development
|
4
4
|
encoding: utf8
|
5
|
-
host:
|
5
|
+
host: <%= db_host %>
|
6
|
+
<%= "port: #{db_port}" if db_port %>
|
7
|
+
<%= "username: #{db_username}" if db_username %>
|
8
|
+
<%= "password: #{db_password}" if db_password %>
|
6
9
|
min_messages: warning
|
7
10
|
pool: 2
|
8
11
|
timeout: 5000
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anadea-spark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anadea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,15 +113,15 @@ files:
|
|
113
113
|
- templates/Gemfile.erb
|
114
114
|
- templates/Procfile
|
115
115
|
- templates/README.md.erb
|
116
|
-
- templates/assets/application.css.scss
|
117
116
|
- templates/assets/application.js
|
117
|
+
- templates/assets/application.scss
|
118
118
|
- templates/bin/setup.erb
|
119
119
|
- templates/config/application.yml.sample
|
120
120
|
- templates/config/initializers/disable_xml_params.rb
|
121
121
|
- templates/config/initializers/errors.rb
|
122
122
|
- templates/config/initializers/exception_notification.rb.erb
|
123
123
|
- templates/config/initializers/json_encoding.rb
|
124
|
-
- templates/config/
|
124
|
+
- templates/config/locales/en/formats.yml.erb
|
125
125
|
- templates/config/newrelic.yml.erb
|
126
126
|
- templates/config/postgresql_database.yml.erb
|
127
127
|
- templates/config/rails_secrets.yml
|