capistrano-hivequeen 0.7.0 → 0.7.1

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.
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  ## If your rubyforge_project name is different, then edit it and comment out
7
7
  ## the sub! line in the Rakefile
8
8
  s.name = 'capistrano-hivequeen'
9
- s.version = '0.7.0'
9
+ s.version = '0.7.1'
10
10
  s.date = Time.now.strftime("%Y-%m-%d")
11
11
 
12
12
  ## Make sure your summary is short. The description may be as long
@@ -13,9 +13,10 @@ Capistrano::Configuration.instance(:must_exist).load do
13
13
 
14
14
  # Default to using the current branch as the stage name
15
15
  # NB: current branch may not be set
16
- current_branch = `git symbolic-ref HEAD`.chomp.sub('refs/head/', '')
16
+ current_branch = `git symbolic-ref HEAD`.chomp.sub('refs/heads/', '')
17
17
  unless current_branch.empty?
18
- set :default_stage, current_branch.to_sym
18
+ env_name = HiveQueen.environment_for_branch(current_branch)
19
+ set(:default_stage, env_name) if env_name
19
20
  end
20
21
 
21
22
  set :repository, HiveQueen.repository
@@ -26,6 +26,11 @@ class HiveQueen
26
26
  environments.map{|e| e['name'].to_sym }
27
27
  end
28
28
 
29
+ def environment_for_branch(branch)
30
+ env = environments.detect{|e| e['branch'] == branch }
31
+ env['name'] if env
32
+ end
33
+
29
34
  def repository
30
35
  project_data['repo']
31
36
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-hivequeen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 0
10
- version: 0.7.0
9
+ - 1
10
+ version: 0.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aaron Suggs