sparkler 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sparkler/app_builder.rb +16 -8
- data/lib/sparkler/generators/app_generator.rb +14 -9
- data/lib/sparkler/version.rb +1 -1
- data/sparkler.gemspec +3 -3
- data/templates/Gemfile_additions +4 -11
- data/templates/Procfile +1 -1
- data/templates/application.css.sass +1 -0
- data/templates/application_layout.html.haml +10 -11
- data/templates/bootstrap +43 -0
- data/templates/data +11 -0
- data/templates/en.yml +31 -0
- data/templates/env +1 -0
- data/templates/gitignore_additions +0 -1
- data/templates/raven.rb +5 -0
- metadata +9 -6
- data/templates/cucumber_javascript.rb +0 -5
data/lib/sparkler/app_builder.rb
CHANGED
@@ -32,9 +32,9 @@ module Sparkler
|
|
32
32
|
new_gems = File.open(additions_path).read
|
33
33
|
inject_into_file 'Gemfile', "\n#{new_gems}", after: /gem 'sqlite3'/
|
34
34
|
|
35
|
-
asset_gems = <<-END.gsub(/^ {
|
36
|
-
gem 'compass-rails', '~> 1.0.3'
|
35
|
+
asset_gems = <<-END.gsub(/^ {4}/, '')
|
37
36
|
gem 'zurb-foundation'
|
37
|
+
gem 'compass-rails', github: 'milgner/compass-rails', ref: '1749c06f15dc4b058427e7969810457213647fb8'
|
38
38
|
END
|
39
39
|
|
40
40
|
inject_into_file 'Gemfile', "\n#{asset_gems}", after: /gem 'uglifier'.*$/
|
@@ -42,10 +42,12 @@ module Sparkler
|
|
42
42
|
|
43
43
|
def use_sqlite_config_template
|
44
44
|
template 'database.sqlite.yml.erb', 'config/database.yml', force: true
|
45
|
+
template 'database.sqlite.yml.erb', 'config/database.example.yml', force: true
|
45
46
|
end
|
46
47
|
|
47
48
|
def use_postgres_config_template
|
48
49
|
template 'database.postgres.yml.erb', 'config/database.yml', force: true
|
50
|
+
template 'database.postgres.yml.erb', 'config/database.example.yml', force: true
|
49
51
|
end
|
50
52
|
|
51
53
|
def setup_local_postgres
|
@@ -88,7 +90,7 @@ module Sparkler
|
|
88
90
|
end
|
89
91
|
|
90
92
|
def setup_foundation
|
91
|
-
generate 'foundation:install'
|
93
|
+
generate 'foundation:install --skip'
|
92
94
|
end
|
93
95
|
|
94
96
|
def add_foundation_to_application
|
@@ -100,13 +102,19 @@ module Sparkler
|
|
100
102
|
copy_file 'env', '.env'
|
101
103
|
end
|
102
104
|
|
103
|
-
def
|
104
|
-
|
105
|
+
def setup_sentry
|
106
|
+
copy_file 'raven.rb', 'config/initializers/raven.rb'
|
107
|
+
end
|
108
|
+
|
109
|
+
def setup_scripts
|
110
|
+
%w(bootstrap data).each do |file|
|
111
|
+
copy_file file, "script/#{file}"
|
112
|
+
chmod "script/#{file}", 0755
|
113
|
+
end
|
105
114
|
end
|
106
115
|
|
107
|
-
def
|
108
|
-
|
109
|
-
copy_file 'cucumber_javascript.rb', 'features/support/javascript.rb'
|
116
|
+
def remove_routes_comment_lines
|
117
|
+
replace_in_file 'config/routes.rb', /Application\.routes\.draw do.*end/m, "Application.routes.draw do\nend"
|
110
118
|
end
|
111
119
|
|
112
120
|
def configure_generators
|
@@ -22,10 +22,11 @@ module Sparkler
|
|
22
22
|
invoke :create_views_and_layouts
|
23
23
|
invoke :copy_miscellaneous_files
|
24
24
|
invoke :setup_foundation
|
25
|
+
invoke :setup_sentry
|
25
26
|
invoke :setup_env
|
26
|
-
invoke :setup_cucumber
|
27
27
|
invoke :setup_rspec
|
28
28
|
invoke :setup_git
|
29
|
+
invoke :setup_scripts
|
29
30
|
end
|
30
31
|
|
31
32
|
def remove_useless_files
|
@@ -53,7 +54,6 @@ module Sparkler
|
|
53
54
|
say 'Creating layouts and partials'
|
54
55
|
build :create_partials_directory
|
55
56
|
build :create_shared_flashes
|
56
|
-
build :create_application_layout
|
57
57
|
|
58
58
|
say 'Setting up High Voltage and a home page'
|
59
59
|
build :setup_high_voltage
|
@@ -63,12 +63,18 @@ module Sparkler
|
|
63
63
|
say 'Generating Foundation'
|
64
64
|
build :setup_foundation
|
65
65
|
build :add_foundation_to_application
|
66
|
+
build :create_application_layout
|
67
|
+
end
|
68
|
+
|
69
|
+
def setup_sentry
|
70
|
+
say 'Configuring Sentry'
|
71
|
+
build :setup_sentry
|
66
72
|
end
|
67
73
|
|
68
74
|
def customize_gemfile
|
69
75
|
say 'Setting up gems and bundling'
|
70
76
|
build :add_custom_gems
|
71
|
-
bundle_command 'install --
|
77
|
+
bundle_command 'install --path vendor'
|
72
78
|
bundle_command 'package'
|
73
79
|
end
|
74
80
|
|
@@ -84,6 +90,11 @@ module Sparkler
|
|
84
90
|
build :ignore_local_postgres if options[:local_database]
|
85
91
|
end
|
86
92
|
|
93
|
+
def setup_scripts
|
94
|
+
say 'Adding convenience scripts'
|
95
|
+
build :setup_scripts
|
96
|
+
end
|
97
|
+
|
87
98
|
def copy_miscellaneous_files
|
88
99
|
say 'Copying miscellaneous support files'
|
89
100
|
build :copy_miscellaneous_files
|
@@ -94,12 +105,6 @@ module Sparkler
|
|
94
105
|
build :add_env_from_template
|
95
106
|
end
|
96
107
|
|
97
|
-
def setup_cucumber
|
98
|
-
say 'Installing and configuring Cucumber'
|
99
|
-
build :generate_cucumber
|
100
|
-
say "Don't forget to install chromedriver if you haven't already."
|
101
|
-
end
|
102
|
-
|
103
108
|
def setup_rspec
|
104
109
|
say 'Configuring Rspec'
|
105
110
|
build :configure_rspec
|
data/lib/sparkler/version.rb
CHANGED
data/sparkler.gemspec
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/sparkler/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "sparkler"
|
6
6
|
gem.version = Sparkler::VERSION
|
7
|
-
gem.date =
|
7
|
+
gem.date = Time.now.strftime('%Y-%m-%d')
|
8
8
|
gem.authors = ["Chris Moore"]
|
9
|
-
gem.email = ["chrism@
|
9
|
+
gem.email = ["chrism@gaslight.co"]
|
10
10
|
gem.summary = %q{Generate a Rails app using Gaslight's choices of gems and frameworks.}
|
11
11
|
gem.description = %q{Spin up a Rails app using all the tools and frameworks we like at Gaslight. Inspired heavily by thoughtbot's Suspenders.}
|
12
12
|
gem.homepage = "https://github.com/gaslight/sparkler"
|
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
|
19
|
-
gem.add_dependency 'rails', '
|
19
|
+
gem.add_dependency 'rails', '4.0.0'
|
20
20
|
gem.add_dependency 'bundler', '>= 1.1'
|
21
21
|
end
|
data/templates/Gemfile_additions
CHANGED
@@ -1,25 +1,18 @@
|
|
1
|
-
gem '
|
1
|
+
gem 'puma'
|
2
2
|
gem 'haml-rails'
|
3
3
|
gem 'high_voltage', ">= 1.2.0"
|
4
4
|
gem 'rdiscount'
|
5
|
-
gem '
|
6
|
-
|
7
|
-
group :development do
|
8
|
-
gem 'foreman'
|
9
|
-
end
|
5
|
+
gem 'sentry-raven'
|
10
6
|
|
11
7
|
group :development, :test do
|
12
|
-
gem 'rspec-rails'
|
13
|
-
gem 'dotenv'
|
8
|
+
gem 'rspec-rails'
|
9
|
+
gem 'dotenv-rails'
|
14
10
|
end
|
15
11
|
|
16
12
|
group :test do
|
17
|
-
gem 'cucumber-rails', '1.3.0', :require => false
|
18
13
|
gem 'factory_girl_rails'
|
19
14
|
gem 'database_cleaner'
|
20
15
|
gem 'timecop'
|
21
|
-
gem 'shoulda-matchers'
|
22
|
-
gem 'launchy'
|
23
16
|
end
|
24
17
|
|
25
18
|
group :staging, :production do
|
data/templates/Procfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
web: bundle exec
|
1
|
+
web: bundle exec rails server -p $PORT
|
2
2
|
<% if options[:local_database] %>db: postgres -D pg<% end %>
|
@@ -8,16 +8,15 @@
|
|
8
8
|
= stylesheet_link_tag "application"
|
9
9
|
= csrf_meta_tags
|
10
10
|
%body
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
.
|
21
|
-
%p © #{Date.today.year} Gaslight Software LLC. All Rights Reserved.
|
11
|
+
%header.row
|
12
|
+
.columns.large-12
|
13
|
+
%h1 Header
|
14
|
+
#main.row
|
15
|
+
.columns.large-12
|
16
|
+
= render 'application/flashes'
|
17
|
+
= yield
|
18
|
+
%footer.row
|
19
|
+
.columns.large-12
|
20
|
+
%p © #{Date.today.year} Gaslight LLC. All Rights Reserved.
|
22
21
|
= javascript_include_tag "application"
|
23
22
|
= content_for(:javascript)
|
data/templates/bootstrap
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
echo ""
|
6
|
+
echo " Setting up..."
|
7
|
+
echo ""
|
8
|
+
|
9
|
+
#
|
10
|
+
# Check for Bundler
|
11
|
+
#
|
12
|
+
if test ! $(which bundle)
|
13
|
+
then
|
14
|
+
echo " x You need to install Bundler:"
|
15
|
+
echo " gem install bundler"
|
16
|
+
exit
|
17
|
+
else
|
18
|
+
echo " + Bundler found."
|
19
|
+
fi
|
20
|
+
|
21
|
+
#
|
22
|
+
# Install gems
|
23
|
+
#
|
24
|
+
echo " + Bootstrapping your Rubies."
|
25
|
+
bundle install --without production --local --path vendor --quiet
|
26
|
+
|
27
|
+
#
|
28
|
+
# Setting up database.yml
|
29
|
+
#
|
30
|
+
echo " + Setup config/database.yml"
|
31
|
+
cp config/database.example.yml config/database.yml
|
32
|
+
|
33
|
+
#
|
34
|
+
# Setting up database
|
35
|
+
#
|
36
|
+
echo " + Setting up database..."
|
37
|
+
rake db:setup
|
38
|
+
|
39
|
+
echo ""
|
40
|
+
echo "Ok, setup complete. Run"
|
41
|
+
echo " rails server"
|
42
|
+
echo "to start the application."
|
43
|
+
|
data/templates/data
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
dropdb DB_NAME_dev
|
6
|
+
createdb DB_NAME_dev
|
7
|
+
|
8
|
+
heroku pgbackups:capture --expire --app HEROKU_APP_NAME
|
9
|
+
curl -Lo latest.dump `heroku pgbackups:url --app HEROKU_APP_NAME`
|
10
|
+
pg_restore --verbose --no-acl --no-owner -d DB_NAME_dev latest.dump
|
11
|
+
|
data/templates/en.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
date:
|
24
|
+
formats:
|
25
|
+
nice: "%B %e, %Y"
|
26
|
+
year: "%Y"
|
27
|
+
year_and_month: "%B of %Y"
|
28
|
+
time:
|
29
|
+
formats:
|
30
|
+
nice: "%B %e, %Y %l:%M%p"
|
31
|
+
|
data/templates/env
CHANGED
data/templates/raven.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparkler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bundler
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
description: Spin up a Rails app using all the tools and frameworks we like at Gaslight.
|
47
47
|
Inspired heavily by thoughtbot's Suspenders.
|
48
48
|
email:
|
49
|
-
- chrism@
|
49
|
+
- chrism@gaslight.co
|
50
50
|
executables:
|
51
51
|
- sparkler
|
52
52
|
extensions: []
|
@@ -69,12 +69,15 @@ files:
|
|
69
69
|
- templates/_flashes.html.haml
|
70
70
|
- templates/application.css.sass
|
71
71
|
- templates/application_layout.html.haml
|
72
|
-
- templates/
|
72
|
+
- templates/bootstrap
|
73
|
+
- templates/data
|
73
74
|
- templates/database.postgres.yml.erb
|
74
75
|
- templates/database.sqlite.yml.erb
|
76
|
+
- templates/en.yml
|
75
77
|
- templates/env
|
76
78
|
- templates/gitignore_additions
|
77
79
|
- templates/home.html.haml
|
80
|
+
- templates/raven.rb
|
78
81
|
- templates/time_formats.rb
|
79
82
|
- test/lib/sparkler/version_test.rb
|
80
83
|
- test/test_helper.rb
|