pah 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -1
- data/lib/pah/files/.ruby-gemset +1 -0
- data/lib/pah/files/.ruby-version +1 -0
- data/lib/pah/files/Gemfile +3 -4
- data/lib/pah/files/app/views/layouts/application.html.haml +1 -1
- data/lib/pah/files/lib/tasks/deploy.rake +108 -0
- data/lib/pah/files/lib/tasks/integration.rake +32 -13
- data/lib/pah/files/spec/spec_helper.rb +3 -1
- data/lib/pah/partials/_default.rb +2 -11
- data/lib/pah/partials/_heroku.rb +107 -39
- data/lib/pah/partials/_integration.rb +5 -3
- data/lib/pah/partials/_rvm.rb +8 -5
- data/lib/pah/partials/_secret_token.rb +14 -0
- data/lib/pah/template.rb +1 -0
- data/lib/pah/version.rb +1 -1
- metadata +8 -5
- data/.rvmrc +0 -1
- data/lib/pah/files/.rvmrc +0 -50
- data/lib/pah/files/lib/tasks/tasks.rake +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4765a78110c43c30419c4663a9c43c9cb39d0d3
|
4
|
+
data.tar.gz: 30acee7235a0f5efccbefa417e24bcd56f86e61c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57e830716b36d43599f7e98d3f4777a2fdea3cf105f7204599de93a829e4b16f7452ca4d4d30e49f9ab7fb971a7d279db72909106b66c1f3cf79d49dca74b4e1
|
7
|
+
data.tar.gz: 88ec45c1e765d69e346f620caf9e983d5e09ece3b5da7e8b80f2ff00b483ab2d2ab7645788993ec7aecc85f4c7c6ae9f94f5b9283e211a36631c8bd02dbacc5b
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pah
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 0.0.7 (
|
3
|
+
## 0.0.7 (October 11, 2013)
|
4
4
|
|
5
5
|
### features
|
6
6
|
|
7
7
|
### improvements
|
8
8
|
|
9
|
+
- use environment variable to define secret_token and secret_key_base
|
10
|
+
- complete refactor of Heroku app creation and configuration
|
11
|
+
- ask for user credentials before creating the Heroku app
|
12
|
+
- set the correct timezone config on heroku after creating the app
|
13
|
+
- move RVM config from .rvmrc to .ruby-version and .ruby-gemset files
|
14
|
+
- refactor `integration.rake` and `deploy.rake` to handle projects with staging and production apps
|
15
|
+
|
9
16
|
### bug fixes
|
10
17
|
|
18
|
+
- don't break if you choose an already taken name for your Heroku app
|
19
|
+
- remove the `root_url` from application.html.haml since there's no default `root_url`
|
20
|
+
- remove duplicated gems (foreman and letter_opener) from the default Gemfile
|
21
|
+
- remove the deleted shoulda_matcher branch. Locked in 2.4.0 version
|
22
|
+
|
11
23
|
## 0.0.6 (August 16, 2013)
|
12
24
|
|
13
25
|
### features
|
@@ -0,0 +1 @@
|
|
1
|
+
GEMSET
|
@@ -0,0 +1 @@
|
|
1
|
+
RUBY_VERSION
|
data/lib/pah/files/Gemfile
CHANGED
@@ -25,19 +25,18 @@ gem "rails_12factor", "0.0.2", group: :production
|
|
25
25
|
# gem 'acts_as_hashed', '1.0.0'
|
26
26
|
|
27
27
|
group :development do
|
28
|
-
gem "letter_opener", '1.1.1'
|
29
28
|
gem 'foreman', '0.63.0'
|
30
29
|
gem 'jumpup', '0.0.1'
|
31
30
|
gem 'better_errors', '0.9.0'
|
32
31
|
gem 'binding_of_caller', '0.7.2'
|
33
32
|
gem "letter_opener", '1.1.1'
|
34
|
-
|
33
|
+
gem "colored", '1.2', require: false
|
35
34
|
# gem 'guard-rspec', '3.0.2'
|
36
35
|
end
|
37
36
|
|
38
37
|
group :test do
|
39
38
|
# See https://github.com/thoughtbot/shoulda-matchers/issues/270
|
40
|
-
gem "shoulda-matchers",
|
39
|
+
gem "shoulda-matchers", '2.4.0'
|
41
40
|
gem 'simplecov', '0.7.1', require: false
|
42
41
|
gem 'email_spec', '1.4.0'
|
43
42
|
gem 'capybara', '2.1.0'
|
@@ -50,7 +49,7 @@ group :development, :test do
|
|
50
49
|
gem 'rspec-rails', '2.13.2'
|
51
50
|
gem 'factory_girl_rails', '4.2.1'
|
52
51
|
gem 'pry-rails', '0.3.1'
|
53
|
-
gem 'dotenv-rails', '0.
|
52
|
+
gem 'dotenv-rails', '0.9.0'
|
54
53
|
gem 'awesome_print', '1.1.0'
|
55
54
|
end
|
56
55
|
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'colored' if Rails.env.development?
|
2
|
+
|
3
|
+
def run_with_clean_env(command, capture_output=false)
|
4
|
+
Bundler.with_clean_env { capture_output ? `#{command}` : sh(command) }
|
5
|
+
end
|
6
|
+
|
7
|
+
def confirm(message)
|
8
|
+
print "\n#{message}\nAre you sure? [yN] "
|
9
|
+
raise 'Ok. Bye...' unless STDIN.gets.chomp.downcase == 'y'
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :heroku do
|
13
|
+
PRODUCTION_APP = ENV['PRODUCTION_APP'] || ENV['APP']
|
14
|
+
STAGING_APP = ENV['STAGING_APP'] || ENV['APP']
|
15
|
+
|
16
|
+
def has_database?(app)
|
17
|
+
database_url = run_with_clean_env("heroku config -s --app #{app} | grep DATABASE_URL", true).strip
|
18
|
+
not database_url.blank?
|
19
|
+
end
|
20
|
+
|
21
|
+
def backup(app)
|
22
|
+
return unless has_database?(app)
|
23
|
+
puts "--> Backing up database via Heroku".magenta
|
24
|
+
run_with_clean_env("heroku pgbackups:capture --expire --app #{app}")
|
25
|
+
end
|
26
|
+
|
27
|
+
def migrate(app)
|
28
|
+
puts "--> Migrating".magenta
|
29
|
+
run_with_clean_env("heroku run rake db:migrate --app #{app}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def seed(app)
|
33
|
+
return unless has_database?(app)
|
34
|
+
puts "--> Seeding".magenta
|
35
|
+
run_with_clean_env("heroku run rake db:seed --app #{app}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def restart(app)
|
39
|
+
puts "--> Restarting".magenta
|
40
|
+
run_with_clean_env("heroku restart --app #{app}")
|
41
|
+
end
|
42
|
+
|
43
|
+
namespace :deploy do
|
44
|
+
|
45
|
+
desc "Deploy to staging"
|
46
|
+
task :staging do
|
47
|
+
APP = STAGING_APP
|
48
|
+
|
49
|
+
backup(APP) if ENV['SKIP_BACKUP'] != "true"
|
50
|
+
|
51
|
+
puts "--> Pushing".magenta
|
52
|
+
run_with_clean_env("git push git@heroku.com:#{APP}.git HEAD:master --force")
|
53
|
+
|
54
|
+
migrate(APP)
|
55
|
+
seed(APP)
|
56
|
+
restart(APP)
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Deploy to production"
|
60
|
+
task :production do
|
61
|
+
# This constant is defined to avoid problemd of copying and pasting from one environment to another
|
62
|
+
APP = PRODUCTION_APP
|
63
|
+
|
64
|
+
confirm("Going deploy to production...".red)
|
65
|
+
|
66
|
+
if ENV['SKIP_TESTS'] != "true"
|
67
|
+
puts "--> Running all specs".magenta
|
68
|
+
Rake::Task['spec'].invoke
|
69
|
+
end
|
70
|
+
|
71
|
+
print "\nPut #{APP} in maintenance mode? [Yn] ".red
|
72
|
+
maintenance = (ENV['MAINTENANCE'] == "true" or (STDIN.gets.chomp.downcase == 'y'))
|
73
|
+
|
74
|
+
if maintenance
|
75
|
+
puts "--> Setting Maintenance on".magenta
|
76
|
+
run_with_clean_env("heroku maintenance:on --app #{APP}")
|
77
|
+
|
78
|
+
puts "--> Restarting".magenta
|
79
|
+
run_with_clean_env("heroku restart --app #{APP}")
|
80
|
+
|
81
|
+
puts "--> Waiting 20 seconds to app come back (in maintenance mode)".magenta
|
82
|
+
sleep(20)
|
83
|
+
end
|
84
|
+
|
85
|
+
backup(APP) if ENV['SKIP_BACKUP'] != "true"
|
86
|
+
|
87
|
+
iso_date = Time.now.strftime('%Y-%m-%dT%H%M%S')
|
88
|
+
tag_name = "production-#{iso_date}"
|
89
|
+
|
90
|
+
puts "--> Tagging as #{tag_name}".magenta
|
91
|
+
run_with_clean_env("git tag #{tag_name} master")
|
92
|
+
|
93
|
+
puts "--> Pushing".magenta
|
94
|
+
run_with_clean_env("git push origin #{tag_name}")
|
95
|
+
run_with_clean_env("git push git@heroku.com:#{APP}.git #{tag_name}:master --force")
|
96
|
+
|
97
|
+
migrate(APP)
|
98
|
+
seed(APP)
|
99
|
+
|
100
|
+
if maintenance
|
101
|
+
puts "Setting Maintenance off".magenta
|
102
|
+
run_with_clean_env("heroku maintenance:off --app #{APP}")
|
103
|
+
end
|
104
|
+
|
105
|
+
restart(APP)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -1,29 +1,48 @@
|
|
1
|
-
|
1
|
+
require 'colored' if Rails.env.development?
|
2
|
+
|
3
|
+
def run_with_clean_env(command, capture_output=false)
|
4
|
+
Bundler.with_clean_env { capture_output ? `#{command}` : sh(command) }
|
5
|
+
end
|
2
6
|
|
3
7
|
namespace :integration do
|
4
|
-
APP = ENV['
|
8
|
+
APP = ENV['STAGING_APP'] || ENV['APP']
|
9
|
+
USER = run_with_clean_env("git config --get user.name", true).strip
|
5
10
|
|
6
11
|
namespace :heroku do
|
12
|
+
|
13
|
+
desc "Add Heroku git remotes"
|
7
14
|
task :add_remote do
|
8
|
-
|
9
|
-
|
15
|
+
puts "--> Adding Heroku git remotes for app #{APP}".magenta
|
16
|
+
|
17
|
+
remote = run_with_clean_env("git remote | grep heroku", true).strip
|
18
|
+
run_with_clean_env("git remote add heroku git@heroku.com:#{APP}.git") if remote.blank?
|
10
19
|
end
|
11
20
|
|
21
|
+
desc "Check if there's someone else integrating the project"
|
12
22
|
task :check do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
23
|
+
puts "--> Checking if there's already someone integrating to #{APP}".magenta
|
24
|
+
|
25
|
+
var = run_with_clean_env("heroku config -s --app #{APP} | grep INTEGRATING_BY", true).strip
|
26
|
+
integrating_by = var.split('=')[1]
|
27
|
+
|
28
|
+
integrating_by.strip! unless integrating_by.blank?
|
29
|
+
|
30
|
+
if integrating_by != USER and not integrating_by.blank?
|
31
|
+
puts "--> Project is already being integrated by '#{integrating_by}', halting"
|
18
32
|
exit
|
19
33
|
end
|
20
34
|
end
|
35
|
+
|
36
|
+
desc "Lock the Heroku integration"
|
21
37
|
task :lock do
|
22
|
-
|
23
|
-
|
38
|
+
puts "--> Locking Heroku integration for you (#{USER})".magenta
|
39
|
+
run_with_clean_env("heroku config:set INTEGRATING_BY='#{USER}' --app #{APP}")
|
24
40
|
end
|
41
|
+
|
42
|
+
desc "Unlock the Heroku integration"
|
25
43
|
task :unlock do
|
26
|
-
|
44
|
+
puts "--> Unlocking Heroku integration".magenta
|
45
|
+
run_with_clean_env("heroku config:unset INTEGRATING_BY --app #{APP}")
|
27
46
|
end
|
28
47
|
end
|
29
48
|
end
|
@@ -38,6 +57,6 @@ INTEGRATION_TASKS = %w(
|
|
38
57
|
spec
|
39
58
|
integration:coverage_verify
|
40
59
|
integration:finish
|
41
|
-
heroku:deploy
|
60
|
+
heroku:deploy:staging
|
42
61
|
integration:heroku:unlock
|
43
62
|
)
|
@@ -6,20 +6,11 @@ copy_static_file 'app/views/application/_error_messages.html.haml'
|
|
6
6
|
copy_static_file 'app/views/application/_flash_messages.html.haml'
|
7
7
|
copy_static_file 'config/unicorn.rb'
|
8
8
|
copy_static_file 'Procfile'
|
9
|
-
copy_static_file "lib/tasks/integration.rake"
|
10
|
-
|
11
9
|
copy_static_file 'config/locales/pt-BR.yml'
|
12
|
-
|
13
|
-
gsub_file 'lib/tasks/integration.rake', /PROJECT/, @app_name
|
14
|
-
|
15
10
|
copy_static_file '.gitignore'
|
16
11
|
|
17
|
-
create_file ".env"
|
18
|
-
|
19
|
-
export PRODUCTION_APP=#{@app_name}
|
20
|
-
export STAGING_APP=#{@app_name}-staging
|
21
|
-
EOF
|
22
|
-
end
|
12
|
+
create_file ".env"
|
13
|
+
append_to_file '.env', "APP: #{@app_name}\n"
|
23
14
|
|
24
15
|
git :add => '.'
|
25
16
|
git :commit => "-aqm 'Add default stuff.'"
|
data/lib/pah/partials/_heroku.rb
CHANGED
@@ -1,58 +1,126 @@
|
|
1
|
-
|
1
|
+
class HerokuApp < Rails::Generators::AppGenerator
|
2
|
+
DEFAULT_ADDONS = %w(pgbackups:auto-month loggly:mole sendgrid:starter)
|
2
3
|
|
3
|
-
|
4
|
-
config = {}
|
5
|
-
heroku_name = @app_name.gsub('_','')
|
6
|
-
new_heroku_name = ask "What do you want to call your app? (#{heroku_name})", :red
|
7
|
-
heroku_name = new_heroku_name.present? ? new_heroku_name : heroku_name
|
8
|
-
config['staging'] = would_you_like? "Create staging app? (#{heroku_name}-staging.heroku.com) [y,n]".red
|
9
|
-
config['deploy'] = would_you_like? "Deploy immediately?".red
|
10
|
-
config['domain'] = ask_unless_test "Add custom domain(customdomain.com) or leave blank".red
|
4
|
+
attr_reader :name, :description
|
11
5
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
def initialize(name, description, staging=false)
|
7
|
+
@name = name
|
8
|
+
@description = description
|
9
|
+
|
10
|
+
create
|
11
|
+
add_secret_token
|
12
|
+
add_timezone_config
|
13
|
+
add_addons
|
14
|
+
|
15
|
+
unless staging
|
16
|
+
add_heroku_git_remote
|
17
|
+
check_canonical_domain
|
18
|
+
check_collaborators
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
def create
|
23
|
+
created = false
|
24
|
+
default = @name
|
25
|
+
|
26
|
+
while not created do
|
27
|
+
@name = ask "What do you want to call your Heroku #{description}? (#{default})", :red
|
28
|
+
@name = @name.present? ? name : default
|
29
|
+
|
30
|
+
say "Creating Heroku app '#{name}.herokuapp.com'".magenta
|
31
|
+
created = system "heroku create #{name}"
|
32
|
+
|
33
|
+
unless created
|
34
|
+
puts "Heroku '#{name}' app already exists or could not be created, please provide a new name"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
@app
|
26
39
|
end
|
27
40
|
|
28
|
-
|
29
|
-
|
41
|
+
def add_addons
|
42
|
+
DEFAULT_ADDONS.each { |addon| add_heroku_addon(addon) }
|
30
43
|
end
|
31
44
|
|
32
|
-
|
45
|
+
def add_secret_token
|
46
|
+
say "Creating SECRET_TOKEN for Heroku '#{name}.herokuapp.com'".magenta
|
47
|
+
system "heroku config:set SECRET_TOKEN=#{SecureRandom::hex(60)} --app #{name}"
|
48
|
+
end
|
33
49
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
50
|
+
def add_heroku_git_remote
|
51
|
+
say "Adding Heroku git remote for deploy to '#{name}'.".magenta
|
52
|
+
git remote: "add heroku git@heroku.com:#{name}.git"
|
38
53
|
end
|
39
54
|
|
40
|
-
|
41
|
-
|
55
|
+
def add_heroku_addon(addon)
|
56
|
+
say "Adding heroku addon [#{addon}] to '#{name}'.".magenta
|
57
|
+
system "heroku addons:add #{addon} --app #{name}"
|
58
|
+
end
|
42
59
|
|
43
|
-
|
44
|
-
|
60
|
+
def add_canonical_domain(domain)
|
61
|
+
system "heroku domains:add #{domain} --app #{name}"
|
62
|
+
end
|
45
63
|
|
46
|
-
|
64
|
+
def add_collaborator(email)
|
65
|
+
system "heroku sharing:add #{email} --app #{name}"
|
66
|
+
end
|
47
67
|
|
48
|
-
|
49
|
-
say "Adding
|
50
|
-
|
68
|
+
def add_timezone_config
|
69
|
+
say "Adding timezone config on Heroku".magenta
|
70
|
+
system "heroku config:set TZ=America/Sao_Paulo --app #{name}"
|
51
71
|
end
|
52
72
|
|
53
|
-
|
73
|
+
def open
|
54
74
|
say "Pushing application to heroku...".magenta
|
55
|
-
git :
|
75
|
+
git push: "heroku master"
|
76
|
+
|
77
|
+
system "heroku open --app #{name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
def check_canonical_domain
|
82
|
+
domain = ask "Add custom domain (customdomain.com) or leave blank:".red
|
83
|
+
add_canonical_domain(domain) unless domain.blank?
|
84
|
+
end
|
85
|
+
|
86
|
+
def check_collaborators
|
87
|
+
collaborators = ask "Add collaborators? Type the email's separated by comma (,):".red
|
88
|
+
|
89
|
+
if collaborators.present?
|
90
|
+
collaborators.split(",").map(&:strip).each { |email| add_collaborator(email) }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
say "Configuring Heroku application...".magenta
|
96
|
+
if would_you_like? "Create Heroku apps?".red
|
97
|
+
|
98
|
+
say "Refreshing Heroku user credentials".magenta
|
99
|
+
unless system "heroku auth:login"
|
100
|
+
puts "Could not login to Heroku, halting"
|
101
|
+
exit
|
102
|
+
end
|
103
|
+
|
104
|
+
config = {}
|
105
|
+
config['staging'] = would_you_like? "Create staging app?".red
|
106
|
+
config['deploy'] = would_you_like? "Deploy immediately?".red
|
107
|
+
|
108
|
+
production_app = HerokuApp.new(@app_name.gsub('_',''), "app")
|
109
|
+
staging_app = HerokuApp.new("#{production_app.name}-staging", "staging app", true) if config['staging']
|
110
|
+
|
111
|
+
if config['staging'] && staging_app.name.present?
|
112
|
+
append_to_file '.env', "STAGING_APP: #{staging_app.name}\n"
|
113
|
+
append_to_file '.env', "PRODUCTION_APP: #{production_app.name}\n"
|
114
|
+
|
115
|
+
git add: '.env'
|
116
|
+
git commit: "-qm 'Adding STAGING_APP and PRODUCTION_APP configs.'"
|
117
|
+
else
|
118
|
+
# The STAGING_APP is the default integration destination
|
119
|
+
append_to_file '.env', "STAGING_APP: #{production_app.name}\n"
|
120
|
+
|
121
|
+
git add: '.env'
|
122
|
+
git commit: "-qm 'Adding STAGING_APP config.'"
|
56
123
|
end
|
57
|
-
|
124
|
+
|
125
|
+
production_app.open if config['deploy']
|
58
126
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
puts "Setting up Integration... ".magenta
|
2
|
+
|
2
3
|
copy_static_file 'lib/tasks/integration.rake'
|
3
|
-
copy_static_file 'lib/tasks/
|
4
|
-
|
5
|
-
git :
|
4
|
+
copy_static_file 'lib/tasks/deploy.rake'
|
5
|
+
|
6
|
+
git :add => 'lib/tasks/integration.rake lib/tasks/deploy.rake'
|
7
|
+
git :commit => "-qm 'Adding integration tasks.'"
|
6
8
|
|
7
9
|
puts "\n"
|
data/lib/pah/partials/_rvm.rb
CHANGED
@@ -31,12 +31,15 @@ run "gem install bundler --no-ri --no-rdoc"
|
|
31
31
|
# Install all other gems needed from Gemfile
|
32
32
|
run "bundle install"
|
33
33
|
|
34
|
-
copy_static_file '.
|
35
|
-
gsub_file '.
|
36
|
-
gsub_file '.rvmrc', /RUBYVERSION/, desired_ruby
|
34
|
+
copy_static_file '.ruby-version'
|
35
|
+
gsub_file '.ruby-version', /RUBY_VERSION/, desired_ruby
|
37
36
|
|
38
|
-
|
39
|
-
|
37
|
+
copy_static_file '.ruby-gemset'
|
38
|
+
gsub_file '.ruby-gemset', /GEMSET/, gemset_name
|
39
|
+
|
40
|
+
git :add => '.ruby-version'
|
41
|
+
git :add => '.ruby-gemset'
|
42
|
+
git :commit => "-qm 'Adding RVM config files.'"
|
40
43
|
|
41
44
|
git :add => 'Gemfile.lock'
|
42
45
|
git :commit => "-qm 'Adding Gemfile.lock.'"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
puts "Replacing secret token with environment variable...".magenta
|
2
|
+
|
3
|
+
in_root do
|
4
|
+
append_to_file '.env', "SECRET_TOKEN: #{SecureRandom::hex(60)}\n"
|
5
|
+
|
6
|
+
gsub_file 'config/initializers/secret_token.rb', /config.secret_token = '(.*?)'/, "config.secret_token = ENV['SECRET_TOKEN']"
|
7
|
+
gsub_file 'config/initializers/secret_token.rb', /config.secret_key_base = '(.*?)'/, "config.secret_key_base = ENV['SECRET_TOKEN']"
|
8
|
+
end
|
9
|
+
|
10
|
+
git :add => 'config/initializers/secret_token.rb'
|
11
|
+
git :add => '.env'
|
12
|
+
git :commit => "-qm 'Replace secret token with environment variable.'"
|
13
|
+
|
14
|
+
puts "\n"
|
data/lib/pah/template.rb
CHANGED
data/lib/pah/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HE:labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,7 +90,8 @@ extensions: []
|
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
92
|
- .gitignore
|
93
|
-
- .
|
93
|
+
- .ruby-gemset
|
94
|
+
- .ruby-version
|
94
95
|
- CHANGELOG.md
|
95
96
|
- CONTRIBUTING.md
|
96
97
|
- Gemfile
|
@@ -99,7 +100,8 @@ files:
|
|
99
100
|
- Rakefile
|
100
101
|
- bin/pah
|
101
102
|
- lib/pah/files/.gitignore
|
102
|
-
- lib/pah/files/.
|
103
|
+
- lib/pah/files/.ruby-gemset
|
104
|
+
- lib/pah/files/.ruby-version
|
103
105
|
- lib/pah/files/Gemfile
|
104
106
|
- lib/pah/files/Procfile
|
105
107
|
- lib/pah/files/app/assets/stylesheets/application.css.scss
|
@@ -111,8 +113,8 @@ files:
|
|
111
113
|
- lib/pah/files/config/initializers/omniauth.rb
|
112
114
|
- lib/pah/files/config/locales/pt-BR.yml
|
113
115
|
- lib/pah/files/config/unicorn.rb
|
116
|
+
- lib/pah/files/lib/tasks/deploy.rake
|
114
117
|
- lib/pah/files/lib/tasks/integration.rake
|
115
|
-
- lib/pah/files/lib/tasks/tasks.rake
|
116
118
|
- lib/pah/files/spec/acceptance/dummy_spec.rb
|
117
119
|
- lib/pah/files/spec/spec_helper.rb
|
118
120
|
- lib/pah/files/spec/support/README
|
@@ -144,6 +146,7 @@ files:
|
|
144
146
|
- lib/pah/partials/_omniauth.rb
|
145
147
|
- lib/pah/partials/_rspec.rb
|
146
148
|
- lib/pah/partials/_rvm.rb
|
149
|
+
- lib/pah/partials/_secret_token.rb
|
147
150
|
- lib/pah/partials/_secure_headers.rb
|
148
151
|
- lib/pah/partials/_stylesheets.rb
|
149
152
|
- lib/pah/partials/_unicorn.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 2.0.0@pah --create
|
data/lib/pah/files/.rvmrc
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
-
# Only full ruby name is supported here, for short names use:
|
8
|
-
# echo "rvm use 1.9.2" > .rvmrc
|
9
|
-
environment_id="RUBYVERSION@PROJECT"
|
10
|
-
|
11
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
-
rvmrc_rvm_version="1.14.3 ()" # 1.10.1 seams as a safe start
|
13
|
-
eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
-
echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
-
return 1
|
16
|
-
}
|
17
|
-
|
18
|
-
# First we attempt to load the desired environment directly from the environment
|
19
|
-
# file. This is very fast and efficient compared to running through the entire
|
20
|
-
# CLI and selector. If you want feedback on which environment was used then
|
21
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
-
then
|
25
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
-
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
-
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
-
else
|
29
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
30
|
-
rvm --create "$environment_id" || {
|
31
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
32
|
-
return 1
|
33
|
-
}
|
34
|
-
fi
|
35
|
-
|
36
|
-
# If you use bundler, this might be useful to you:
|
37
|
-
# if [[ -s Gemfile ]] && {
|
38
|
-
# ! builtin command -v bundle >/dev/null ||
|
39
|
-
# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
|
40
|
-
# }
|
41
|
-
# then
|
42
|
-
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
43
|
-
# gem install bundler
|
44
|
-
# fi
|
45
|
-
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
46
|
-
# then
|
47
|
-
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
|
48
|
-
# fi
|
49
|
-
|
50
|
-
export APP='PROJECT'
|
@@ -1,28 +0,0 @@
|
|
1
|
-
namespace :heroku do
|
2
|
-
APP = ENV['APP'] unless defined?(APP)
|
3
|
-
|
4
|
-
def run(*cmd)
|
5
|
-
system(*cmd)
|
6
|
-
raise "Command #{cmd.inspect} failed!" unless $?.success?
|
7
|
-
end
|
8
|
-
|
9
|
-
def confirm(message)
|
10
|
-
print "\n#{message}\nAre you sure? [yN] "
|
11
|
-
raise 'Aborted' unless STDIN.gets.chomp.downcase == 'y'
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "Deploy app to Heroku"
|
15
|
-
task :deploy do
|
16
|
-
puts "-----> Pushing..."
|
17
|
-
run "git push git@heroku.com:#{APP}.git HEAD:master -f"
|
18
|
-
|
19
|
-
puts "-----> Migrating..."
|
20
|
-
Bundler.with_clean_env { run "heroku run rake db:migrate --app #{APP}" }
|
21
|
-
|
22
|
-
puts "-----> Seeding..."
|
23
|
-
Bundler.with_clean_env { run "heroku run rake db:seed --app #{APP}" }
|
24
|
-
|
25
|
-
puts "-----> Restarting..."
|
26
|
-
Bundler.with_clean_env { run "heroku restart --app #{APP}" }
|
27
|
-
end
|
28
|
-
end
|