laces 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +122 -0
- data/LICENSE +21 -0
- data/README.md +5 -0
- data/Rakefile +8 -0
- data/bin/laces +16 -0
- data/features/creating_a_heroku_app.feature +9 -0
- data/features/rake_clean.feature +21 -0
- data/features/skipping_clearance.feature +13 -0
- data/features/step_definitions/gem_steps.rb +5 -0
- data/features/step_definitions/heroku_steps.rb +3 -0
- data/features/step_definitions/shell_steps.rb +55 -0
- data/features/support/bin/heroku +5 -0
- data/features/support/env.rb +15 -0
- data/features/support/fake_heroku.rb +21 -0
- data/laces-0.0.1.gem +0 -0
- data/laces.gemspec +35 -0
- data/lib/laces/actions.rb +35 -0
- data/lib/laces/app_builder.rb +237 -0
- data/lib/laces/generators/app_generator.rb +111 -0
- data/lib/laces/version.rb +3 -0
- data/templates/.DS_Store +0 -0
- data/templates/Gemfile_template +76 -0
- data/templates/HEROKU_README.md +66 -0
- data/templates/Procfile +1 -0
- data/templates/README.md +81 -0
- data/templates/app/assets/imgs/glyphicons-halflings-white.png +0 -0
- data/templates/app/assets/imgs/glyphicons-halflings.png +0 -0
- data/templates/app/assets/javascripts/admin.coffee +20 -0
- data/templates/app/assets/javascripts/application.coffee +21 -0
- data/templates/app/assets/javascripts/lib/actinology.coffee +47 -0
- data/templates/app/assets/javascripts/lib/analytics.js +11 -0
- data/templates/app/assets/javascripts/lib/auth_token_sync.js +17 -0
- data/templates/app/assets/javascripts/lib/backbone-ui.js +2455 -0
- data/templates/app/assets/javascripts/lib/backbone.coffee +27 -0
- data/templates/app/assets/javascripts/lib/backbone/collection.js +249 -0
- data/templates/app/assets/javascripts/lib/backbone/events.js +64 -0
- data/templates/app/assets/javascripts/lib/backbone/helpers.js +68 -0
- data/templates/app/assets/javascripts/lib/backbone/history.js +144 -0
- data/templates/app/assets/javascripts/lib/backbone/model.js +291 -0
- data/templates/app/assets/javascripts/lib/backbone/router.coffee +45 -0
- data/templates/app/assets/javascripts/lib/backbone/sync.coffee +38 -0
- data/templates/app/assets/javascripts/lib/backbone/view.js +150 -0
- data/templates/app/assets/javascripts/lib/backbone_extended.coffee +276 -0
- data/templates/app/assets/javascripts/lib/bootstrap.js +1836 -0
- data/templates/app/assets/javascripts/lib/inflection.js +658 -0
- data/templates/app/assets/javascripts/lib/jquery-ui.js +343 -0
- data/templates/app/assets/javascripts/lib/jquery.hotkeys.js +102 -0
- data/templates/app/assets/javascripts/lib/jquery.js +4 -0
- data/templates/app/assets/javascripts/lib/milk.js.coffee +265 -0
- data/templates/app/assets/javascripts/lib/raw.js +143 -0
- data/templates/app/assets/javascripts/lib/strftime.js +732 -0
- data/templates/app/assets/javascripts/lib/throttle-debounce.js +251 -0
- data/templates/app/assets/javascripts/lib/timeago.js +148 -0
- data/templates/app/assets/javascripts/lib/underscore.js +28 -0
- data/templates/app/assets/styles/application.sass +21 -0
- data/templates/app/assets/styles/layouts/default.sass +15 -0
- data/templates/app/assets/styles/layouts/footer.sass +0 -0
- data/templates/app/assets/styles/layouts/forms.sass +34 -0
- data/templates/app/assets/styles/layouts/header.sass +0 -0
- data/templates/app/assets/styles/layouts/navigation.sass +0 -0
- data/templates/app/assets/styles/lib/backbone-ui.css +580 -0
- data/templates/app/assets/styles/lib/bootstrap.sass +4248 -0
- data/templates/app/assets/styles/pages/home.sass +0 -0
- data/templates/app/assets/styles/sessions/new.sass +0 -0
- data/templates/app/assets/styles/users/activate.sass +0 -0
- data/templates/app/assets/styles/users/new.sass +0 -0
- data/templates/app/assets/styles/users/suspended.sass +0 -0
- data/templates/app/controllers/app_controller.rb +14 -0
- data/templates/app/controllers/pages_controller.rb +2 -0
- data/templates/app/controllers/sessions_controller.rb +2 -0
- data/templates/app/controllers/templating_controller.rb +31 -0
- data/templates/app/controllers/users_controller.rb +2 -0
- data/templates/app/helpers/app_helper.rb +94 -0
- data/templates/app/helpers/users_helper.rb +53 -0
- data/templates/app/models/user.rb +9 -0
- data/templates/app/views/devise/confirmations/new.haml +9 -0
- data/templates/app/views/devise/passwords/edit.haml +11 -0
- data/templates/app/views/devise/passwords/new.haml +9 -0
- data/templates/app/views/devise/registrations/edit.haml +13 -0
- data/templates/app/views/devise/registrations/new.haml +8 -0
- data/templates/app/views/devise/sessions/_form.haml +7 -0
- data/templates/app/views/devise/sessions/new.haml +5 -0
- data/templates/app/views/devise/unlocks/new.haml +7 -0
- data/templates/app/views/layouts/_ascii.haml +0 -0
- data/templates/app/views/layouts/_column.haml +0 -0
- data/templates/app/views/layouts/_content.haml +1 -0
- data/templates/app/views/layouts/_extra.haml +0 -0
- data/templates/app/views/layouts/_footer.haml +9 -0
- data/templates/app/views/layouts/_head.haml +13 -0
- data/templates/app/views/layouts/_header.haml +6 -0
- data/templates/app/views/layouts/application.html.haml +16 -0
- data/templates/app/views/pages/home.haml +1 -0
- data/templates/config/app.yml +29 -0
- data/templates/config/application.erb +28 -0
- data/templates/config/database.yml +32 -0
- data/templates/config/initializers/devise.rb +232 -0
- data/templates/config/initializers/rabl_init.rb +4 -0
- data/templates/config/initializers/setup_mail.rb +13 -0
- data/templates/config/initializers/wrap_parameters.rb +12 -0
- data/templates/db/migrate/user_migration.rb +36 -0
- data/templates/laces_gitignore +9 -0
- data/templates/lib/development_mail_interceptor.rb +7 -0
- data/templates/lib/templating.rb +40 -0
- metadata +225 -0
@@ -0,0 +1,237 @@
|
|
1
|
+
require 'artii'
|
2
|
+
|
3
|
+
module Laces
|
4
|
+
class AppBuilder < Rails::AppBuilder
|
5
|
+
include Laces::Actions
|
6
|
+
|
7
|
+
def readme
|
8
|
+
copy_file 'README.md'
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_public_index
|
12
|
+
remove_file 'public/index.html'
|
13
|
+
end
|
14
|
+
|
15
|
+
def remove_public_images_rails
|
16
|
+
remove_file 'public/images/rails.png'
|
17
|
+
end
|
18
|
+
|
19
|
+
def raise_delivery_errors
|
20
|
+
replace_in_file 'config/environments/development.rb', 'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_staging_environment
|
24
|
+
run 'cp config/environments/production.rb config/environments/staging.rb'
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_views_shared
|
28
|
+
empty_directory 'app/views/shared'
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_js_directories
|
32
|
+
name = 'app/assets/javascripts'
|
33
|
+
remove_file "#{name}/application.js"
|
34
|
+
copy_file "#{name}/application.coffee"
|
35
|
+
copy_file "#{name}/admin.coffee"
|
36
|
+
empty_directory "#{name}/routers"
|
37
|
+
empty_directory "#{name}/views"
|
38
|
+
empty_directory "#{name}/views/shared"
|
39
|
+
empty_directory "#{name}/collections"
|
40
|
+
empty_directory "#{name}/helpers"
|
41
|
+
empty_directory "#{name}/models"
|
42
|
+
empty_directory "#{name}/lib"
|
43
|
+
directory "#{name}/lib", "#{name}/lib"
|
44
|
+
empty_directory "#{name}/admin"
|
45
|
+
empty_directory "#{name}/admin/routers"
|
46
|
+
empty_directory "#{name}/admin/views"
|
47
|
+
empty_directory "#{name}/views/shared"
|
48
|
+
empty_directory "#{name}/admin/collections"
|
49
|
+
empty_directory "#{name}/admin/models"
|
50
|
+
empty_directory "#{name}/admin/helpers"
|
51
|
+
empty_directory "#{name}/admin/lib"
|
52
|
+
end
|
53
|
+
|
54
|
+
def replace_application_controller
|
55
|
+
name = 'app/controllers/application_controller.rb'
|
56
|
+
remove_file name
|
57
|
+
copy_file 'app/controllers/app_controller.rb', name
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_application_layout
|
61
|
+
name = 'app/views/layouts'
|
62
|
+
remove_file "#{name}/application.html.erb"
|
63
|
+
template "#{name}/application.html.haml"
|
64
|
+
template "#{name}/_head.haml"
|
65
|
+
template "#{name}/_header.haml"
|
66
|
+
copy_file "#{name}/_content.haml"
|
67
|
+
copy_file "#{name}/_column.haml"
|
68
|
+
copy_file "#{name}/_extra.haml"
|
69
|
+
template "#{name}/_footer.haml"
|
70
|
+
|
71
|
+
art = Artii::Base.new :font => 'slant'
|
72
|
+
art = art.asciify app_name.classify
|
73
|
+
art = "<!--\n#{art}\n-->"
|
74
|
+
create_file "#{name}/_ascii.erb", art
|
75
|
+
end
|
76
|
+
|
77
|
+
def use_mysql_config_template
|
78
|
+
name = 'config/database.yml'
|
79
|
+
remove_file name
|
80
|
+
template name
|
81
|
+
create_file 'app/assets/javascripts/template.js'
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_database
|
85
|
+
bundle_command 'exec rake db:create'
|
86
|
+
end
|
87
|
+
|
88
|
+
def replaced_gemfile
|
89
|
+
remove_file 'Gemfile'
|
90
|
+
copy_file 'Gemfile_template', 'Gemfile'
|
91
|
+
end
|
92
|
+
|
93
|
+
def generate_rspec
|
94
|
+
generate 'rspec:install'
|
95
|
+
replace_in_file 'spec/spec_helper.rb', '# config.mock_with :mocha', 'config.mock_with :mocha'
|
96
|
+
end
|
97
|
+
|
98
|
+
def generate_cucumber
|
99
|
+
generate 'cucumber:install', '--rspec', '--capybara'
|
100
|
+
inject_into_file 'features/support/env.rb',
|
101
|
+
%{Capybara.save_and_open_page_path = 'tmp'\n} +
|
102
|
+
%{Capybara.javascript_driver = :webkit\n},
|
103
|
+
:before => %{Capybara.default_selector = :css}
|
104
|
+
end
|
105
|
+
|
106
|
+
def setup_stylesheets
|
107
|
+
remove_dir 'app/assets/stylesheets'
|
108
|
+
directory 'app/assets/styles', 'app/assets/stylesheets'
|
109
|
+
end
|
110
|
+
|
111
|
+
def gitignore_files
|
112
|
+
concat_file 'laces_gitignore', '.gitignore'
|
113
|
+
dirs = %w{
|
114
|
+
app/models
|
115
|
+
db/migrate
|
116
|
+
log
|
117
|
+
public/images
|
118
|
+
spec/support
|
119
|
+
spec/lib
|
120
|
+
spec/models
|
121
|
+
spec/views
|
122
|
+
spec/controllers
|
123
|
+
spec/helpers
|
124
|
+
spec/support/matchers
|
125
|
+
spec/support/mixins
|
126
|
+
spec/support/shared_examples}
|
127
|
+
dirs.each{|dir| empty_directory_with_gitkeep(dir) }
|
128
|
+
end
|
129
|
+
|
130
|
+
def init_git
|
131
|
+
run 'git init'
|
132
|
+
run 'git add -A .'
|
133
|
+
run "git commit -m 'Initial commit - suspended project'"
|
134
|
+
end
|
135
|
+
|
136
|
+
def create_heroku_apps
|
137
|
+
path_additions = ''
|
138
|
+
if ENV['TESTING']
|
139
|
+
support_bin = File.expand_path(File.join('..', '..', '..', 'features', 'support', 'bin'))
|
140
|
+
path_addition = "PATH=#{support_bin}:$PATH"
|
141
|
+
end
|
142
|
+
name = "#{path_addition} heroku create #{app_name}"
|
143
|
+
run "#{name}-production --remote=production --stack=cedar"
|
144
|
+
run "#{name}-staging --remote=staging --stack=cedar"
|
145
|
+
end
|
146
|
+
|
147
|
+
def document_heroku
|
148
|
+
heroku_readme_path = find_in_source_paths 'HEROKU_README.md'
|
149
|
+
documentation = File.open(heroku_readme_path).read
|
150
|
+
inject_into_file 'README.md', "#{documentation}\n", :before => 'Most importantly'
|
151
|
+
end
|
152
|
+
|
153
|
+
def copy_misc_files
|
154
|
+
copy_file 'Procfile'
|
155
|
+
end
|
156
|
+
|
157
|
+
def setup_root_route
|
158
|
+
route "root :to => 'pages#home'"
|
159
|
+
end
|
160
|
+
|
161
|
+
def setup_default_rake_task
|
162
|
+
append_file "Rakefile" do
|
163
|
+
"task(:default).clear\ntask :default => [:spec, :cucumber]"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def api_directory
|
168
|
+
empty_directory 'app/controllers/api'
|
169
|
+
end
|
170
|
+
|
171
|
+
def generate_devise
|
172
|
+
generate 'devise:install'
|
173
|
+
generate 'devise user'
|
174
|
+
|
175
|
+
name = 'app/models/user.rb'
|
176
|
+
remove_file name
|
177
|
+
copy_file name
|
178
|
+
|
179
|
+
dir = destination_root()
|
180
|
+
dir = "#{dir}/db/migrate"
|
181
|
+
files = Dir.entries dir
|
182
|
+
file = files.grep /devise_create_users.rb/
|
183
|
+
file = file.first
|
184
|
+
|
185
|
+
remove_file "db/migrate/#{file}"
|
186
|
+
copy_file 'db/migrate/user_migration.rb', "db/migrate/#{file}"
|
187
|
+
|
188
|
+
directory 'app/views/devise', 'app/views/users'
|
189
|
+
copy_file 'app/helpers/users_helper.rb'
|
190
|
+
end
|
191
|
+
|
192
|
+
def replace_application
|
193
|
+
name = 'config/application.rb'
|
194
|
+
remove_file name
|
195
|
+
template 'config/application.erb', name
|
196
|
+
end
|
197
|
+
|
198
|
+
def add_config_file
|
199
|
+
copy_file 'config/app.yml'
|
200
|
+
end
|
201
|
+
|
202
|
+
def add_templating
|
203
|
+
copy_file 'app/controllers/templating_controller.rb'
|
204
|
+
copy_file 'lib/templating.rb'
|
205
|
+
create_file 'config/templating.yml'
|
206
|
+
end
|
207
|
+
|
208
|
+
def intializer_files
|
209
|
+
copy_file 'config/initializers/rabl_init.rb'
|
210
|
+
name = 'config/initializers/devise.rb'
|
211
|
+
remove_file name
|
212
|
+
copy_file name
|
213
|
+
end
|
214
|
+
|
215
|
+
def add_images
|
216
|
+
remove_dir 'app/assets/images'
|
217
|
+
directory 'app/assets/imgs', 'app/assets/images'
|
218
|
+
end
|
219
|
+
|
220
|
+
def add_application_helper
|
221
|
+
name = 'app/helpers/application_helper.rb'
|
222
|
+
remove_file name
|
223
|
+
copy_file 'app/helpers/app_helper.rb', name
|
224
|
+
end
|
225
|
+
|
226
|
+
def add_pages_controller_and_home
|
227
|
+
copy_file 'app/controllers/pages_controller.rb'
|
228
|
+
directory 'app/views/pages'
|
229
|
+
end
|
230
|
+
|
231
|
+
def setup_mail
|
232
|
+
copy_file 'config/initializers/setup_mail.rb'
|
233
|
+
copy_file 'lib/development_mail_interceptor.rb'
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Laces
|
5
|
+
class Generator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database , type: :string , aliases: '-d', default: 'mysql', desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
7
|
+
class_option :skip_test_unit, type: :boolean, aliases: '-T', default: true , desc: 'Skip Test::Unit files'
|
8
|
+
class_option :heroku , type: :boolean, aliases: '-H', default: false , desc: 'Create staging and production heroku apps'
|
9
|
+
|
10
|
+
def finish_template
|
11
|
+
invoke :laces_customization
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def laces_customization
|
16
|
+
say "Remove files we don't need"
|
17
|
+
build :remove_public_index
|
18
|
+
build :remove_public_images_rails
|
19
|
+
|
20
|
+
say 'Setting up the development environment'
|
21
|
+
build :raise_delivery_errors
|
22
|
+
|
23
|
+
say 'Setting up the staging environment'
|
24
|
+
build :setup_staging_environment
|
25
|
+
|
26
|
+
say 'Creating laces views'
|
27
|
+
build :create_views_shared
|
28
|
+
build :create_application_layout
|
29
|
+
|
30
|
+
say 'Create javascript directories'
|
31
|
+
build :create_js_directories
|
32
|
+
|
33
|
+
say 'Replace Gemfile'
|
34
|
+
build :replaced_gemfile
|
35
|
+
bundle_command 'install'
|
36
|
+
|
37
|
+
say 'Setting up database'
|
38
|
+
build :use_mysql_config_template if 'mysql' == options[:database]
|
39
|
+
build :create_database
|
40
|
+
|
41
|
+
say 'Configuring app'
|
42
|
+
build :generate_cucumber
|
43
|
+
build :setup_default_rake_task
|
44
|
+
|
45
|
+
say 'Copying miscellaneous support files'
|
46
|
+
build :copy_misc_files
|
47
|
+
|
48
|
+
say 'Setting up a root route'
|
49
|
+
build :setup_root_route
|
50
|
+
|
51
|
+
say 'Initializing git and initial commit'
|
52
|
+
build :gitignore_files
|
53
|
+
build :init_git
|
54
|
+
|
55
|
+
say 'Setup api directory'
|
56
|
+
build :api_directory
|
57
|
+
|
58
|
+
say 'Generate devise user model'
|
59
|
+
build :generate_devise
|
60
|
+
|
61
|
+
say 'Replace application.rb'
|
62
|
+
build :replace_application
|
63
|
+
|
64
|
+
say 'Replace application_controller.rb'
|
65
|
+
build :replace_application_controller
|
66
|
+
|
67
|
+
build :replace_application
|
68
|
+
say 'Add config file'
|
69
|
+
build :add_config_file
|
70
|
+
|
71
|
+
say 'Add initializer files'
|
72
|
+
build :intializer_files
|
73
|
+
|
74
|
+
say 'Setup Mailing'
|
75
|
+
build :setup_mail
|
76
|
+
|
77
|
+
say 'Add templating'
|
78
|
+
build :add_templating
|
79
|
+
|
80
|
+
if options['heroku']
|
81
|
+
say "Creating heroku apps"
|
82
|
+
build :create_heroku_apps
|
83
|
+
build :document_heroku
|
84
|
+
end
|
85
|
+
|
86
|
+
say 'Add application helper'
|
87
|
+
build :add_application_helper
|
88
|
+
|
89
|
+
say 'home page'
|
90
|
+
build :add_pages_controller_and_home
|
91
|
+
|
92
|
+
say 'Set up stylesheets'
|
93
|
+
build :setup_stylesheets
|
94
|
+
|
95
|
+
say 'Add images'
|
96
|
+
build :add_images
|
97
|
+
|
98
|
+
say 'Congratulations! You just tied our laces.'
|
99
|
+
say "Remember to run 'rails generate airbrake' with your API key."
|
100
|
+
end
|
101
|
+
|
102
|
+
protected
|
103
|
+
def get_builder_class
|
104
|
+
Laces::AppBuilder
|
105
|
+
end
|
106
|
+
|
107
|
+
def using_active_record?
|
108
|
+
!options[:skip_active_record]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/templates/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,76 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
gem 'rails' , '3.2.3'
|
3
|
+
|
4
|
+
gem 'mysql2'
|
5
|
+
gem 'choices'
|
6
|
+
gem 'paperclip'
|
7
|
+
gem 'airbrake'
|
8
|
+
gem 'rabl'
|
9
|
+
gem 'haml'
|
10
|
+
|
11
|
+
gem 'devise'
|
12
|
+
gem 'cantango'
|
13
|
+
gem 'troles'
|
14
|
+
|
15
|
+
gem 'jenny', git: 'https://github.com/omenking/jenny'
|
16
|
+
|
17
|
+
#gem 'activemerchant', :require => 'active_merchant'
|
18
|
+
#gem 'sunspot_rails'
|
19
|
+
#gem 'progress_bar'
|
20
|
+
#gem 'sunspot_solr'
|
21
|
+
#gem 'backup'
|
22
|
+
#gem 'fog'
|
23
|
+
#gem 'foreman'
|
24
|
+
#gem 'redis'
|
25
|
+
#gem 'resque', require: 'resque/server', git: 'git://github.com/defunkt/resque.git'
|
26
|
+
|
27
|
+
group :assets do
|
28
|
+
gem 'sass-rails' , '~> 3.2.3'
|
29
|
+
gem 'coffee-rails', '~> 3.2.1'
|
30
|
+
gem 'uglifier' , '>= 1.0.3'
|
31
|
+
gem 'compass-rails'
|
32
|
+
end
|
33
|
+
|
34
|
+
group :staging, :production do
|
35
|
+
gem 'newrelic_rpm'
|
36
|
+
end
|
37
|
+
|
38
|
+
group :development do
|
39
|
+
gem 'ruby-debug19'
|
40
|
+
gem 'capistrano'
|
41
|
+
gem 'mongrel', '1.2.0.pre2'
|
42
|
+
gem 'ruby-prof'
|
43
|
+
|
44
|
+
gem 'guard'
|
45
|
+
gem 'guard-rails'
|
46
|
+
gem 'guard-livereload'
|
47
|
+
gem 'guard-spork'
|
48
|
+
gem 'guard-rake'
|
49
|
+
gem 'guard-rspec'
|
50
|
+
gem 'guard-annotate'
|
51
|
+
|
52
|
+
#gem 'heroku'
|
53
|
+
|
54
|
+
# for OS X
|
55
|
+
# gem 'rb-fsevent'
|
56
|
+
# gem 'growl'
|
57
|
+
# for Linux
|
58
|
+
#gem 'rb-inotify'
|
59
|
+
#gem 'libnotify'
|
60
|
+
end
|
61
|
+
|
62
|
+
group :test do
|
63
|
+
gem 'sham_rack'
|
64
|
+
gem 'multi_json'
|
65
|
+
gem 'launchy'
|
66
|
+
gem 'rspec-rails'
|
67
|
+
gem 'database_cleaner'
|
68
|
+
gem 'factory_girl_rails'
|
69
|
+
gem 'capybara'
|
70
|
+
gem 'capybara-webkit'
|
71
|
+
gem 'spork'
|
72
|
+
gem 'cucumber-rails'
|
73
|
+
gem 'sunspot_test'
|
74
|
+
gem 'shoulda-matchers'
|
75
|
+
gem 'rspec-rails-mocha', '~> 0.3.1', :require => false
|
76
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
Staging and production environments
|
2
|
+
-----------------------------------
|
3
|
+
|
4
|
+
We're using Heroku as a hosting provider. Deploying to Heroku is done via git. So, set up your git remotes for each environment:
|
5
|
+
|
6
|
+
git remote add staging git@heroku.com:your-app-staging.git
|
7
|
+
git remote add production git@heroku.com:your-app-production.git
|
8
|
+
|
9
|
+
Heroku
|
10
|
+
------
|
11
|
+
|
12
|
+
The following are mostly aliases from the `dotfiles` script.
|
13
|
+
|
14
|
+
To access your code on Heroku:
|
15
|
+
|
16
|
+
staging
|
17
|
+
production
|
18
|
+
|
19
|
+
That will drop you into a Rails console for either environment. You can run ActiveRecord queries from there.
|
20
|
+
|
21
|
+
To dump staging or production data into your development environment:
|
22
|
+
|
23
|
+
db-pull-staging
|
24
|
+
db-pull-production
|
25
|
+
|
26
|
+
You will see progress bars for each db index and table.
|
27
|
+
|
28
|
+
We can create a database backup at any time:
|
29
|
+
|
30
|
+
db-backup-production
|
31
|
+
|
32
|
+
View backups:
|
33
|
+
|
34
|
+
db-backups
|
35
|
+
|
36
|
+
To destroy a backup:
|
37
|
+
|
38
|
+
heroku pgbackups:destroy b003 --remote production
|
39
|
+
|
40
|
+
Transfer production data to staging:
|
41
|
+
|
42
|
+
db-copy-production-to-staging
|
43
|
+
|
44
|
+
More information in the [Dev Center](http://devcenter.heroku.com/articles/pgbackups).
|
45
|
+
|
46
|
+
To check the status of running app servers, background jobs, cron jobs, etc:
|
47
|
+
|
48
|
+
staging-process
|
49
|
+
production-process
|
50
|
+
|
51
|
+
To see the performance of the staging application, see:
|
52
|
+
|
53
|
+
https://heroku.newrelic.com/...
|
54
|
+
|
55
|
+
To see the performance of the production application, see:
|
56
|
+
|
57
|
+
https://heroku.newrelic.com/...
|
58
|
+
|
59
|
+
ENV variables
|
60
|
+
-------------
|
61
|
+
|
62
|
+
ENV variables like AWS keys should not be in the source code. They are configuration and should be stored as ENV variables. On Heroku, they are called "config variables." You can pull config variables using the `heroku-config` plugin that comes with the `laptop` script:
|
63
|
+
|
64
|
+
heroku config:pull --remote staging
|
65
|
+
|
66
|
+
You'll see the Amazon credentials as config vars. You should delete lines that don't apply, like Redis to Go connection strings.
|