git_story 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
- - jruby-19mode
6
5
  - rbx-19mode
7
6
  - ruby-head
8
- - jruby-head
9
7
  script: bundle exec rspec spec
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 project id and api token to you enviraonment variables:
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
- 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.
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module GitStory
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -25,7 +25,23 @@ class TrackerFetchedMapper
25
25
 
26
26
  hydra = Typhoeus::Hydra.new
27
27
 
28
- projects = ENV['TRACKER_PROJECT_ID'].split(",")
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 = []
@@ -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|
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.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: