git_story 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -0
- data/README.md +42 -8
- data/bin/git-story +1 -1
- data/git_story.gemspec +2 -0
- data/lib/git_story/version.rb +1 -1
- data/lib/git_story.rb +9 -1
- data/lib/tracker_fetched_mapper.rb +24 -9
- metadata +43 -5
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# GitStory
|
2
2
|
|
3
|
-
|
3
|
+
This gem is a helper for checking which commits in your git repository belonges to unaccepted PivotalTracker's story so that you can make a decision whether you should deploy those commits or not.
|
4
|
+
|
5
|
+
[![Build Status](https://secure.travis-ci.org/visibletrap/git_story.png)](http://travis-ci.org/visibletrap/git_story)
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -15,15 +17,47 @@ And then execute:
|
|
15
17
|
Or install it yourself as:
|
16
18
|
|
17
19
|
$ gem install git_story
|
20
|
+
|
21
|
+
Then you need to set PivotalTraker's project id and api token to you enviraonment variables:
|
22
|
+
|
23
|
+
export TRACKER_PROJECT_ID=your_pivotal_tracker_project_id
|
24
|
+
export TRACKER_TOKEN=your_pivotal_tracker_api_token
|
25
|
+
|
26
|
+
In the case of shared repository across multiple Tracker projects, you can put project ids with comma-separated format.
|
27
|
+
|
28
|
+
export TRACKER_PROJECT_ID=1,2,3,...
|
29
|
+
|
30
|
+
Setting permanently by append them to your .profile or .bashrc or .bash_profile.
|
31
|
+
|
32
|
+
## Requirements
|
33
|
+
|
34
|
+
This gem required you to put **[#tracker_story_id]** in the begining of commit messages to specify relationships between commit and story.
|
18
35
|
|
19
36
|
## Usage
|
20
37
|
|
21
|
-
|
38
|
+
$ git story <after_commit> <until_commit>
|
39
|
+
|
40
|
+
**\<commit>** can be **sha-1** or **branch name** or **tag**
|
41
|
+
|
42
|
+
## Example
|
43
|
+
|
44
|
+
$ git story e1a4be4 9a5bfa42
|
45
|
+
9a5bfa42712ba2a5cc76b504966d05bfd848892c #29606203 delivered
|
46
|
+
9f40f97dfa2200c4fdd94aa38d03d52d9123bb69 #29973257 delivered
|
47
|
+
ac7f751c58d16453b2c4b4c9005cd5f8936cdd18 #29306719 finished
|
48
|
+
0030d2bd62b41092bfb81f9b20b6f00c83a99bf5 #29537523 delivered
|
49
|
+
fcb41b56a5bcf9e66ce9f83d6b4583d7b1ab01bd #30061821 rejected
|
50
|
+
b8500d607ead27c3c277e2ac03f18ccaaeb645b0 #30128209 delivered
|
51
|
+
or
|
52
|
+
|
53
|
+
$ git story origin/production staging_tag
|
54
|
+
|
55
|
+
|
56
|
+
## Notice
|
57
|
+
|
58
|
+
- Current implementation is ignoring **unknown stories** and **non-story_id prefixed commit**.
|
59
|
+
- If many commits are belonging to a story, only one commit will be displayed.
|
22
60
|
|
23
|
-
##
|
61
|
+
## Contributors
|
24
62
|
|
25
|
-
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
63
|
+
- [acroca](https://github.com/acroca)
|
data/bin/git-story
CHANGED
data/git_story.gemspec
CHANGED
data/lib/git_story/version.rb
CHANGED
data/lib/git_story.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "git_story/version"
|
2
2
|
|
3
3
|
require_relative 'manual_git_commit_lister'
|
4
4
|
require_relative 'split_and_match_processor'
|
@@ -8,6 +8,14 @@ require_relative 'puts_renderer'
|
|
8
8
|
module GitStory
|
9
9
|
|
10
10
|
def state(since, until_commit)
|
11
|
+
if ENV["TRACKER_PROJECT_ID"].to_s.size == 0
|
12
|
+
puts "Please, set TRACKER_PROJECT_ID"
|
13
|
+
abort
|
14
|
+
end
|
15
|
+
if ENV["TRACKER_TOKEN"].to_s.size == 0
|
16
|
+
puts "Please, set TRACKER_TOKEN"
|
17
|
+
abort
|
18
|
+
end
|
11
19
|
commit_state_factory.list(since, until_commit)
|
12
20
|
end
|
13
21
|
|
@@ -21,20 +21,35 @@ class TrackerFetchedMapper
|
|
21
21
|
require 'net/http'
|
22
22
|
require 'uri'
|
23
23
|
require 'nokogiri'
|
24
|
+
require 'typhoeus'
|
24
25
|
|
25
|
-
|
26
|
-
resource_uri = URI.parse(request)
|
27
|
-
response = Net::HTTP.start(resource_uri.host, resource_uri.port) do |http|
|
28
|
-
http.get(resource_uri.to_s, {'X-TrackerToken' => ENV['TRACKER_TOKEN']})
|
29
|
-
end
|
26
|
+
hydra = Typhoeus::Hydra.new
|
30
27
|
|
31
|
-
|
28
|
+
projects = ENV['TRACKER_PROJECT_ID'].split(",")
|
29
|
+
stories_qs = stories.join(',')
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
requests = []
|
32
|
+
projects.each do |project_id|
|
33
|
+
request = Typhoeus::Request.new(
|
34
|
+
"http://www.pivotaltracker.com/services/v3/projects/#{project_id}/stories?filter=id:#{stories_qs}&includedone:true",
|
35
|
+
headers: {'X-TrackerToken' => ENV['TRACKER_TOKEN']})
|
36
|
+
|
37
|
+
request.on_complete do |response|
|
38
|
+
doc = Nokogiri::XML(response.body)
|
39
|
+
|
40
|
+
{}.tap do |h|
|
41
|
+
doc.xpath('//stories/story').map do |e|
|
42
|
+
h[e.xpath('id').text] = e.xpath('current_state').text.to_sym
|
43
|
+
end
|
44
|
+
end
|
36
45
|
end
|
46
|
+
|
47
|
+
requests << request
|
48
|
+
hydra.queue request
|
37
49
|
end
|
50
|
+
hydra.run
|
51
|
+
|
52
|
+
requests.inject({}){|acc, r| acc.merge(r.handled_response) }
|
38
53
|
end
|
39
54
|
|
40
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_story
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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-05-
|
12
|
+
date: 2012-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,44 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: nokogiri
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.5'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.5'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: typhoeus
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.3'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
25
62
|
description: ! "\n This gem help you check which commits in your git repository
|
26
63
|
belonges to unaccepted PivotalTracker's story\n so that you can make a decision
|
27
64
|
whether you should deploy those commits or not.\n "
|
@@ -33,6 +70,7 @@ extensions: []
|
|
33
70
|
extra_rdoc_files: []
|
34
71
|
files:
|
35
72
|
- .gitignore
|
73
|
+
- .travis.yml
|
36
74
|
- Gemfile
|
37
75
|
- LICENSE
|
38
76
|
- README.md
|
@@ -68,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
106
|
version: '0'
|
69
107
|
requirements: []
|
70
108
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
109
|
+
rubygems_version: 1.8.24
|
72
110
|
signing_key:
|
73
111
|
specification_version: 3
|
74
112
|
summary: shows unaccepted status of PivotalTracker's story that git commits belong
|