jetfuel 1.18.0
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 +7 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTING.md +36 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +131 -0
- data/LICENSE +21 -0
- data/NEWS.md +246 -0
- data/README.md +191 -0
- data/Rakefile +8 -0
- data/bin/jetfuel +18 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/jetfuel.gemspec +37 -0
- data/lib/jetfuel/actions.rb +25 -0
- data/lib/jetfuel/app_builder.rb +400 -0
- data/lib/jetfuel/generators/app_generator.rb +227 -0
- data/lib/jetfuel/version.rb +5 -0
- data/lib/jetfuel.rb +4 -0
- data/spec/fakes/bin/heroku +5 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/github_spec.rb +10 -0
- data/spec/features/heroku_spec.rb +19 -0
- data/spec/features/new_project_spec.rb +68 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/fake_github.rb +21 -0
- data/spec/support/fake_heroku.rb +38 -0
- data/spec/support/jetfuel.rb +49 -0
- data/templates/Brewfile +2 -0
- data/templates/Gemfile.erb +51 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +25 -0
- data/templates/_analytics.html.erb +7 -0
- data/templates/_flashes.html.erb +8 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/application.css.scss +7 -0
- data/templates/application_helper.rb +9 -0
- data/templates/background_jobs_rspec.rb +19 -0
- data/templates/bin_setup +32 -0
- data/templates/config_locales_en.yml +11 -0
- data/templates/database_cleaner_rspec.rb +21 -0
- data/templates/development_seeds.rb +13 -0
- data/templates/devise.rb +257 -0
- data/templates/disable_xml_params.rb +3 -0
- data/templates/errors.rb +28 -0
- data/templates/factory_girl_rspec.rb +3 -0
- data/templates/flashes.css.scss +4 -0
- data/templates/i18n.rb +3 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/postgresql_database.yml.erb +12 -0
- data/templates/rack_timeout.rb +1 -0
- data/templates/sample.env +3 -0
- data/templates/secrets.yml +14 -0
- data/templates/smtp.rb +9 -0
- data/templates/spec_helper.rb +32 -0
- data/templates/staging.rb +5 -0
- data/templates/suspenders_gitignore +13 -0
- data/templates/suspenders_layout.html.erb.erb +16 -0
- data/templates/travis.yml.erb +31 -0
- data/templates/unicorn.rb +30 -0
- metadata +211 -0
@@ -0,0 +1,227 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Jetfuel
|
5
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
|
7
|
+
:desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
8
|
+
|
9
|
+
class_option :heroku, :type => :boolean, :aliases => '-H', :default => false,
|
10
|
+
:desc => 'Create staging and production Heroku apps'
|
11
|
+
|
12
|
+
class_option :github, :type => :string, :aliases => '-G', :default => nil,
|
13
|
+
:desc => 'Create Github repository and add remote origin pointed to repo'
|
14
|
+
|
15
|
+
class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
|
16
|
+
:desc => 'Skip Test::Unit files'
|
17
|
+
|
18
|
+
def finish_template
|
19
|
+
invoke :suspenders_customization
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def suspenders_customization
|
24
|
+
invoke :customize_gemfile
|
25
|
+
invoke :setup_development_environment
|
26
|
+
invoke :setup_test_environment
|
27
|
+
invoke :setup_production_environment
|
28
|
+
invoke :setup_staging_environment
|
29
|
+
invoke :setup_secret_token
|
30
|
+
invoke :create_suspenders_views
|
31
|
+
invoke :setup_coffeescript
|
32
|
+
invoke :configure_app
|
33
|
+
invoke :setup_stylesheets
|
34
|
+
invoke :setup_helpers
|
35
|
+
invoke :copy_miscellaneous_files
|
36
|
+
invoke :customize_error_pages
|
37
|
+
invoke :remove_routes_comment_lines
|
38
|
+
invoke :setup_git
|
39
|
+
invoke :setup_database
|
40
|
+
invoke :create_heroku_apps
|
41
|
+
invoke :create_github_repo
|
42
|
+
invoke :setup_segment_io
|
43
|
+
invoke :install_leather
|
44
|
+
invoke :setup_devise
|
45
|
+
invoke :outro
|
46
|
+
end
|
47
|
+
|
48
|
+
def customize_gemfile
|
49
|
+
build :replace_gemfile
|
50
|
+
build :set_ruby_to_version_being_used
|
51
|
+
|
52
|
+
if options[:heroku]
|
53
|
+
build :setup_heroku_specific_gems
|
54
|
+
end
|
55
|
+
|
56
|
+
bundle_command 'install'
|
57
|
+
end
|
58
|
+
|
59
|
+
def setup_devise
|
60
|
+
say 'Install Devise'
|
61
|
+
build :install_devise
|
62
|
+
build :create_devise_user
|
63
|
+
end
|
64
|
+
|
65
|
+
def setup_database
|
66
|
+
say 'Setting up database'
|
67
|
+
|
68
|
+
if 'postgresql' == options[:database]
|
69
|
+
build :use_postgres_config_template
|
70
|
+
end
|
71
|
+
|
72
|
+
build :create_database
|
73
|
+
end
|
74
|
+
|
75
|
+
def setup_development_environment
|
76
|
+
say 'Setting up the development environment'
|
77
|
+
build :raise_on_delivery_errors
|
78
|
+
build :raise_on_unpermitted_parameters
|
79
|
+
build :provide_setup_script
|
80
|
+
build :provide_dev_prime_task
|
81
|
+
build :configure_generators
|
82
|
+
end
|
83
|
+
|
84
|
+
def setup_test_environment
|
85
|
+
say 'Setting up the test environment'
|
86
|
+
build :set_up_factory_girl_for_rspec
|
87
|
+
build :generate_rspec
|
88
|
+
build :configure_rspec
|
89
|
+
build :configure_background_jobs_for_rspec
|
90
|
+
build :enable_database_cleaner
|
91
|
+
build :configure_spec_support_features
|
92
|
+
build :configure_travis
|
93
|
+
build :configure_i18n_in_specs
|
94
|
+
build :configure_action_mailer_in_specs
|
95
|
+
end
|
96
|
+
|
97
|
+
def setup_production_environment
|
98
|
+
say 'Setting up the production environment'
|
99
|
+
build :configure_newrelic
|
100
|
+
build :configure_smtp
|
101
|
+
build :enable_rack_deflater
|
102
|
+
build :setup_asset_host
|
103
|
+
end
|
104
|
+
|
105
|
+
def setup_staging_environment
|
106
|
+
say 'Setting up the staging environment'
|
107
|
+
build :setup_staging_environment
|
108
|
+
end
|
109
|
+
|
110
|
+
def setup_secret_token
|
111
|
+
say 'Moving secret token out of version control'
|
112
|
+
build :setup_secret_token
|
113
|
+
end
|
114
|
+
|
115
|
+
def create_suspenders_views
|
116
|
+
say 'Creating suspenders views'
|
117
|
+
build :create_partials_directory
|
118
|
+
build :create_shared_flashes
|
119
|
+
build :create_shared_javascripts
|
120
|
+
build :create_application_layout
|
121
|
+
end
|
122
|
+
|
123
|
+
def setup_coffeescript
|
124
|
+
say 'Setting up CoffeeScript defaults'
|
125
|
+
build :remove_turbolinks
|
126
|
+
build :add_bootstrap_js
|
127
|
+
end
|
128
|
+
|
129
|
+
def configure_app
|
130
|
+
say 'Configuring app'
|
131
|
+
build :configure_action_mailer
|
132
|
+
build :configure_time_zone
|
133
|
+
build :configure_time_formats
|
134
|
+
build :configure_rack_timeout
|
135
|
+
build :disable_xml_params
|
136
|
+
build :fix_i18n_deprecation_warning
|
137
|
+
build :setup_default_rake_task
|
138
|
+
build :configure_unicorn
|
139
|
+
build :setup_foreman
|
140
|
+
end
|
141
|
+
|
142
|
+
def setup_stylesheets
|
143
|
+
say 'Set up stylesheets'
|
144
|
+
build :setup_stylesheets
|
145
|
+
end
|
146
|
+
|
147
|
+
def setup_helpers
|
148
|
+
say 'Set up helpers'
|
149
|
+
build :setup_helpers
|
150
|
+
end
|
151
|
+
|
152
|
+
def install_leather
|
153
|
+
say 'Install Leather'
|
154
|
+
build :install_leather
|
155
|
+
end
|
156
|
+
|
157
|
+
def setup_git
|
158
|
+
if !options[:skip_git]
|
159
|
+
say 'Initializing git'
|
160
|
+
invoke :setup_gitignore
|
161
|
+
invoke :init_git
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def create_heroku_apps
|
166
|
+
if options[:heroku]
|
167
|
+
say 'Creating Heroku apps'
|
168
|
+
build :create_heroku_apps
|
169
|
+
build :set_heroku_remotes
|
170
|
+
build :set_heroku_rails_secrets
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def create_github_repo
|
175
|
+
if !options[:skip_git] && options[:github]
|
176
|
+
say 'Creating Github repo'
|
177
|
+
build :create_github_repo, options[:github]
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def setup_segment_io
|
182
|
+
say 'Setting up Segment.io'
|
183
|
+
build :setup_segment_io
|
184
|
+
end
|
185
|
+
|
186
|
+
def setup_gitignore
|
187
|
+
build :gitignore_files
|
188
|
+
end
|
189
|
+
|
190
|
+
def init_git
|
191
|
+
build :init_git
|
192
|
+
end
|
193
|
+
|
194
|
+
def copy_miscellaneous_files
|
195
|
+
say 'Copying miscellaneous support files'
|
196
|
+
build :copy_miscellaneous_files
|
197
|
+
end
|
198
|
+
|
199
|
+
def customize_error_pages
|
200
|
+
say 'Customizing the 500/404/422 pages'
|
201
|
+
build :customize_error_pages
|
202
|
+
end
|
203
|
+
|
204
|
+
def remove_routes_comment_lines
|
205
|
+
build :remove_routes_comment_lines
|
206
|
+
end
|
207
|
+
|
208
|
+
def outro
|
209
|
+
say 'Congratulations! You just pulled our suspenders.'
|
210
|
+
say "Remember to run 'rails generate airbrake' with your API key."
|
211
|
+
end
|
212
|
+
|
213
|
+
def run_bundle
|
214
|
+
# Let's not: We'll bundle manually at the right spot
|
215
|
+
end
|
216
|
+
|
217
|
+
protected
|
218
|
+
|
219
|
+
def get_builder_class
|
220
|
+
Suspenders::AppBuilder
|
221
|
+
end
|
222
|
+
|
223
|
+
def using_active_record?
|
224
|
+
!options[:skip_active_record]
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
data/lib/jetfuel.rb
ADDED
data/spec/fakes/bin/hub
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Heroku' do
|
4
|
+
scenario 'Suspend a project with --heroku=true' do
|
5
|
+
run_suspenders('--heroku=true')
|
6
|
+
|
7
|
+
expect(FakeHeroku).to have_gem_included(project_path, 'rails_12factor')
|
8
|
+
expect(FakeHeroku).to have_created_app_for('staging')
|
9
|
+
expect(FakeHeroku).to have_created_app_for('production')
|
10
|
+
expect(FakeHeroku).to have_configured_vars('staging', 'SECRET_KEY_BASE')
|
11
|
+
expect(FakeHeroku).to have_configured_vars('production', 'SECRET_KEY_BASE')
|
12
|
+
|
13
|
+
bin_setup = IO.read("#{project_path}/bin/setup")
|
14
|
+
app_name = SuspendersTestHelpers::APP_NAME
|
15
|
+
|
16
|
+
expect(bin_setup).to include("heroku join --app #{app_name}-staging")
|
17
|
+
expect(bin_setup).to include("heroku join --app #{app_name}-production")
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Suspend a new project with default configuration' do
|
4
|
+
scenario 'specs pass' do
|
5
|
+
run_suspenders
|
6
|
+
|
7
|
+
Dir.chdir(project_path) do
|
8
|
+
Bundler.with_clean_env do
|
9
|
+
expect(`rake`).to include('0 failures')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
scenario 'staging config is inherited from production' do
|
15
|
+
run_suspenders
|
16
|
+
|
17
|
+
staging_file = IO.read("#{project_path}/config/environments/staging.rb")
|
18
|
+
config_stub = "Rails.application.configure do"
|
19
|
+
|
20
|
+
expect(staging_file).to match(/^require_relative 'production'/)
|
21
|
+
expect(staging_file).to match(/#{config_stub}/), staging_file
|
22
|
+
end
|
23
|
+
|
24
|
+
scenario 'generated .ruby-version is pulled from Suspenders .ruby-version' do
|
25
|
+
run_suspenders
|
26
|
+
|
27
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
28
|
+
|
29
|
+
expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
scenario 'secrets.yml reads secret from env' do
|
33
|
+
run_suspenders
|
34
|
+
|
35
|
+
secrets_file = IO.read("#{project_path}/config/secrets.yml")
|
36
|
+
|
37
|
+
expect(secrets_file).to match(/secret_key_base: <%= ENV\['SECRET_KEY_BASE'\] %>/)
|
38
|
+
end
|
39
|
+
|
40
|
+
scenario 'action mailer support file is added' do
|
41
|
+
run_suspenders
|
42
|
+
|
43
|
+
expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
|
44
|
+
end
|
45
|
+
|
46
|
+
scenario 'newrelic.yml reads NewRelic license from env' do
|
47
|
+
run_suspenders
|
48
|
+
|
49
|
+
newrelic_file = IO.read("#{project_path}/config/newrelic.yml")
|
50
|
+
|
51
|
+
expect(newrelic_file).to match(
|
52
|
+
/license_key: '<%= ENV\['NEW_RELIC_LICENSE_KEY'\] %>'/
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
scenario 'records pageviews through Segment.io if ENV variable set' do
|
57
|
+
run_suspenders
|
58
|
+
|
59
|
+
expect(analytics_partial).
|
60
|
+
to include("<% if ENV['SEGMENT_IO_KEY'] %>")
|
61
|
+
expect(analytics_partial).
|
62
|
+
to include("window.analytics.load('<%= ENV['SEGMENT_IO_KEY'] %>');")
|
63
|
+
end
|
64
|
+
|
65
|
+
def analytics_partial
|
66
|
+
IO.read("#{project_path}/app/views/application/_analytics.html.erb")
|
67
|
+
end
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'capybara/rspec'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
Bundler.require(:default, :test)
|
5
|
+
|
6
|
+
require (Pathname.new(__FILE__).dirname + '../lib/jetfuel').expand_path
|
7
|
+
|
8
|
+
Dir['./spec/support/**/*.rb'].each { |file| require file }
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.include JetfuelTestHelpers
|
12
|
+
|
13
|
+
config.before(:all) do
|
14
|
+
create_tmp_directory
|
15
|
+
end
|
16
|
+
|
17
|
+
config.before(:each) do
|
18
|
+
drop_dummy_database
|
19
|
+
remove_project_directory
|
20
|
+
|
21
|
+
FakeHeroku.clear!
|
22
|
+
FakeGithub.clear!
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class FakeGithub
|
2
|
+
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
|
3
|
+
|
4
|
+
def initialize(args)
|
5
|
+
@args = args
|
6
|
+
end
|
7
|
+
|
8
|
+
def run!
|
9
|
+
File.open(RECORDER, 'a') do |file|
|
10
|
+
file.write @args.join(' ')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.clear!
|
15
|
+
FileUtils.rm_rf RECORDER
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.has_created_repo?(repo_name)
|
19
|
+
File.read(RECORDER) == "create #{repo_name}"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class FakeHeroku
|
2
|
+
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
|
3
|
+
|
4
|
+
def initialize(args)
|
5
|
+
@args = args
|
6
|
+
end
|
7
|
+
|
8
|
+
def run!
|
9
|
+
File.open(RECORDER, 'a') do |file|
|
10
|
+
file.puts @args.join(' ')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.clear!
|
15
|
+
FileUtils.rm_rf RECORDER
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.has_gem_included?(project_path, gem_name)
|
19
|
+
gemfile = File.open(File.join(project_path, 'Gemfile'), 'a')
|
20
|
+
|
21
|
+
File.foreach(gemfile).any? do |line|
|
22
|
+
line.match(/#{Regexp.quote(gem_name)}/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.has_created_app_for?(remote_name)
|
27
|
+
app_name = "#{SuspendersTestHelpers::APP_NAME}-#{remote_name}"
|
28
|
+
expected_line = "create #{app_name} --remote=#{remote_name}\n"
|
29
|
+
|
30
|
+
File.foreach(RECORDER).any? { |line| line == expected_line }
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.has_configured_vars?(remote_name, var)
|
34
|
+
File.foreach(RECORDER).any? do |line|
|
35
|
+
line =~ /^config:add #{var}=.+ --remote=#{remote_name}\n$/
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module JetfuelTestHelpers
|
2
|
+
APP_NAME = 'dummy'
|
3
|
+
|
4
|
+
def remove_project_directory
|
5
|
+
FileUtils.rm_rf(project_path)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_tmp_directory
|
9
|
+
FileUtils.mkdir_p(tmp_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_suspenders(arguments = nil)
|
13
|
+
Dir.chdir(tmp_path) do
|
14
|
+
Bundler.with_clean_env do
|
15
|
+
ENV['TESTING'] = '1'
|
16
|
+
|
17
|
+
%x(#{suspenders_bin} #{APP_NAME} #{arguments})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def drop_dummy_database
|
23
|
+
if File.exists?(project_path)
|
24
|
+
Dir.chdir(project_path) do
|
25
|
+
Bundler.with_clean_env do
|
26
|
+
`rake db:drop`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def project_path
|
33
|
+
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def tmp_path
|
39
|
+
@tmp_path ||= Pathname.new("#{root_path}/tmp")
|
40
|
+
end
|
41
|
+
|
42
|
+
def suspenders_bin
|
43
|
+
File.join(root_path, 'bin', 'suspenders')
|
44
|
+
end
|
45
|
+
|
46
|
+
def root_path
|
47
|
+
File.expand_path('../../../', __FILE__)
|
48
|
+
end
|
49
|
+
end
|
data/templates/Brewfile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
ruby '<%= Suspenders::RUBY_VERSION %>'
|
4
|
+
|
5
|
+
gem 'airbrake'
|
6
|
+
gem 'bourbon', '~> 3.2.1'
|
7
|
+
gem 'coffee-rails'
|
8
|
+
gem 'delayed_job_active_record'
|
9
|
+
gem 'email_validator'
|
10
|
+
gem 'flutie'
|
11
|
+
gem 'high_voltage'
|
12
|
+
gem 'jquery-rails'
|
13
|
+
gem 'pg'
|
14
|
+
gem 'rack-timeout'
|
15
|
+
gem 'rails', '<%= Suspenders::RAILS_VERSION %>'
|
16
|
+
gem 'recipient_interceptor'
|
17
|
+
gem 'sass-rails', '~> 4.0.3'
|
18
|
+
gem 'simple_form'
|
19
|
+
gem 'title'
|
20
|
+
gem 'uglifier'
|
21
|
+
gem 'unicorn'
|
22
|
+
gem 'leather'
|
23
|
+
gem 'font-awesome-sass'
|
24
|
+
|
25
|
+
group :development do
|
26
|
+
gem 'foreman'
|
27
|
+
gem 'spring'
|
28
|
+
gem 'spring-commands-rspec'
|
29
|
+
end
|
30
|
+
|
31
|
+
group :development, :test do
|
32
|
+
gem 'awesome_print'
|
33
|
+
gem 'dotenv-rails'
|
34
|
+
gem 'factory_girl_rails'
|
35
|
+
gem 'pry-rails'
|
36
|
+
gem 'rspec-rails', '~> 2.14.0'
|
37
|
+
end
|
38
|
+
|
39
|
+
group :test do
|
40
|
+
gem 'capybara-webkit', '>= 1.0.0'
|
41
|
+
gem 'database_cleaner'
|
42
|
+
gem 'formulaic'
|
43
|
+
gem 'launchy'
|
44
|
+
gem 'shoulda-matchers', require: false
|
45
|
+
gem 'timecop'
|
46
|
+
gem 'webmock'
|
47
|
+
end
|
48
|
+
|
49
|
+
group :staging, :production do
|
50
|
+
gem 'newrelic_rpm', '>= 3.7.3'
|
51
|
+
end
|
data/templates/Procfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= app_name.humanize %>
|
2
|
+
<%= '=' * app_name.humanize.length %>
|
3
|
+
|
4
|
+
Getting Started
|
5
|
+
---------------
|
6
|
+
|
7
|
+
This repository comes equipped with a self-setup script:
|
8
|
+
|
9
|
+
% ./bin/setup
|
10
|
+
|
11
|
+
After setting up, you can run the application using [foreman]:
|
12
|
+
|
13
|
+
% foreman start
|
14
|
+
|
15
|
+
[foreman]: http://ddollar.github.io/foreman/
|
16
|
+
|
17
|
+
Guidelines
|
18
|
+
----------
|
19
|
+
|
20
|
+
Use the following guides for getting things done, programming well, and
|
21
|
+
programming in style.
|
22
|
+
|
23
|
+
* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
|
24
|
+
* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
|
25
|
+
* [Style](http://github.com/thoughtbot/guides/blob/master/style)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if ENV['SEGMENT_IO_KEY'] %>
|
2
|
+
<script type="text/javascript">
|
3
|
+
window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
|
4
|
+
window.analytics.load('<%= ENV['SEGMENT_IO_KEY'] %>');
|
5
|
+
window.analytics.page();
|
6
|
+
</script>
|
7
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% [:notice, :error, :alert].each do |level| %>
|
2
|
+
<% unless flash[level].blank? %>
|
3
|
+
<div class="flash alert alert-<%= flash_class(level) %>">
|
4
|
+
<a class="close" href="#" data-dismiss="alert">×</a>
|
5
|
+
<%= content_tag :p, flash[level] %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BackgroundJobs
|
2
|
+
def run_background_jobs_immediately
|
3
|
+
delay_jobs = Delayed::Worker.delay_jobs
|
4
|
+
Delayed::Worker.delay_jobs = false
|
5
|
+
yield
|
6
|
+
ensure
|
7
|
+
Delayed::Worker.delay_jobs = delay_jobs
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.around(:each, type: :feature) do |example|
|
13
|
+
run_background_jobs_immediately do
|
14
|
+
example.run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
config.include BackgroundJobs
|
19
|
+
end
|
data/templates/bin_setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
|
3
|
+
# Set up Rails app. Run this script immediately after cloning the codebase.
|
4
|
+
# https://github.com/thoughtbot/guides/tree/master/protocol
|
5
|
+
|
6
|
+
# Exit if any subcommand fails
|
7
|
+
set -e
|
8
|
+
|
9
|
+
# Set up Ruby dependencies via Bundler
|
10
|
+
bundle install
|
11
|
+
|
12
|
+
# Set up configurable environment variables
|
13
|
+
if [ ! -f .env ]; then
|
14
|
+
cp .sample.env .env
|
15
|
+
fi
|
16
|
+
|
17
|
+
# Set up database and add any development seed data
|
18
|
+
bundle exec rake dev:prime
|
19
|
+
|
20
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
21
|
+
mkdir -p .git/safe
|
22
|
+
|
23
|
+
# Pick a port for Foreman
|
24
|
+
echo "port: 7000" > .foreman
|
25
|
+
|
26
|
+
# Set up DNS via Pow
|
27
|
+
if [ -d ~/.pow ]
|
28
|
+
then
|
29
|
+
echo 7000 > ~/.pow/`basename $PWD`
|
30
|
+
else
|
31
|
+
echo "Pow not set up but the team uses it for this project. Setup: http://goo.gl/RaDPO"
|
32
|
+
fi
|