git_story 0.2.0 → 0.2.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.
- data/.travis.yml +0 -2
- data/README.md +11 -8
- data/lib/git_story.rb +0 -4
- data/lib/git_story/version.rb +1 -1
- data/lib/tracker_fetched_mapper.rb +17 -1
- data/spec/git_story_spec.rb +5 -0
- metadata +1 -1
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -18,16 +18,19 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install git_story
|
20
20
|
|
21
|
-
Then you need to set PivotalTraker's
|
21
|
+
Then you need to set PivotalTraker's api token to your environment variable:
|
22
22
|
|
23
|
-
export TRACKER_PROJECT_ID=your_pivotal_tracker_project_id
|
24
23
|
export TRACKER_TOKEN=your_pivotal_tracker_api_token
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
Or set permanently by append it to .profile or .bashrc or .bash_profile.
|
26
|
+
|
27
|
+
## Specific projects
|
28
|
+
|
29
|
+
By default, git-story will check from all of your PivotalTracker projects, but you can also set a specific list of projects. To do so, just add another environment variable like following:
|
30
|
+
|
31
|
+
export TRACKER_PROJECT_ID=your_pivotal_tracker_project_id
|
32
|
+
|
33
|
+
If you need to set multiple projects, add them using comma separated format.
|
31
34
|
|
32
35
|
## Requirements
|
33
36
|
|
@@ -60,4 +63,4 @@ or
|
|
60
63
|
|
61
64
|
## Contributors
|
62
65
|
|
63
|
-
- [acroca](https://github.com/acroca)
|
66
|
+
- [acroca](https://github.com/acroca)
|
data/lib/git_story.rb
CHANGED
@@ -8,10 +8,6 @@ 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
11
|
if ENV["TRACKER_TOKEN"].to_s.size == 0
|
16
12
|
puts "Please, set TRACKER_TOKEN"
|
17
13
|
abort
|
data/lib/git_story/version.rb
CHANGED
@@ -25,7 +25,23 @@ class TrackerFetchedMapper
|
|
25
25
|
|
26
26
|
hydra = Typhoeus::Hydra.new
|
27
27
|
|
28
|
-
|
28
|
+
if ENV['TRACKER_PROJECT_ID']
|
29
|
+
projects = ENV['TRACKER_PROJECT_ID'].split(",")
|
30
|
+
else
|
31
|
+
request = Typhoeus::Request.new(
|
32
|
+
"http://www.pivotaltracker.com/services/v3/projects",
|
33
|
+
headers: {'X-TrackerToken' => ENV['TRACKER_TOKEN']})
|
34
|
+
request.on_complete do |response|
|
35
|
+
doc = Nokogiri::XML(response.body)
|
36
|
+
|
37
|
+
doc.xpath('//projects/project').map do |e|
|
38
|
+
e.xpath('id').text.to_i
|
39
|
+
end
|
40
|
+
end
|
41
|
+
hydra.queue request
|
42
|
+
hydra.run
|
43
|
+
projects = request.handled_response
|
44
|
+
end
|
29
45
|
stories_qs = stories.join(',')
|
30
46
|
|
31
47
|
requests = []
|
data/spec/git_story_spec.rb
CHANGED
@@ -11,6 +11,10 @@ describe GitStory do
|
|
11
11
|
let(:stories) { %w(29981485 29521391 29977427 29977409) }
|
12
12
|
let(:states) { %w(accepted rejected finished started).each(&:to_sym) }
|
13
13
|
|
14
|
+
def set_up_parameters
|
15
|
+
ENV['TRACKER_TOKEN'] = 'fake tracker token'
|
16
|
+
end
|
17
|
+
|
14
18
|
def stub_git
|
15
19
|
raw_commit = <<raw_git_commit
|
16
20
|
#{commits[3]} [##{stories[3]}] Filtered by platform
|
@@ -26,6 +30,7 @@ raw_git_commit
|
|
26
30
|
end
|
27
31
|
|
28
32
|
it "run through CommitLister to Renderer" do
|
33
|
+
set_up_parameters
|
29
34
|
stub_git
|
30
35
|
stub_network
|
31
36
|
render_input = {}.tap do |h|
|