capistrano-hivequeen 1.1.0 → 2.0.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.
@@ -37,7 +37,6 @@ Gem::Specification.new do |s|
37
37
 
38
38
  ## List your runtime dependencies here. Runtime dependencies are those
39
39
  ## that are needed for an end user to actually USE your code.
40
- s.add_dependency('capistrano-ext', '= 1.2.1')
41
40
  s.add_dependency('capistrano', '~> 2.11.2')
42
41
  s.add_dependency('json')
43
42
  s.add_dependency('excon', '>= 0.6.0') # Perhaps we can support older. Haven't checked.
@@ -8,17 +8,9 @@ Capistrano::Configuration.instance(:must_exist).load do
8
8
  HiveQueen.logger = logger
9
9
  HiveQueen.get_credentials!
10
10
 
11
- # Redefine stage tasks from multistage extension
12
- # Set the list of available stages
13
- set :stages, HiveQueen.environment_names
14
-
15
11
  # Default to using the current branch as the stage name
16
12
  # NB: current branch may not be set
17
- current_branch = `git symbolic-ref HEAD`.chomp.sub('refs/heads/', '')
18
- unless current_branch.empty?
19
- env_name = HiveQueen.environment_for_branch(current_branch)
20
- set(:default_stage, env_name) if env_name
21
- end
13
+ #current_branch = `git symbolic-ref HEAD`.chomp.sub('refs/heads/', '')
22
14
 
23
15
  set :repository, HiveQueen.repository
24
16
  set :scm, :git
@@ -39,13 +31,7 @@ Capistrano::Configuration.instance(:must_exist).load do
39
31
  `git log #{current_commit}...#{real_revision} --pretty="%n%h %an: %s (%ar)" --stat --no-color`
40
32
  end
41
33
 
42
- # Load capistrano multi-stage extension
43
- require 'fileutils' # required until https://github.com/capistrano/capistrano-ext/commit/930ca840a0b4adad0ec53546790b3f5ffe726538 is released
44
- require 'capistrano/ext/multistage'
45
- require 'capistrano/hivequeen/setup'
46
- require 'capistrano/hivequeen/deploy'
47
-
48
- # Redefine stage tasks from multistage extension
34
+ # Define environment tasks
49
35
  HiveQueen.environments.each do |env|
50
36
  name = env['name']
51
37
  hive_queen_id = env['id']
@@ -53,22 +39,22 @@ Capistrano::Configuration.instance(:must_exist).load do
53
39
 
54
40
  desc "Use environment #{name}"
55
41
  task name do
56
- environment = HiveQueen.roles(hive_queen_id)
42
+ env = HiveQueen.roles(hive_queen_id)
57
43
  # Check if environment is ready
58
- unless environment['state'] == 'running'
59
- abort "Environment #{name} is not ready. State: #{environment['state']}"
44
+ unless env['state'] == 'running'
45
+ abort "Environment #{name} is not ready. State: #{env['state']}"
60
46
  end
61
47
 
62
- set :stage, name.to_sym
48
+ set :environment, name.to_sym
63
49
  set :rails_env, name
64
50
  set :environment_id, hive_queen_id
65
51
  set :current_commit, current_commit
66
52
  unless exists?(:branch)
67
- set :branch, environment['branch']
53
+ set :branch, env['branch']
68
54
  end
69
55
 
70
56
  # Set servers for each role
71
- environment['roles'].each do |role_name, role_config|
57
+ env['roles'].each do |role_name, role_config|
72
58
  role(role_name.to_sym) { role_config['servers'] }
73
59
  end
74
60
 
@@ -85,4 +71,8 @@ Capistrano::Configuration.instance(:must_exist).load do
85
71
 
86
72
  end
87
73
  end
74
+ require 'capistrano/hivequeen/setup'
75
+ require 'capistrano/hivequeen/deploy'
76
+
77
+
88
78
  end
@@ -9,11 +9,18 @@ Capistrano::Configuration.instance.load do
9
9
  end
10
10
 
11
11
  before "deploy:update_code", "hivequeen:start"
12
+ on :start, "hivequeen:require_environment", :except => HiveQueen.environment_names
12
13
  namespace :hivequeen do
14
+
15
+ desc "[internal] abort if no environment specified"
16
+ task :require_environment do
17
+ abort "No environment specified." if !exists?(:environment)
18
+ end
19
+
13
20
  desc "[internal] Start a deployment in hivequeen"
14
21
  task :start do
15
22
  # TODO: is there a better way to determine what cap tasks are running?
16
- tasks = ARGV.reject{|task_name| stage.to_s == task_name}
23
+ tasks = ARGV.reject{|task_name| environment.to_s == task_name}
17
24
 
18
25
  params = {
19
26
  :task => tasks.join(' '),
@@ -1,6 +1,6 @@
1
1
  class HiveQueen
2
2
  class Version
3
- @@version = '1.1.0'
3
+ @@version = '2.0.0'
4
4
 
5
5
  def self.to_s
6
6
  @@version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-hivequeen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-27 00:00:00.000000000 Z
12
+ date: 2012-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: capistrano-ext
16
- requirement: &70268421688220 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - =
20
- - !ruby/object:Gem::Version
21
- version: 1.2.1
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *70268421688220
25
14
  - !ruby/object:Gem::Dependency
26
15
  name: capistrano
27
- requirement: &70268421687740 !ruby/object:Gem::Requirement
16
+ requirement: &70343268557220 !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
19
  - - ~>
@@ -32,10 +21,10 @@ dependencies:
32
21
  version: 2.11.2
33
22
  type: :runtime
34
23
  prerelease: false
35
- version_requirements: *70268421687740
24
+ version_requirements: *70343268557220
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: json
38
- requirement: &70268421687360 !ruby/object:Gem::Requirement
27
+ requirement: &70343268555960 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ! '>='
@@ -43,10 +32,10 @@ dependencies:
43
32
  version: '0'
44
33
  type: :runtime
45
34
  prerelease: false
46
- version_requirements: *70268421687360
35
+ version_requirements: *70343268555960
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: excon
49
- requirement: &70268421686800 !ruby/object:Gem::Requirement
38
+ requirement: &70343268554420 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
41
  - - ! '>='
@@ -54,7 +43,7 @@ dependencies:
54
43
  version: 0.6.0
55
44
  type: :runtime
56
45
  prerelease: false
57
- version_requirements: *70268421686800
46
+ version_requirements: *70343268554420
58
47
  description: Capistrano extensions for interacting with HiveQueen
59
48
  email: aaron@kickstarter.com
60
49
  executables: []