redmine_stagecoach 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (3.2.1)
5
- activesupport (= 3.2.1)
4
+ activemodel (3.2.2)
5
+ activesupport (= 3.2.2)
6
6
  builder (~> 3.0.0)
7
- activeresource (3.2.1)
8
- activemodel (= 3.2.1)
9
- activesupport (= 3.2.1)
10
- activesupport (3.2.1)
7
+ activeresource (3.2.2)
8
+ activemodel (= 3.2.2)
9
+ activesupport (= 3.2.2)
10
+ activesupport (3.2.2)
11
11
  i18n (~> 0.6)
12
12
  multi_json (~> 1.0)
13
13
  builder (3.0.0)
14
- capistrano (2.9.0)
14
+ capistrano (2.11.2)
15
15
  highline
16
16
  net-scp (>= 1.0.0)
17
17
  net-sftp (>= 2.0.0)
@@ -25,7 +25,7 @@ GEM
25
25
  bundler (~> 1.0)
26
26
  git (>= 1.2.5)
27
27
  rake
28
- multi_json (1.0.4)
28
+ multi_json (1.2.0)
29
29
  net-scp (1.0.4)
30
30
  net-ssh (>= 1.99.1)
31
31
  net-sftp (2.0.5)
@@ -34,7 +34,11 @@ GEM
34
34
  net-ssh-gateway (1.1.0)
35
35
  net-ssh (>= 1.99.1)
36
36
  rake (0.9.2.2)
37
- shoulda (2.11.3)
37
+ shoulda (3.0.1)
38
+ shoulda-context (~> 1.0.0)
39
+ shoulda-matchers (~> 1.0.0)
40
+ shoulda-context (1.0.0)
41
+ shoulda-matchers (1.0.0)
38
42
  trollop (1.16.2)
39
43
 
40
44
  PLATFORMS
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = Stagecoach
2
- stagecoach works in two stages, init and deploy. The init stage creates a branch based on a redmine/planio issue, and the deploy stage pushes, merges and (yes!) deploys it.
2
+ stagecoach works in two stages, init and deploy. The init stage creates a branch based on a redmine/planio issue, and the deploy stage merges and (yes!) deploys it.
3
+
4
+ In between you can use stagecoach -p to push changes from your current branch to your remote repo. This creates a remote branch for you if one does not exist already.
3
5
 
4
6
  <b>You should always run stagecoach from the root directory of your repo</b>
5
7
  Otherwise it may (will) break.
@@ -12,11 +14,15 @@ so if you need to remove a branch or edit the issue number that a branch points
12
14
 
13
15
  == Init Stage
14
16
  stagecoach -p[lanio] 4115 (OR) -g[ithub] 525 -b[ranch] my_new_branch
17
+ (optional: -f[rom] original_branch, default => master)
15
18
 
16
19
  You can also just run stagecoach without any flags and it will allow you to enter this stuff manually.
17
20
 
21
+ The -f flag allows you to choose which branch you would like to branch out from.
22
+ The default is master.
23
+
18
24
  To get started, all stagecoach needs from you is the issue number you are working on (redmine/planio or github) and a new branch name. You /can/ use an existing branch if it
19
- is up to date with your master branch. If it is not, stagecoach will squawk and die and you will have to bring the branch up to date, or use a new one.
25
+ is up to date with your chosen original branch. If it is not, stagecoach will squawk and die and you will have to bring the branch up to date, or use a new one.
20
26
 
21
27
  If you are working from a redmine/planio issue, stagecoach sets the issue to 'In Progress'. Currently it does not assign the issue to you, but you have the option to view the issue
22
28
  in your browser and do this manually. It also sets up a git issue for you to reference in your commits (see commit-msg githook).
@@ -44,8 +50,7 @@ For more information, see
44
50
 
45
51
  This automates the entire deploy workflow for you as follows:
46
52
 
47
- git push origin new_branch_name
48
- git checkout staging
53
+ git checkout [chosen deploy branch]
49
54
  git pull
50
55
  git merge task_name
51
56
  git push origin staging
@@ -53,13 +58,17 @@ This automates the entire deploy workflow for you as follows:
53
58
  set redmine/planio ticket to 'feedback' status (if applicable)
54
59
 
55
60
  <b> Sample usage: </b>
56
- stagecoach -p 4115 -b new_branch_name
61
+ stagecoach -p 4115 -b new_branch_name -f branch_to_branch_out_from
57
62
  [code, commit until feature or fix is complete]
58
- stagecoach -d
63
+ stagecoach -d staging
59
64
 
60
65
  <b> Flags </b>
61
66
  --branch, -b: Enter your new branch name here, eg. stagecoach -b new_branch (optional)
62
- --planio, -p: Enter your planio issue number here, eg. stagecoach -p 1234 (optional)
63
- --github, -g: Enter your github issue number here, eg. stagecoach -g 1234 (optional)
64
67
  --deploy, -d: Use this option to skip straight to push & deploy if you have already pulled from master and created your new branch
68
+ --from, -f: Set the original branch from which you would like to make your new branch. Default is 'master'
69
+ --github, -g: Enter your github issue number here, eg. stagecoach -g 1234 (optional)
70
+ --help, -h: Shows your help
71
+ --push, -p: Push the current branch to remote. Creates a remote branch if none exists.
72
+ --redmine,-r: Enter your planio issue number here, eg. stagecoach -p 1234 (optional)
65
73
  --setup, -s: Use this the first time you run stagecoach to save your redmine repository/api key and install the commit-msg githook if desired
74
+ --version, v: Prints the current version
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.4
1
+ 0.6.5
data/bin/stagecoach CHANGED
@@ -1,21 +1,33 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  require File.dirname(__FILE__) + '/../lib/stagecoach.rb'
4
+ VERSION = File.open(File.dirname(__FILE__) + '/../VERSION').read
4
5
 
5
6
  CONFIG_FILE = `pwd`.chomp + '/.stagecoach'
6
7
 
7
8
  module Stagecoach
8
- staging = 'staging'
9
- master = 'master'
10
-
11
9
  # Command line options courtesy of the Trollop gem.
12
10
  opts = CommandLine.trollop
13
11
 
12
+ staging = 'staging'
13
+ original_branch = opts[:from]
14
+
15
+ # Check that original_branch actually exists.
16
+ unless Git.branch_exist?(original_branch)
17
+ puts "|#{original_branch}| does not exist.".red
18
+ puts "The -f option is for choosing which branch you want to branch out from."
19
+ puts "Run stagecoach -h for help"
20
+ puts "Exiting..."
21
+ exit
22
+ end
23
+
24
+
14
25
  # Initial setup with -s flag.
15
26
  if opts[:setup]
16
27
  Config.setup
17
28
  end
18
29
 
30
+
19
31
  # Initial setup without -s flag.
20
32
  unless File.exist?(CONFIG_FILE)
21
33
  puts "No .stagecoach file present, running initial setup."
@@ -43,6 +55,7 @@ module Stagecoach
43
55
  end
44
56
  end
45
57
 
58
+
46
59
  # Set up redmine client config.
47
60
  RedmineApi::Client.instance_eval do
48
61
  self.site = config["redmine_site"]
@@ -114,17 +127,17 @@ module Stagecoach
114
127
  CommandLine.line_break
115
128
  puts "Stagecoach: initial stage"
116
129
 
117
- # Change to master, pull changes, and create a new branch.
130
+ # Change to from branch, pull changes, and create a new branch.
118
131
  CommandLine.line_break
119
- puts "Switching to master branch"
132
+ puts "Switching to #{original_branch} branch"
120
133
  #
121
134
  # TODO if there is a file that has been git added but not git committed, it
122
135
  # will pop up at this point looking confusing (eg. "A test_file").
123
136
  # Handle this better?
124
137
  #
125
- Git.checkout(master)
138
+ Git.checkout(original_branch)
126
139
  puts "Pulling changes:"
127
- Git.pull
140
+ Git.pull(original_branch)
128
141
  if opts[:branch_given]
129
142
  new_branch = opts[:branch]
130
143
  else
@@ -141,15 +154,15 @@ module Stagecoach
141
154
 
142
155
  # Make sure new local branch does not already exist.
143
156
  if Git.branch_exist?(new_branch)
144
- puts "There is already a local branch called #{new_branch}."
145
- if Git.diff(master, new_branch) == ""
146
- print "#{new_branch} is up to date with master. [U]se or [Q]uit: "
157
+ print "There is already a local branch called #{new_branch}.[U]se or [Q]uit:"
158
+ if Git.diff(original_branch, new_branch) == ""
159
+ print "#{new_branch} is up to date with #{original_branch}. [U]se or [Q]uit: "
147
160
  else
148
- puts "#{new_branch} is not up to date with master. Please use a different branch or update this one.".red
161
+ puts "#{new_branch} is not up to date with #{original_branch}. Please use a different branch or update this one.".red
149
162
  puts "Exiting..."
150
163
  CommandLine.line_break
151
- puts "The following files in branch '#{new_branch}' differ from their master branch versions:"
152
- puts Git.diff(master, new_branch)
164
+ puts "The following files in branch '#{new_branch}' differ from their #{original_branch} branch versions:"
165
+ puts Git.diff(original_branch, new_branch)
153
166
  CommandLine.line_break
154
167
  exit
155
168
  end
@@ -163,7 +176,7 @@ module Stagecoach
163
176
  Git.new_branch(new_branch)
164
177
  end
165
178
 
166
- # Ugly code, pretty output...
179
+ # Pretty output...
167
180
  CommandLine.line_break
168
181
 
169
182
  # Issue handling.
@@ -282,7 +295,6 @@ module Stagecoach
282
295
  Git.merge(to_branch, from_branch)
283
296
  Git.push(to_branch)
284
297
  Capistrano.deploy(to_branch)
285
- Git.change_to_branch(master)
286
298
 
287
299
  # Redmine issue to feedback status
288
300
  if redmine_issue_number = config[from_branch][:redmine_issue]
@@ -8,76 +8,32 @@ module Stagecoach
8
8
  require 'trollop'
9
9
  # Command line options using Trollop.
10
10
  Trollop::options do
11
+ version "Stagecoach %s" % VERSION
11
12
  banner <<-EOS
12
- stagecoach works in two stages, init and deploy. The init stage creates a branch based on a redmine/planio issue, and the deploy stage pushes, merges and (yes!) deploys it.
13
+ Usage
14
+ -----
15
+ Init stage:
16
+ stagecoach -r[edmine] 4115 (or -g[ithub] 525) -b[ranch] my_new_branch -f[rom] branch_to_branch_out_from
13
17
 
14
- #{"You should always run stagecoach from the root directory of your repo".red}
15
- Otherwise it may (will) break.
18
+ Push:
19
+ stagecoach -p
16
20
 
17
- The first time you run stagecoach it will ask you for some information, namely your redmine/planio repo URL and your API key for this repo.
18
- It will also install a custom commit-msg git hook (if you ask it to) - for more information, see below.
21
+ Deploy:
22
+ stagecoach -d staging
19
23
 
20
- All stagecoach config is saved in /path/to/your/repo/.stagecoach which is created at initial setup and added to your global .gitignore. This is a yaml file with fairly obvious syntax
21
- so if you need to remove a branch or edit the issue number that a branch points to, it is possible (although not necessarily recommended) to edit it.
24
+ For more info see the readme at https://github.com/omnikron/stagecoach#readme
22
25
 
23
- Init Stage
24
- ----------
25
- stagecoach -p[lanio] 4115 (OR) -g[ithub] 525 -b[ranch] my_new_branch
26
-
27
- You can also just run stagecoach without any flags and it will allow you to enter this stuff manually.
28
-
29
- To get started, all stagecoach needs from you is the issue number you are working on (redmine/planio or github) and a new branch name. You /can/ use an existing branch if it
30
- is up to date with your master branch. If it is not, stagecoach will squawk and die and you will have to bring the branch up to date, or use a new one.
31
-
32
- If you are working from a redmine/planio issue, stagecoach sets the issue to 'In Progress'. Currently it does not assign the issue to you, but you have the option to view the issue
33
- in your browser and do this manually. It also sets up a git issue for you to reference in your commits (see commit-msg githook).
34
-
35
- If you are working from a github issue, we can all get on with our lives.
36
-
37
- Coding Stage
38
- ------------
39
- Future versions of stagecoach may do the coding for you, but at the moment you have to do this part manually.
40
- Just code and commit, code and commit until your feature or fix is ready.
41
-
42
- #{"commit-msg githook".green}
43
- If you opt to install the commit-msg githook during initial setup (stagecoach -s) then your commit messages will be automatically referenced to the github issue of the branch you are in
44
- (this only applies to branches created or registered in Stagecoach).
45
-
46
- - to reference a different issue from a commit, simply refer to it as normal with #xxx in the commit message. The git-hook will leave your message alone.
47
- - to make no reference at all, you can use the #noref tag in the commit message. The git-hook
48
- - to close an issue with a commit, use the #closes tag.
49
-
50
- For more information, see
51
- - the githook itself at /path/to/your/repo/.git/hooks/commit-msg
52
- - http://book.git-scm.com/5_git_hooks.html
53
-
54
- Deploy Stage
55
- ------------
56
- stagecoach -d[eploy]
57
-
58
- This automates the entire deploy workflow for you as follows:
59
-
60
- git push origin new_branch_name
61
- git checkout staging
62
- git pull
63
- git merge task_name
64
- git push origin staging
65
- cap staging deploy
66
- set redmine/planio ticket to 'feedback' status (if applicable)
67
-
68
- #{"Sample usage:".green}
69
- stagecoach -p 4115 -b new_branch_name
70
- [code, commit until feature or fix is complete]
71
- stagecoach -d
72
26
 
73
27
  #{"Flags".red}
74
28
  EOS
75
29
  opt :branch, "Enter your new branch name here, eg. stagecoach -b new_branch (optional)", :type => :string
76
- opt :redmine, "Enter your redmine/planio issue number here, eg. stagecoach -r 1234 (optional)", :type => :string
30
+ opt :deploy, "Use this option to deploy from your current branch to any branch you choose, eg. stagecoach -d staging", :type => :string
31
+ opt :from, "Use this option to set the branch you want to branch off from. Default is master", :type => :string, :default => "master"
77
32
  opt :github, "Enter your github issue number here, eg. stagecoach -g 1234 (optional)", :type => :string
78
33
  opt :push, "Use this option to push your changes to your remote branch (will be created if necessary)"
79
- opt :deploy, "Use this option to deploy from your current branch to any branch you choose, eg. stagecoach -d staging", :type => :string
34
+ opt :redmine, "Enter your redmine/planio issue number here, eg. stagecoach -r 1234 (optional)", :type => :string
80
35
  opt :setup, "Use this the first time you run stagecoach to save your redmine repository and api key"
36
+ opt :version, "Prints the current version"
81
37
  end
82
38
  end
83
39
  end
@@ -100,8 +100,8 @@ module Stagecoach
100
100
  puts `git checkout #{branch}`
101
101
  end
102
102
 
103
- def pull
104
- puts `git pull`
103
+ def pull(branch)
104
+ puts `git pull origin #{branch}`
105
105
  end
106
106
 
107
107
  def branch_exist?(branch)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "redmine_stagecoach"
8
- s.version = "0.6.4"
8
+ s.version = "0.6.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oli Barnett"]
12
- s.date = "2012-02-14"
12
+ s.date = "2012-03-27"
13
13
  s.description = "Git/capistrano workflow automation script with Redmine & Github issue integration"
14
14
  s.email = "o.barnett@digitaleseiten.de"
15
15
  s.executables = ["stagecoach"]
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.homepage = "http://github.com/omnikron/stagecoach"
43
43
  s.licenses = ["MIT"]
44
44
  s.require_paths = ["lib"]
45
- s.rubygems_version = "1.8.15"
45
+ s.rubygems_version = "1.8.18"
46
46
  s.summary = "Stagecoach is in ur Redmine, automating ur Git workflow."
47
47
 
48
48
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_stagecoach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-14 00:00:00.000000000Z
12
+ date: 2012-03-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activeresource
16
- requirement: &70099412421780 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70099412421780
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: ghi
27
- requirement: &70099412421300 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70099412421300
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: trollop
38
- requirement: &70099412420820 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70099412420820
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: capistrano
49
- requirement: &70099412420340 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70099412420340
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: shoulda
60
- requirement: &70099412419860 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70099412419860
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: bundler
71
- requirement: &70099412419380 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: 1.0.0
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70099412419380
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.0
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: jeweler
82
- requirement: &70099412418900 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
@@ -87,7 +117,12 @@ dependencies:
87
117
  version: 1.6.4
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70099412418900
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.6.4
91
126
  description: Git/capistrano workflow automation script with Redmine & Github issue
92
127
  integration
93
128
  email: o.barnett@digitaleseiten.de
@@ -133,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
168
  version: '0'
134
169
  segments:
135
170
  - 0
136
- hash: 699970911633980360
171
+ hash: -2310285675229824545
137
172
  required_rubygems_version: !ruby/object:Gem::Requirement
138
173
  none: false
139
174
  requirements:
@@ -142,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
177
  version: '0'
143
178
  requirements: []
144
179
  rubyforge_project:
145
- rubygems_version: 1.8.15
180
+ rubygems_version: 1.8.18
146
181
  signing_key:
147
182
  specification_version: 3
148
183
  summary: Stagecoach is in ur Redmine, automating ur Git workflow.