pv 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pv/bug_tracker.rb +1 -1
- data/lib/pv/command.rb +18 -5
- data/lib/pv/configuration.rb +15 -3
- data/lib/pv/story.rb +11 -0
- data/lib/pv/version.rb +1 -1
- data/pv.gemspec +2 -1
- data/spec/fixtures/pv.project.yml +4 -0
- data/spec/{extensions → lib/core_ext}/object_spec.rb +0 -0
- data/spec/{extensions → lib/core_ext}/string_spec.rb +0 -0
- data/spec/{models → lib/pv}/bug_tracker_spec.rb +0 -0
- data/spec/lib/pv/configuration_spec.rb +80 -0
- data/spec/{models → lib/pv}/story_spec.rb +5 -0
- metadata +40 -22
- data/spec/models/configuration_spec.rb +0 -43
data/lib/pv/bug_tracker.rb
CHANGED
data/lib/pv/command.rb
CHANGED
@@ -7,11 +7,8 @@ module Pv
|
|
7
7
|
default_task :log
|
8
8
|
desc :log, "Show every story assigned to you on this project."
|
9
9
|
def log
|
10
|
-
Pv.tracker.stories.each do |
|
11
|
-
|
12
|
-
author = set_color story.requested_by, Thor::Shell::Color::WHITE
|
13
|
-
|
14
|
-
say "* #{id} #{story.name} #{author}"
|
10
|
+
Pv.tracker.stories.each do |from_data|
|
11
|
+
preview Story.new(from_data)
|
15
12
|
end
|
16
13
|
end
|
17
14
|
|
@@ -65,5 +62,21 @@ module Pv
|
|
65
62
|
def open story_id
|
66
63
|
run "open https://www.pivotaltracker.com/story/show/#{story_id}"
|
67
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
no_tasks do
|
68
|
+
def preview story
|
69
|
+
id = set_color "#{story.id}", Thor::Shell::Color::YELLOW
|
70
|
+
author = set_color story.requested_by, Thor::Shell::Color::WHITE
|
71
|
+
status = if story.in_progress?
|
72
|
+
set_color " (#{story.current_state})", Thor::Shell::Color::BLUE
|
73
|
+
else
|
74
|
+
""
|
75
|
+
end
|
76
|
+
prefix = "* #{id}" + status
|
77
|
+
|
78
|
+
say "#{prefix} #{story.name} #{author}"
|
79
|
+
end
|
80
|
+
end
|
68
81
|
end
|
69
82
|
end
|
data/lib/pv/configuration.rb
CHANGED
@@ -5,8 +5,7 @@ module Pv
|
|
5
5
|
attr_reader :username, :password, :attributes, :project_id, :name
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
@
|
9
|
-
@attributes = YAML::load_file @path
|
8
|
+
@attributes = YAML::load_file from_path
|
10
9
|
@username = @attributes['username']
|
11
10
|
@password = @attributes['password']
|
12
11
|
@project_id = @attributes['project_id']
|
@@ -14,7 +13,20 @@ module Pv
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def present?
|
17
|
-
File.exists?
|
16
|
+
File.exists? from_path
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def from_path
|
21
|
+
File.expand_path yaml_file_location
|
22
|
+
end
|
23
|
+
|
24
|
+
def yaml_file_location
|
25
|
+
if File.exists? "#{Dir.pwd}/.pv"
|
26
|
+
"#{Dir.pwd}/.pv"
|
27
|
+
else
|
28
|
+
"~/.pv"
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|
data/lib/pv/story.rb
CHANGED
@@ -30,6 +30,17 @@ module Pv
|
|
30
30
|
template.result(binding)
|
31
31
|
end
|
32
32
|
|
33
|
+
# This story is "in progress" if its code has not left
|
34
|
+
# the dev machine, or is on stage and hasn't been pushed
|
35
|
+
# to production yet.
|
36
|
+
def in_progress?
|
37
|
+
if current_state =~ /started|finished/
|
38
|
+
true
|
39
|
+
else
|
40
|
+
false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
33
44
|
# Update the current status of a Story.
|
34
45
|
def update(status)
|
35
46
|
@pivotal_story.update(current_state: status)
|
data/lib/pv/version.rb
CHANGED
data/pv.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency 'pivotal-tracker'
|
20
|
+
gem.add_dependency 'pivotal-tracker', '0.5.10'
|
21
21
|
gem.add_dependency 'thor'
|
22
|
+
gem.add_dependency 'nokogiri-happymapper'
|
22
23
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'pv/configuration'
|
2
|
+
|
3
|
+
module Pv
|
4
|
+
describe Configuration do
|
5
|
+
context "Using the global configuration file" do
|
6
|
+
before do
|
7
|
+
if File.exists? File.expand_path("~/.pv")
|
8
|
+
`cp ~/.pv ~/.pv.safe`
|
9
|
+
end
|
10
|
+
|
11
|
+
`cp spec/fixtures/pv.yml ~/.pv`
|
12
|
+
end
|
13
|
+
|
14
|
+
subject { Pv::Configuration.new }
|
15
|
+
|
16
|
+
it "reads from ~/.pv YAML" do
|
17
|
+
subject.should be_present
|
18
|
+
subject.attributes.should_not be_empty
|
19
|
+
subject.attributes.count.should == 4
|
20
|
+
end
|
21
|
+
|
22
|
+
it "parses a username" do
|
23
|
+
subject.username.should == "johndoe"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "parses a password" do
|
27
|
+
subject.password.should == "password"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "parses a full name" do
|
31
|
+
subject.name.should == "John Doe"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "parses a project id into a number" do
|
35
|
+
subject.project_id.should == 123456
|
36
|
+
end
|
37
|
+
|
38
|
+
after do
|
39
|
+
if File.exists? File.expand_path("~/.pv.safe")
|
40
|
+
`cp ~/.pv.safe ~/.pv`
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "Using the project configuration" do
|
46
|
+
before do
|
47
|
+
`cp #{Dir.pwd}/spec/fixtures/pv.project.yml #{Dir.pwd}/.pv`
|
48
|
+
end
|
49
|
+
|
50
|
+
subject { Pv::Configuration.new }
|
51
|
+
|
52
|
+
it "reads from ~/.pv YAML" do
|
53
|
+
subject.should be_present
|
54
|
+
subject.attributes.should_not be_empty
|
55
|
+
subject.attributes.count.should == 4
|
56
|
+
end
|
57
|
+
|
58
|
+
it "parses a username" do
|
59
|
+
subject.username.should == "johndoe"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "parses a password" do
|
63
|
+
subject.password.should == "password"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "parses a full name" do
|
67
|
+
subject.name.should == "John Doe"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "parses a project id into a number" do
|
71
|
+
subject.project_id.should == 78901
|
72
|
+
end
|
73
|
+
|
74
|
+
after do
|
75
|
+
`rm -rf #{Dir.pwd}/.pv`
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
metadata
CHANGED
@@ -1,48 +1,64 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.8
|
5
4
|
prerelease:
|
5
|
+
version: 0.0.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tom Scott
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.5.10
|
20
|
+
none: false
|
15
21
|
name: pivotal-tracker
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
16
24
|
requirement: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.5.10
|
17
29
|
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
18
32
|
requirements:
|
19
33
|
- - ! '>='
|
20
34
|
- !ruby/object:Gem::Version
|
21
35
|
version: '0'
|
36
|
+
none: false
|
37
|
+
name: thor
|
22
38
|
type: :runtime
|
23
39
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
26
41
|
requirements:
|
27
42
|
- - ! '>='
|
28
43
|
- !ruby/object:Gem::Version
|
29
44
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: thor
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
45
|
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
34
48
|
requirements:
|
35
49
|
- - ! '>='
|
36
50
|
- !ruby/object:Gem::Version
|
37
51
|
version: '0'
|
52
|
+
none: false
|
53
|
+
name: nokogiri-happymapper
|
38
54
|
type: :runtime
|
39
55
|
prerelease: false
|
40
|
-
|
41
|
-
none: false
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
42
57
|
requirements:
|
43
58
|
- - ! '>='
|
44
59
|
- !ruby/object:Gem::Version
|
45
60
|
version: '0'
|
61
|
+
none: false
|
46
62
|
description: A command-line interface to Pivotal Tracker.
|
47
63
|
email:
|
48
64
|
- tubbo@psychedeli.ca
|
@@ -69,15 +85,16 @@ files:
|
|
69
85
|
- lib/templates/help.txt
|
70
86
|
- lib/templates/story.txt.erb
|
71
87
|
- pv.gemspec
|
72
|
-
- spec/extensions/object_spec.rb
|
73
|
-
- spec/extensions/string_spec.rb
|
74
88
|
- spec/fixtures/cassettes/pivotal_client_connection.yml
|
75
89
|
- spec/fixtures/cassettes/pivotal_find_story.yml
|
76
90
|
- spec/fixtures/cassettes/pivotal_project_stories_search.yml
|
91
|
+
- spec/fixtures/pv.project.yml
|
77
92
|
- spec/fixtures/pv.yml
|
78
|
-
- spec/
|
79
|
-
- spec/
|
80
|
-
- spec/
|
93
|
+
- spec/lib/core_ext/object_spec.rb
|
94
|
+
- spec/lib/core_ext/string_spec.rb
|
95
|
+
- spec/lib/pv/bug_tracker_spec.rb
|
96
|
+
- spec/lib/pv/configuration_spec.rb
|
97
|
+
- spec/lib/pv/story_spec.rb
|
81
98
|
- spec/spec_helper.rb
|
82
99
|
homepage: http://github.com/tubbo/pv
|
83
100
|
licenses: []
|
@@ -86,31 +103,32 @@ rdoc_options: []
|
|
86
103
|
require_paths:
|
87
104
|
- lib
|
88
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
106
|
requirements:
|
91
107
|
- - ! '>='
|
92
108
|
- !ruby/object:Gem::Version
|
93
109
|
version: '0'
|
94
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
110
|
none: false
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
112
|
requirements:
|
97
113
|
- - ! '>='
|
98
114
|
- !ruby/object:Gem::Version
|
99
115
|
version: '0'
|
116
|
+
none: false
|
100
117
|
requirements: []
|
101
118
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.8.
|
119
|
+
rubygems_version: 1.8.23
|
103
120
|
signing_key:
|
104
121
|
specification_version: 3
|
105
122
|
summary: A command-line interface to Pivotal Tracker.
|
106
123
|
test_files:
|
107
|
-
- spec/extensions/object_spec.rb
|
108
|
-
- spec/extensions/string_spec.rb
|
109
124
|
- spec/fixtures/cassettes/pivotal_client_connection.yml
|
110
125
|
- spec/fixtures/cassettes/pivotal_find_story.yml
|
111
126
|
- spec/fixtures/cassettes/pivotal_project_stories_search.yml
|
127
|
+
- spec/fixtures/pv.project.yml
|
112
128
|
- spec/fixtures/pv.yml
|
113
|
-
- spec/
|
114
|
-
- spec/
|
115
|
-
- spec/
|
129
|
+
- spec/lib/core_ext/object_spec.rb
|
130
|
+
- spec/lib/core_ext/string_spec.rb
|
131
|
+
- spec/lib/pv/bug_tracker_spec.rb
|
132
|
+
- spec/lib/pv/configuration_spec.rb
|
133
|
+
- spec/lib/pv/story_spec.rb
|
116
134
|
- spec/spec_helper.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'pv/configuration'
|
2
|
-
|
3
|
-
module Pv
|
4
|
-
describe Configuration do
|
5
|
-
before do
|
6
|
-
if File.exists? File.expand_path("~/.pv")
|
7
|
-
`cp ~/.pv ~/.pv.safe`
|
8
|
-
end
|
9
|
-
|
10
|
-
`cp spec/fixtures/pv.yml ~/.pv`
|
11
|
-
end
|
12
|
-
|
13
|
-
subject { Pv::Configuration.new }
|
14
|
-
|
15
|
-
it "reads from ~/.pv YAML" do
|
16
|
-
subject.should be_present
|
17
|
-
subject.attributes.should_not be_empty
|
18
|
-
subject.attributes.count.should == 4
|
19
|
-
end
|
20
|
-
|
21
|
-
it "parses a username" do
|
22
|
-
subject.username.should == "johndoe"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "parses a password" do
|
26
|
-
subject.password.should == "password"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "parses a full name" do
|
30
|
-
subject.name.should == "John Doe"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "parses a project id into a number" do
|
34
|
-
subject.project_id.should == 123456
|
35
|
-
end
|
36
|
-
|
37
|
-
after do
|
38
|
-
if File.exists? File.expand_path("~/.pv.safe")
|
39
|
-
`cp ~/.pv.safe ~/.pv`
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|