gta 0.4.5 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 818670cc5ee8e491e1325084620ba663467e7338
4
- data.tar.gz: 82b239d17e63e19a2f17b59473f4aae9d28a6edb
3
+ metadata.gz: 5f930a1d951fbb0fbe73a607cf5d5976d31757ac
4
+ data.tar.gz: 9374c93830f70044ea0ba245c5551236046d0c1c
5
5
  SHA512:
6
- metadata.gz: bb3e3d9d490e45c49097f8ec78b8469389e81751604099314b97fd88ead5bf56d8079d9a04f1aa2dbcfb5511739aaf0ad1f7547e2f838f1a740757499f7591e1
7
- data.tar.gz: b14356a82b2d4214a6dc41bba1cc4ac23c4779b0880d057ce419ce65cf39e0ce215fa65c881546003943983bc3a5fc7f23ad6b9810ea065e4dff89a17d7235ac
6
+ metadata.gz: f6d3c77c4a6b1b0f253c3af91e69fe6d65d63717c6f1a225eff5a07b27461ef0d241dd060871946646e5258359530748ddc7e8b902282e30427e0b1d8d82ace3
7
+ data.tar.gz: 1297e0dc51415ac9d526d8674c17597770498418913fa148af080c5c41e54dae8ecefcc51e85eca9d3c2942788783ebde29f99349d7c532a2b143d74c2449ca5
data/README.md CHANGED
@@ -8,8 +8,8 @@ Heroku has made git deploys an awesome standard. Mislav's git-deploy gem
8
8
  has made this ease of deploy a possibility for servers that are not
9
9
  Heroku too. Despite the easiness of a git deploy system managing a
10
10
  series of stages, ie. origin => ci => staging => production, takes some
11
- care and consideration. Additionally, hotfixing changes in the middle of
12
- the chain causes a reordering of commits and different push proceedures
11
+ care and consideration. Additionally, hot-fixing changes in the middle of
12
+ the chain causes a reordering of commits and different push procedures
13
13
  that can car reek havok.
14
14
 
15
15
  GTA reads git configuration from yml file that should be checked into
@@ -23,5 +23,4 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "heroku"
27
26
  end
@@ -26,7 +26,7 @@ module GTA
26
26
  end
27
27
 
28
28
  def file_name
29
- "~/Downloads/#{app_signature}.sql"
29
+ "/tmp/#{app_signature}.sql"
30
30
  end
31
31
 
32
32
  def app_signature
@@ -16,6 +16,10 @@ module GTA
16
16
  end
17
17
  end
18
18
 
19
+ def account
20
+ @account || config && @account
21
+ end
22
+
19
23
  def app_name
20
24
  @app_name || config && @app_name
21
25
  end
@@ -46,6 +50,7 @@ module GTA
46
50
  def config
47
51
  return @config if @config
48
52
  parsed = YAML.load(File.read(config_path))
53
+ @account = parsed['account']
49
54
  @app_name = parsed['name']
50
55
  @database_config_path = find_database_config(parsed['database_config'])
51
56
  @config = parsed['stages']
@@ -9,23 +9,23 @@ namespace :gta do
9
9
 
10
10
  def app_argument(args)
11
11
  manager = GTA::Manager.new(GTA::Manager.env_config)
12
- "--app #{manager.app_name}-#{stage_name!(args)}"
12
+ manager.account.blank? ? "--app #{manager.app_name}-#{stage_name!(args)}" : "--app #{manager.app_name}-#{stage_name!(args)} --account #{manager.account}"
13
13
  end
14
14
 
15
15
  desc "turn maintenance on for this stage"
16
16
  task :maintenance_on, :stage_name do |t, args|
17
- GTA::Commander.new("heroku maintenance:on #{app_argument(args)}").perform
17
+ Bundler.with_clean_env{ GTA::Commander.new("heroku maintenance:on #{app_argument(args)}").perform }
18
18
  end
19
19
 
20
20
  desc "turn maintenance on for this stage"
21
21
  task :maintenance_off, :stage_name do |t, args|
22
- GTA::Commander.new("heroku maintenance:off #{app_argument(args)}").perform
22
+ Bundler.with_clean_env{ GTA::Commander.new("heroku maintenance:off #{app_argument(args)}").perform }
23
23
  end
24
24
 
25
25
  desc "run a heroku rake task in specified stage"
26
26
  task :rake, :stage_name, :command do |t, args|
27
27
  command = args[:command]
28
- GTA::Commander.new("heroku run rake #{command} #{app_argument(args)}").perform
28
+ Bundler.with_clean_env{ GTA::Commander.new("heroku run rake #{command} #{app_argument(args)}").perform }
29
29
  end
30
30
  end
31
31
  end
@@ -7,13 +7,13 @@ namespace :gta do
7
7
 
8
8
  desc 'fetch and load the remote database'
9
9
  task :pull, :stage_name do |t, args|
10
- Rake::Task['gta:heroku:db:fetch'].invoke(args[:stage_name])
11
- Rake::Task['gta:heroku:db:load'].invoke(args[:stage_name])
10
+ Bundler.with_clean_env{ Rake::Task['gta:heroku:db:fetch'].invoke(args[:stage_name]) }
11
+ Bundler.with_clean_env{ Rake::Task['gta:heroku:db:load'].invoke(args[:stage_name]) }
12
12
  end
13
13
 
14
14
  desc 'download the database from the specified stage or from the last stage'
15
15
  task :fetch, :stage_name do |t, args|
16
- gta_db.fetch(args[:stage_name])
16
+ Bundler.with_clean_env{ gta_db.fetch(args[:stage_name]) }
17
17
  end
18
18
 
19
19
  desc 'load local database with downloaded backup from stage'
@@ -23,7 +23,7 @@ namespace :gta do
23
23
 
24
24
  desc 'restore remote database from another stage'
25
25
  task :restore, :stage_name do |t, args|
26
- gta_db.restore(args[:stage_name], ENV['source'])
26
+ Bundler.with_clean_env{ gta_db.restore(args[:stage_name], ENV['source']) }
27
27
  end
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module GTA
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.7"
3
3
  end
@@ -0,0 +1,29 @@
1
+ database_config: database.yml # relative from the config file
2
+ name: activator
3
+ account: socialchorus
4
+
5
+ stages:
6
+ origin:
7
+ repository: git@github.com:socialchorus/activator.git
8
+
9
+ ci:
10
+ source: origin
11
+ tag: ci/*
12
+ repository: git@github.com:socialchorus/activator.git
13
+
14
+ staging:
15
+ source: ci
16
+ repository: git@heroku.com:activator-staging.git
17
+ restorable: true
18
+ hotfixable: true
19
+
20
+ qa:
21
+ source: staging
22
+ repository: git@heroku.com:activator-qa.git
23
+ restorable: true
24
+ final: true
25
+ hotfixable: true
26
+
27
+ production:
28
+ source: qa
29
+ repository: git@heroku.com:activator-production.git
@@ -33,7 +33,7 @@ describe GTA::HerokuDB do
33
33
  it "downloads the latest database backup to an appropriately named file in downloads" do
34
34
  heroku_db.should_receive(:url).and_return('http://heroku-backup-url.com')
35
35
  heroku_db.should_receive(:sh!)
36
- .with('curl -o ~/Downloads/activator-staging.sql "http://heroku-backup-url.com"')
36
+ .with('curl -o /tmp/activator-staging.sql "http://heroku-backup-url.com"')
37
37
  heroku_db.fetch
38
38
  end
39
39
  end
@@ -126,4 +126,13 @@ describe GTA::Manager do
126
126
  manager.setup
127
127
  end
128
128
  end
129
+
130
+ context 'when heroku account is specified' do
131
+ let(:config_path_with_account) { File.dirname(__FILE__) + "/fixtures/config/gta_with_account.yml" }
132
+ let(:manager_with_account) { GTA::Manager.new(config_path_with_account) }
133
+
134
+ it 'has an account name' do
135
+ expect(manager_with_account.account).to eq 'socialchorus'
136
+ end
137
+ end
129
138
  end
@@ -4,5 +4,5 @@ require "#{here}/../lib/gta"
4
4
  Dir["#{here}/support/**/*.rb"].each {|f| require f}
5
5
 
6
6
  RSpec.configure do |config|
7
- config.color_enabled = true
7
+ config.color = true
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - socialchorus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-16 00:00:00.000000000 Z
13
+ date: 2014-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ansi
@@ -68,20 +68,6 @@ dependencies:
68
68
  - - '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
- - !ruby/object:Gem::Dependency
72
- name: heroku
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - '>='
83
- - !ruby/object:Gem::Version
84
- version: '0'
85
71
  description: 'GTA: the Git Transit Authority - A git based deploy tool for moving
86
72
  code from stage to stage.'
87
73
  email:
@@ -126,6 +112,7 @@ files:
126
112
  - spec/fixtures/config/database.json
127
113
  - spec/fixtures/config/database.yml
128
114
  - spec/fixtures/config/gta.yml
115
+ - spec/fixtures/config/gta_with_account.yml
129
116
  - spec/heroku_db_spec.rb
130
117
  - spec/hotfix_spec.rb
131
118
  - spec/local_db_spec.rb
@@ -168,6 +155,7 @@ test_files:
168
155
  - spec/fixtures/config/database.json
169
156
  - spec/fixtures/config/database.yml
170
157
  - spec/fixtures/config/gta.yml
158
+ - spec/fixtures/config/gta_with_account.yml
171
159
  - spec/heroku_db_spec.rb
172
160
  - spec/hotfix_spec.rb
173
161
  - spec/local_db_spec.rb