pivo_flow 0.3.3 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -3
- data/lib/pivo_flow/base.rb +6 -7
- data/lib/pivo_flow/cli.rb +20 -4
- data/lib/pivo_flow/errors.rb +11 -0
- data/lib/pivo_flow/pivotal.rb +44 -15
- data/lib/pivo_flow/version.rb +1 -1
- data/lib/pivo_flow.rb +1 -0
- data/pivo_flow.gemspec +3 -0
- data/spec/pivo_flow/base_spec.rb +84 -0
- data/spec/pivo_flow/cli_spec.rb +6 -6
- data/spec/pivo_flow/pivotal_spec.rb +113 -0
- data/spec/pivo_flow/vcr_cassettes/pivotal_fetch_project_not_found.yml +69 -0
- data/spec/pivo_flow/vcr_cassettes/pivotal_fetch_project_unauthorized.yml +50 -0
- data/spec/spec_helper.rb +22 -0
- metadata +43 -2
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PivoFlow
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/
|
3
|
+
[![Build Status](https://secure.travis-ci.org/lubieniebieski/pivo_flow.png?branch=master)](http://travis-ci.org/lubieniebieski/pivo_flow)
|
4
4
|
|
5
5
|
PivoFlow let's you choose the story from Pivotal Tracker you are currently working on. Intended for all the people, who doesn't like feature-branch approach or are "merdżuj - nie pier*ol"-theory enthusiasts.
|
6
6
|
|
@@ -55,8 +55,9 @@ This gem installs a `pepare-commit-msg` hook by adding a reference to `pf-prepar
|
|
55
55
|
* select story
|
56
56
|
* read the story description
|
57
57
|
* accept or back to story selection
|
58
|
-
*
|
59
|
-
*
|
58
|
+
* `pf info` displaying info about current task
|
59
|
+
* `pf --help` and other options via OptionParser
|
60
|
+
* comments and tasks in a single-story view
|
60
61
|
|
61
62
|
### 0.2
|
62
63
|
|
data/lib/pivo_flow/base.rb
CHANGED
@@ -6,7 +6,7 @@ module PivoFlow
|
|
6
6
|
# * installing git hook
|
7
7
|
|
8
8
|
class Base
|
9
|
-
|
9
|
+
attr_reader :options
|
10
10
|
# Git repository directory
|
11
11
|
GIT_DIR = '.git'
|
12
12
|
# Keys used by gem in git config, with corresponding questions which are
|
@@ -21,11 +21,7 @@ module PivoFlow
|
|
21
21
|
@options = options
|
22
22
|
@current_dir = Dir.pwd
|
23
23
|
|
24
|
-
|
25
|
-
unless File.directory?(File.join(@current_dir, GIT_DIR))
|
26
|
-
puts("no GIT (#{GIT_DIR}) directory found")
|
27
|
-
exit(1)
|
28
|
-
end
|
24
|
+
raise PivoFlow::Errors::NoGitRepoFound, "No git repository found" unless git_directory_present?
|
29
25
|
|
30
26
|
# paths
|
31
27
|
@git_dir = File.join(@current_dir, GIT_DIR)
|
@@ -45,11 +41,14 @@ module PivoFlow
|
|
45
41
|
!File.executable?(@git_hook_path) || !File.read(@git_hook_path).match(/#{@pf_git_hook_name} \$1/)
|
46
42
|
end
|
47
43
|
|
44
|
+
def git_directory_present?
|
45
|
+
File.directory?(File.join(@current_dir, GIT_DIR))
|
46
|
+
end
|
47
|
+
|
48
48
|
# Install git hook
|
49
49
|
# Copy hook to <tt>.git/hooks</tt> directory and add a reference to this
|
50
50
|
# executable file within <tt>prepare-commit-msg</tt> hook (it may be
|
51
51
|
# helpful if user has his custom hooks)
|
52
|
-
|
53
52
|
def install_git_hook
|
54
53
|
puts "Installing prepare-commit-msg hook..."
|
55
54
|
hook_path = File.join(File.dirname(__FILE__), '..', '..', 'bin', @pf_git_hook_name)
|
data/lib/pivo_flow/cli.rb
CHANGED
@@ -11,11 +11,18 @@ module PivoFlow
|
|
11
11
|
puts "\nkkthxbye!"
|
12
12
|
return 0
|
13
13
|
}
|
14
|
-
|
14
|
+
begin
|
15
|
+
return parse_argv(@args)
|
16
|
+
rescue *PivoFlow::Errors.exceptions => e
|
17
|
+
puts "[ERROR] #{e}"
|
18
|
+
return 1
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
private
|
18
23
|
|
24
|
+
# available commands
|
25
|
+
|
19
26
|
def stories
|
20
27
|
pivotal_object.show_stories
|
21
28
|
end
|
@@ -46,10 +53,16 @@ module PivoFlow
|
|
46
53
|
PivoFlow::Base.new.reconfig
|
47
54
|
end
|
48
55
|
|
56
|
+
def info
|
57
|
+
pivotal_object.show_info
|
58
|
+
end
|
59
|
+
|
49
60
|
def version
|
50
61
|
puts PivoFlow::VERSION
|
51
62
|
end
|
52
63
|
|
64
|
+
# additional methods
|
65
|
+
|
53
66
|
def pivotal_object
|
54
67
|
@pivotal_object ||= PivoFlow::Pivotal.new(@options)
|
55
68
|
end
|
@@ -69,6 +82,7 @@ module PivoFlow
|
|
69
82
|
opts.banner = "Usage: pf <COMMAND> [OPTIONS]\n"
|
70
83
|
opts.separator "Commands"
|
71
84
|
opts.separator " clear: clears STORY_ID from temp file"
|
85
|
+
opts.separator " info: shows info about current story"
|
72
86
|
opts.separator " finish [STORY_ID]: finish story on Pivotal"
|
73
87
|
opts.separator " reconfig: clears API_TOKEN and PROJECT_ID from git config"
|
74
88
|
opts.separator " start <STORY_ID>: start a story of given ID"
|
@@ -87,11 +101,11 @@ module PivoFlow
|
|
87
101
|
end
|
88
102
|
|
89
103
|
opts.on("-t <API_TOKEN>", "--token <API_TOKEN>", "Sets Pivotal Tracker API TOKEN") do |api_token|
|
90
|
-
@options[
|
104
|
+
@options["api-token"] = api_token
|
91
105
|
end
|
92
106
|
|
93
107
|
opts.on("-p <PROJECT_ID>", "--project <PROJECT_ID>", Numeric, "Sets Pivotal Tracker PROJECT_ID") do |project_id|
|
94
|
-
@options[
|
108
|
+
@options["project-id"] = project_id
|
95
109
|
end
|
96
110
|
|
97
111
|
end
|
@@ -109,9 +123,11 @@ module PivoFlow
|
|
109
123
|
stories
|
110
124
|
when "finish"
|
111
125
|
finish args[1]
|
126
|
+
when "info"
|
127
|
+
info
|
112
128
|
when nil
|
113
129
|
no_method_error
|
114
|
-
puts opt_parser.
|
130
|
+
puts opt_parser.to_s
|
115
131
|
return 1
|
116
132
|
else
|
117
133
|
invalid_method_error
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module PivoFlow
|
2
|
+
module Errors
|
3
|
+
exceptions_list = %w[ NoGitRepoFound UnsuccessfulPivotalConnection ]
|
4
|
+
exceptions_list.each { |e| const_set(e, Class.new(StandardError)) }
|
5
|
+
|
6
|
+
def self.exceptions
|
7
|
+
self.constants.map { |d| self.const_get(d) }
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
data/lib/pivo_flow/pivotal.rb
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module PivoFlow
|
3
3
|
class Pivotal < Base
|
4
|
-
|
5
4
|
def run
|
6
5
|
@story_id_file_name = ".pivotal_story_id"
|
7
6
|
@story_id_tmp_path = File.join(@current_dir, "/tmp")
|
8
7
|
@story_id_file_path = File.join(@story_id_tmp_path, @story_id_file_name)
|
9
8
|
|
10
|
-
return 1 unless @options["api-token"] && @options["project-id"]
|
11
9
|
PivotalTracker::Client.token = @options["api-token"]
|
12
10
|
PivotalTracker::Client.use_ssl = true
|
13
11
|
|
14
12
|
begin
|
15
13
|
@options[:project] ||= PivotalTracker::Project.find(@options["project-id"])
|
16
|
-
rescue
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
rescue Exception => e
|
15
|
+
message = "Pivotal Tracker: #{e.message}\n" +
|
16
|
+
"[TIPS] It means that your configuration is wrong. You can reset your settings by running:\n\tpf reconfig"
|
17
|
+
raise PivoFlow::Errors::UnsuccessfulPivotalConnection, message
|
20
18
|
end
|
21
19
|
|
22
20
|
end
|
@@ -58,7 +56,7 @@ module PivoFlow
|
|
58
56
|
|
59
57
|
def show_story story_id
|
60
58
|
story = find_story(story_id)
|
61
|
-
|
59
|
+
show_info story
|
62
60
|
proceed = ask_question "Do you want to start this story?"
|
63
61
|
accepted_answers = %w[yes y sure ofc jup yep yup ja tak]
|
64
62
|
if accepted_answers.include?(proceed.downcase)
|
@@ -68,8 +66,17 @@ module PivoFlow
|
|
68
66
|
end
|
69
67
|
end
|
70
68
|
|
69
|
+
def show_info story=nil
|
70
|
+
story = current_story if story.nil?
|
71
|
+
puts story_string(story, true)
|
72
|
+
puts "\n[TASKS]"
|
73
|
+
story.tasks.all.count.zero? ? puts(" no tasks") : print_tasks(story.tasks.all)
|
74
|
+
puts "\n[NOTES]"
|
75
|
+
story.notes.all.count.zero? ? puts(" no notes") : print_notes(story.notes.all)
|
76
|
+
end
|
77
|
+
|
71
78
|
def find_story story_id
|
72
|
-
story = project_stories.find { |p| p.id == story_id }
|
79
|
+
story = project_stories.find { |p| p.id == story_id.to_i }
|
73
80
|
story.nil? ? @options[:project].stories.find(story_id) : story
|
74
81
|
end
|
75
82
|
|
@@ -82,22 +89,40 @@ module PivoFlow
|
|
82
89
|
estimate: estimate_points(story),
|
83
90
|
owner: story_owner(story),
|
84
91
|
description: story.description,
|
85
|
-
labels: story
|
92
|
+
labels: story_labels(story),
|
86
93
|
started: story.current_state == "started" ? "S" : "N"
|
87
94
|
}
|
88
95
|
if long
|
89
96
|
"STORY %{started} %{story_type} [#%{story_id}]
|
90
|
-
Name:
|
91
|
-
Labels:
|
92
|
-
Owned by:
|
97
|
+
Name: %{name}
|
98
|
+
Labels: %{labels}
|
99
|
+
Owned by: %{owner}
|
93
100
|
Requested by: %{requested_by}
|
94
|
-
Description:
|
95
|
-
Estimate:
|
101
|
+
Description: %{description}
|
102
|
+
Estimate: %{estimate}" % vars
|
96
103
|
else
|
97
104
|
"[#%{story_id}] (%{started}) %{story_type} [%{estimate} pts.] %{owner} %{name}" % vars
|
98
105
|
end
|
99
106
|
end
|
100
107
|
|
108
|
+
|
109
|
+
def print_tasks tasks
|
110
|
+
tasks.each { |task| puts task_string(task) }
|
111
|
+
end
|
112
|
+
|
113
|
+
def print_notes notes
|
114
|
+
notes.each { |note| puts note_string(note) }
|
115
|
+
end
|
116
|
+
|
117
|
+
def note_string note
|
118
|
+
"\t[#{note.noted_at.to_time}] (#{note.author}) #{note.text}"
|
119
|
+
end
|
120
|
+
|
121
|
+
def task_string task
|
122
|
+
complete = task.complete ? "x" : " "
|
123
|
+
"\t[#{complete}] #{task.description}"
|
124
|
+
end
|
125
|
+
|
101
126
|
def story_type_icon story
|
102
127
|
case story.story_type
|
103
128
|
when "feature" then "☆"
|
@@ -115,8 +140,12 @@ module PivoFlow
|
|
115
140
|
story.owned_by.nil? ? "(--)" : "(#{initials(story.owned_by)})"
|
116
141
|
end
|
117
142
|
|
143
|
+
def story_labels story
|
144
|
+
story.labels.nil? ? "" : story.labels.split(",").map{ |l| "##{l}" }.join(", ")
|
145
|
+
end
|
146
|
+
|
118
147
|
def initials name
|
119
|
-
name.split.map{ |n| n[0]}.join
|
148
|
+
name.split.map{ |n| n[0] }.join
|
120
149
|
end
|
121
150
|
|
122
151
|
def estimate_points story
|
data/lib/pivo_flow/version.rb
CHANGED
data/lib/pivo_flow.rb
CHANGED
data/pivo_flow.gemspec
CHANGED
@@ -18,8 +18,11 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_runtime_dependency "pivotal-tracker"
|
19
19
|
gem.add_runtime_dependency "grit"
|
20
20
|
gem.add_runtime_dependency "highline"
|
21
|
+
|
21
22
|
gem.add_development_dependency "rspec"
|
22
23
|
gem.add_development_dependency "simplecov"
|
23
24
|
gem.add_development_dependency "rake"
|
25
|
+
gem.add_development_dependency "vcr"
|
26
|
+
gem.add_development_dependency "fakeweb"
|
24
27
|
|
25
28
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative './../../lib/pivo_flow/errors'
|
3
|
+
describe PivoFlow::Base do
|
4
|
+
|
5
|
+
let(:base) { PivoFlow::Base.new }
|
6
|
+
|
7
|
+
before do
|
8
|
+
PivoFlow::Base.any_instance.stub(:puts)
|
9
|
+
stub_git_config
|
10
|
+
stub_base_methods(PivoFlow::Base)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "raises exception if it's outside of git repo" do
|
14
|
+
PivoFlow::Base.any_instance.stub(:git_directory_present?).and_return(false)
|
15
|
+
expect{base}.to raise_error(PivoFlow::Errors::NoGitRepoFound)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "calls hook installation if it's needed" do
|
19
|
+
PivoFlow::Base.any_instance.stub(:git_hook_needed?).and_return(true)
|
20
|
+
PivoFlow::Base.any_instance.should_receive(:install_git_hook)
|
21
|
+
base
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "pre commit hoook" do
|
25
|
+
|
26
|
+
let(:file_name) { ".git/hooks/prepare-commit-msg" }
|
27
|
+
let(:pf_file_name) { ".git/hooks/pf-prepare-commit-msg" }
|
28
|
+
|
29
|
+
before do
|
30
|
+
File.delete file_name if File.exists? file_name
|
31
|
+
base
|
32
|
+
end
|
33
|
+
|
34
|
+
it "creates an executable prepare-commit-msg file" do
|
35
|
+
base.install_git_hook
|
36
|
+
File.executable?(file_name).should be_true
|
37
|
+
end
|
38
|
+
|
39
|
+
it "creates an executable pf-prepare-commit-msg file" do
|
40
|
+
File.delete pf_file_name if File.exists? pf_file_name
|
41
|
+
base.install_git_hook
|
42
|
+
File.executable?(pf_file_name).should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "parses git config" do
|
48
|
+
|
49
|
+
it "and returns project id" do
|
50
|
+
base.options["project-id"].should eq "123456"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "and returns api token" do
|
54
|
+
base.options["api-token"].should eq "testtesttesttesttesttesttesttest"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "returns user name" do
|
58
|
+
base.user_name.should eq "Adam Newman"
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "adding configuration" do
|
64
|
+
|
65
|
+
before(:each) do
|
66
|
+
stub_git_config({
|
67
|
+
'pivo-flow.api-token' => nil,
|
68
|
+
'pivo-flow.project-id' => nil}
|
69
|
+
)
|
70
|
+
PivoFlow::Base.any_instance.stub(:git_config_ok?).and_return(false)
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
PivoFlow::Base::KEYS_AND_QUESTIONS.each do |key, value|
|
75
|
+
it "changes #{key} value" do
|
76
|
+
PivoFlow::Base.any_instance.stub(:ask_question).and_return(key)
|
77
|
+
new_key = key.split(".").last
|
78
|
+
base.options[new_key].should eq key
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/spec/pivo_flow/cli_spec.rb
CHANGED
@@ -60,13 +60,13 @@ describe PivoFlow::Cli do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
|
-
|
64
|
-
|
65
|
-
methods = [:stories, :start, :finish, :clear, :reconfig]
|
66
|
-
|
63
|
+
describe "should allow to run command named" do
|
64
|
+
methods = [:stories, :start, :info, :finish, :clear, :reconfig]
|
67
65
|
methods.each do |method|
|
68
|
-
|
69
|
-
|
66
|
+
it "#{method.to_s}" do
|
67
|
+
PivoFlow::Cli.any_instance.stub(method)
|
68
|
+
PivoFlow::Cli.new(method.to_s).go!.should eq 0
|
69
|
+
end
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe PivoFlow::Pivotal do
|
4
|
+
|
5
|
+
let(:pivotal) { PivoFlow::Pivotal.new }
|
6
|
+
|
7
|
+
before do
|
8
|
+
stub_git_config
|
9
|
+
|
10
|
+
stub_base_methods(PivoFlow::Pivotal)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "raises exception" do
|
14
|
+
it "when project id is incorrect" do
|
15
|
+
VCR.use_cassette(:pivotal_fetch_project_not_found) do
|
16
|
+
expect{pivotal.run}.to raise_error(PivoFlow::Errors::UnsuccessfulPivotalConnection)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "when api-token is incorrect (unauthorized)" do
|
21
|
+
VCR.use_cassette(:pivotal_fetch_project_unauthorized) do
|
22
|
+
expect{pivotal.run}.to raise_error(PivoFlow::Errors::UnsuccessfulPivotalConnection)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "methods" do
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
stub_pivotal_project
|
32
|
+
pivotal.run
|
33
|
+
end
|
34
|
+
|
35
|
+
it "fetches with correct id" do
|
36
|
+
pivotal.options[:project].id.should eq 123456
|
37
|
+
end
|
38
|
+
|
39
|
+
it "user_stories takes only stories owned by current user" do
|
40
|
+
pivotal.user_stories.should eq [@story_feature]
|
41
|
+
end
|
42
|
+
|
43
|
+
it "unasigned_stories takes only stories with no user" do
|
44
|
+
pivotal.unasigned_stories.should eq [@story_unassigned]
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "start_story" do
|
48
|
+
before(:each) do
|
49
|
+
@story_feature.stub_chain(:update, :errors, :count).and_return(0)
|
50
|
+
@story_feature.should_receive(:update).with({ current_state: :started, owned_by: pivotal.user_name })
|
51
|
+
end
|
52
|
+
|
53
|
+
it "updates pivotal tracker" do
|
54
|
+
pivotal.start_story(@story_feature.id)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "returns true on success" do
|
58
|
+
pivotal.start_story(@story_feature.id).should be_true
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "current_story" do
|
64
|
+
before(:each) do
|
65
|
+
@users_story1 = PivotalTracker::Story.new(owned_by: pivotal.user_name, current_state: "started")
|
66
|
+
@users_story2 = PivotalTracker::Story.new(owned_by: pivotal.user_name, current_state: "started")
|
67
|
+
@users_story3 = PivotalTracker::Story.new(owned_by: pivotal.user_name, current_state: "unstarted")
|
68
|
+
@users_story4 = PivotalTracker::Story.new(owned_by: pivotal.user_name, current_state: "unstarted")
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
it "is the first of user's started stories" do
|
73
|
+
@project.stub_chain(:stories, :all).and_return([@users_story1, @users_story2])
|
74
|
+
|
75
|
+
pivotal.current_story.should eq @users_story1
|
76
|
+
end
|
77
|
+
|
78
|
+
it "is the first of user's stories if he has no started stories" do
|
79
|
+
@project.stub_chain(:stories, :all).and_return([@users_story3, @users_story4])
|
80
|
+
|
81
|
+
pivotal.current_story.should eq @users_story3
|
82
|
+
end
|
83
|
+
|
84
|
+
it "is nil if there is no stories assigned to user" do
|
85
|
+
@project.stub_chain(:stories, :all).and_return([])
|
86
|
+
pivotal.current_story.should be_nil
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
def stub_pivotal_project
|
96
|
+
@project = PivotalTracker::Project.new(id: 123456, name: "testproject")
|
97
|
+
@story_feature = PivotalTracker::Story.new(
|
98
|
+
id: 1,
|
99
|
+
url: "http://www.pivotaltracker.com/story/show/1",
|
100
|
+
created_at: DateTime.now,
|
101
|
+
project_id: 123456,
|
102
|
+
name: "story no 1",
|
103
|
+
description: "story description",
|
104
|
+
story_type: "feature",
|
105
|
+
estimate: 3,
|
106
|
+
current_state: "started",
|
107
|
+
requested_by: "Paul Newman",
|
108
|
+
owned_by: "Adam Newman",
|
109
|
+
labels: "first,second")
|
110
|
+
@story_unassigned = PivotalTracker::Story.new(owned_by: nil)
|
111
|
+
@project.stub_chain(:stories, :all).and_return([@story_feature, @story_unassigned])
|
112
|
+
PivotalTracker::Project.stub(:find).and_return(@project)
|
113
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.pivotaltracker.com/services/v3/projects/123456
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
accept-encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
x-trackertoken:
|
15
|
+
- !binary |-
|
16
|
+
dGVzdHRlc3R0ZXN0dGVzdHRlc3R0ZXN0dGVzdHRlc3Q=
|
17
|
+
content-type:
|
18
|
+
- application/xml
|
19
|
+
user-agent:
|
20
|
+
- Ruby
|
21
|
+
response:
|
22
|
+
status:
|
23
|
+
code: 404
|
24
|
+
message: !binary |-
|
25
|
+
Tm90IEZvdW5k
|
26
|
+
headers:
|
27
|
+
!binary "Y29udGVudC10eXBl":
|
28
|
+
- !binary |-
|
29
|
+
YXBwbGljYXRpb24veG1sOyBjaGFyc2V0PXV0Zi04
|
30
|
+
!binary "dHJhbnNmZXItZW5jb2Rpbmc=":
|
31
|
+
- !binary |-
|
32
|
+
Y2h1bmtlZA==
|
33
|
+
!binary "Y29ubmVjdGlvbg==":
|
34
|
+
- !binary |-
|
35
|
+
Y2xvc2U=
|
36
|
+
!binary "c3RhdHVz":
|
37
|
+
- !binary |-
|
38
|
+
NDA0
|
39
|
+
!binary "eC1wb3dlcmVkLWJ5":
|
40
|
+
- !binary |-
|
41
|
+
UGh1c2lvbiBQYXNzZW5nZXIgKG1vZF9yYWlscy9tb2RfcmFjaykgMy4wLjE0
|
42
|
+
!binary "Y2FjaGUtY29udHJvbA==":
|
43
|
+
- !binary |-
|
44
|
+
bm8tY2FjaGU=
|
45
|
+
!binary "c2V0LWNvb2tpZQ==":
|
46
|
+
- !binary |-
|
47
|
+
dF9zZXNzaW9uPUJBaDdCem9QWlhod2FYSmxjMTloZEVsMU9nbFVhVzFsRFhN
|
48
|
+
ZUhJQ1dwbTdzQmpvZlFHMWhjbk5vWVd4ZmQybDBhRjkxZEdOZlkyOWxjbU5w
|
49
|
+
YjI1R09nOXpaWE56YVc5dVgybGtJaVUzWVRRNE9EYzRZV1JoTXpCbE4yWTBO
|
50
|
+
bVl6TkdSa1lqTmlNRFkyWTJJNU5nJTNEJTNELS1jYzA0MTQ4OTQ4ZDRmNGE2
|
51
|
+
ODBhOTcxNjdlMWFjZDEyNjliMzUyMDg3OyBwYXRoPS87IHNlY3VyZTsgSHR0
|
52
|
+
cE9ubHk=
|
53
|
+
!binary "c2VydmVy":
|
54
|
+
- !binary |-
|
55
|
+
bmdpbngvMS4yLjIgKyBQaHVzaW9uIFBhc3NlbmdlciAzLjAuMTQgKG1vZF9y
|
56
|
+
YWlscy9tb2RfcmFjayk=
|
57
|
+
!binary "Y29udGVudC1lbmNvZGluZw==":
|
58
|
+
- !binary |-
|
59
|
+
Z3ppcA==
|
60
|
+
body:
|
61
|
+
encoding: ASCII-8BIT
|
62
|
+
string: !binary |-
|
63
|
+
H4sIAAAAAAAAA7Oxr8jNUShLLSrOzM+zVTLUM1BSSM1Lzk/JzEu3VQoNcdO1
|
64
|
+
ULK347LJTS0uTkxPtQtKLc4vLUpOVcjLL1FIyy/NS7HRh8lxAQD8+cQBTQAA
|
65
|
+
AA==
|
66
|
+
http_version: !binary |-
|
67
|
+
MS4x
|
68
|
+
recorded_at: Sun, 12 Aug 2012 19:59:06 GMT
|
69
|
+
recorded_with: VCR 2.2.4
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.pivotaltracker.com/services/v3/projects/123456
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
accept-encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
x-trackertoken:
|
15
|
+
- !binary |-
|
16
|
+
dGVzdHRlc3R0ZXN0dGVzdHRlc3R0ZXN0dGVzdHRlc3Q=
|
17
|
+
content-type:
|
18
|
+
- application/xml
|
19
|
+
user-agent:
|
20
|
+
- Ruby
|
21
|
+
response:
|
22
|
+
status:
|
23
|
+
code: 401
|
24
|
+
message: Unauthorized
|
25
|
+
headers:
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
content-length:
|
29
|
+
- '15'
|
30
|
+
connection:
|
31
|
+
- close
|
32
|
+
status:
|
33
|
+
- '401'
|
34
|
+
x-powered-by:
|
35
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.14
|
36
|
+
cache-control:
|
37
|
+
- no-cache
|
38
|
+
set-cookie:
|
39
|
+
- t_session=BAh7BzoPZXhwaXJlc19hdEl1OglUaW1lDXQeHIBq12cCBjofQG1hcnNoYWxfd2l0aF91dGNfY29lcmNpb25GOg9zZXNzaW9uX2lkIiU3MmQyNTA4MGE1OGE2M2JlNmFkMWZlMTY1ZTgzNjdkMg%3D%3D--ed2d695aaf7f6de6f4fdb6f7ce12548268b4a5c6;
|
40
|
+
path=/; secure; HttpOnly
|
41
|
+
server:
|
42
|
+
- nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ! 'Access denied.
|
46
|
+
|
47
|
+
'
|
48
|
+
http_version: '1.1'
|
49
|
+
recorded_at: Sun, 12 Aug 2012 20:00:38 GMT
|
50
|
+
recorded_with: VCR 2.2.4
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,29 @@
|
|
1
1
|
require 'simplecov'
|
2
|
+
|
2
3
|
SimpleCov.start
|
3
4
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
5
|
|
5
6
|
require 'pivo_flow'
|
7
|
+
require 'vcr'
|
6
8
|
require 'rspec'
|
7
9
|
|
10
|
+
VCR.configure do |c|
|
11
|
+
c.hook_into :fakeweb # or :fakeweb
|
12
|
+
c.cassette_library_dir = 'spec/pivo_flow/vcr_cassettes'
|
13
|
+
end
|
14
|
+
|
15
|
+
def stub_git_config(options = {})
|
16
|
+
git_options = {
|
17
|
+
"pivo-flow.api-token" => "testtesttesttesttesttesttesttest",
|
18
|
+
"pivo-flow.project-id" => "123456",
|
19
|
+
"user.name" => "Adam Newman"
|
20
|
+
}.merge options
|
21
|
+
Grit::Repo.stub!(:new).and_return mock('Grit::Repo', :config => git_options)
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def stub_base_methods(klass)
|
26
|
+
klass.any_instance.stub(:git_hook_needed?).and_return(false)
|
27
|
+
klass.any_instance.stub(:git_directory_present?).and_return(true)
|
28
|
+
klass.any_instance.stub(:git_config_ok?).and_return(true)
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivo_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pivotal-tracker
|
@@ -107,6 +107,38 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: vcr
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: fakeweb
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
110
142
|
description: Automated querying for pivotal stories, adding story id to commit message,
|
111
143
|
etc.
|
112
144
|
email:
|
@@ -129,10 +161,15 @@ files:
|
|
129
161
|
- lib/pivo_flow.rb
|
130
162
|
- lib/pivo_flow/base.rb
|
131
163
|
- lib/pivo_flow/cli.rb
|
164
|
+
- lib/pivo_flow/errors.rb
|
132
165
|
- lib/pivo_flow/pivotal.rb
|
133
166
|
- lib/pivo_flow/version.rb
|
134
167
|
- pivo_flow.gemspec
|
168
|
+
- spec/pivo_flow/base_spec.rb
|
135
169
|
- spec/pivo_flow/cli_spec.rb
|
170
|
+
- spec/pivo_flow/pivotal_spec.rb
|
171
|
+
- spec/pivo_flow/vcr_cassettes/pivotal_fetch_project_not_found.yml
|
172
|
+
- spec/pivo_flow/vcr_cassettes/pivotal_fetch_project_unauthorized.yml
|
136
173
|
- spec/spec_helper.rb
|
137
174
|
homepage: https://github.com/lubieniebieski/pivo_flow
|
138
175
|
licenses: []
|
@@ -159,6 +196,10 @@ signing_key:
|
|
159
196
|
specification_version: 3
|
160
197
|
summary: Simple pivotal tracker integration for day to day work with git
|
161
198
|
test_files:
|
199
|
+
- spec/pivo_flow/base_spec.rb
|
162
200
|
- spec/pivo_flow/cli_spec.rb
|
201
|
+
- spec/pivo_flow/pivotal_spec.rb
|
202
|
+
- spec/pivo_flow/vcr_cassettes/pivotal_fetch_project_not_found.yml
|
203
|
+
- spec/pivo_flow/vcr_cassettes/pivotal_fetch_project_unauthorized.yml
|
163
204
|
- spec/spec_helper.rb
|
164
205
|
has_rdoc:
|