pivotal-tracker-console 0.0.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/.document +5 -0
- data/.gitignore +21 -0
- data/Gemfile +9 -0
- data/LICENSE +20 -0
- data/README.rdoc +34 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/bin/tracker +7 -0
- data/lib/pivotal-tracker-console.rb +10 -0
- data/lib/pivotal-tracker-console/authentication.rb +13 -0
- data/lib/pivotal-tracker-console/console.rb +112 -0
- data/lib/pivotal-tracker-console/displayable.rb +3 -0
- data/lib/pivotal-tracker-console/displayable/main.rb +43 -0
- data/lib/pivotal-tracker-console/displayable/project.rb +33 -0
- data/lib/pivotal-tracker-console/displayable/story.rb +31 -0
- data/lib/pivotal-tracker-console/setup.rb +27 -0
- data/spec/pivotal-tracker-console_spec.rb +7 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +9 -0
- metadata +118 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Leandro Silva
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
= pivotal-tracker-console
|
2
|
+
|
3
|
+
It's just a little console application to Pivotal Tracker.
|
4
|
+
|
5
|
+
== Install and configuration
|
6
|
+
|
7
|
+
Install the pivotal-tracker-console gem:
|
8
|
+
|
9
|
+
gem install pivotal-tracker-console
|
10
|
+
|
11
|
+
tracker setup -t [PIVOTAL_TRACKER_API_TOKEN] # Setup the token to authentication on Pivotal Tracker
|
12
|
+
|
13
|
+
Done. You can use right now.
|
14
|
+
|
15
|
+
== Usage
|
16
|
+
|
17
|
+
Some examples of usage maybe:
|
18
|
+
|
19
|
+
tracker help [TASK] # Describe available tasks or one specific task
|
20
|
+
tracker project [ID] # Show the project's details and its stories
|
21
|
+
tracker projects # List all projects
|
22
|
+
tracker setup -t, --token=TOKEN # Setup the Pivotal Tracker API token
|
23
|
+
tracker stories [PROJECT_ID] -p, --project=N # Show the project's stories
|
24
|
+
tracker story [ID] -p, --project=N # Show the story's details
|
25
|
+
|
26
|
+
== Help
|
27
|
+
|
28
|
+
If you need some help, type:
|
29
|
+
|
30
|
+
tracker help
|
31
|
+
|
32
|
+
== Copyright
|
33
|
+
|
34
|
+
Copyright (c) 2010 Leandro Silva. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "pivotal-tracker-console"
|
8
|
+
gem.summary = %Q{A console application to Pivotal Tracker}
|
9
|
+
gem.description = %Q{A simple console application to interact with Pivotal Tracker}
|
10
|
+
gem.email = "leandrodoze@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/leandrosilva/pivotal-tracker-console"
|
12
|
+
gem.authors = ["Leandro Silva"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency %q<thor>, ">= 0.14.0"
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "pivotal-tracker-console #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/tracker
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "thor"
|
3
|
+
require "pivotal-tracker"
|
4
|
+
require "ap"
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
require "pivotal-tracker-console/displayable"
|
8
|
+
require "pivotal-tracker-console/setup"
|
9
|
+
require "pivotal-tracker-console/authentication"
|
10
|
+
require "pivotal-tracker-console/console"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
module API
|
3
|
+
module Authentication
|
4
|
+
def self.included(base)
|
5
|
+
base.send :extend, self
|
6
|
+
end
|
7
|
+
|
8
|
+
def authenticate_by_token
|
9
|
+
Client.token = Setup::API::Authentication.token if Setup::API::Authentication.has_token?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
class Console < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
include API::Authentication
|
5
|
+
include Displayable::Main
|
6
|
+
include Displayable::Project
|
7
|
+
include Displayable::Story
|
8
|
+
|
9
|
+
#
|
10
|
+
# Header
|
11
|
+
#
|
12
|
+
display_header
|
13
|
+
|
14
|
+
#
|
15
|
+
# Authentication
|
16
|
+
#
|
17
|
+
authenticate_by_token
|
18
|
+
|
19
|
+
#
|
20
|
+
# Tasks
|
21
|
+
#
|
22
|
+
|
23
|
+
# task: setup
|
24
|
+
|
25
|
+
desc "setup", "Setup the Pivotal Tracker API token"
|
26
|
+
method_option :token, :type => :string, :required => true, :aliases => "-t"
|
27
|
+
|
28
|
+
def setup
|
29
|
+
Setup::API::Authentication.token = options[:token]
|
30
|
+
|
31
|
+
display_text "Token was setup."
|
32
|
+
end
|
33
|
+
|
34
|
+
# task: projects
|
35
|
+
|
36
|
+
desc "projects", "List all projects"
|
37
|
+
|
38
|
+
def projects
|
39
|
+
display_text "All projects", :new_line
|
40
|
+
|
41
|
+
Project.all.each do |project|
|
42
|
+
display_project_title project
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# task: project
|
47
|
+
|
48
|
+
desc "project [ID]", "Show the project's details and its stories"
|
49
|
+
|
50
|
+
def project(id)
|
51
|
+
display_text "Details about project", :new_line
|
52
|
+
|
53
|
+
begin
|
54
|
+
project = Project.find(id)
|
55
|
+
display_project_info project
|
56
|
+
rescue RestClient::ResourceNotFound
|
57
|
+
display_project_not_found id
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# task: stories
|
62
|
+
|
63
|
+
desc "stories [PROJECT_ID]", "Show the project's stories"
|
64
|
+
method_option :project, :type => :numeric, :required => true, :aliases => "-p"
|
65
|
+
method_option :type, :type => :array, :required => false, :default => ["feature", "chore", "bug"], :aliases => "-t"
|
66
|
+
|
67
|
+
def stories
|
68
|
+
display_text "Project's stories", :new_line
|
69
|
+
|
70
|
+
project_id = options.project
|
71
|
+
|
72
|
+
begin
|
73
|
+
project = Project.find(project_id)
|
74
|
+
display_project_title project
|
75
|
+
skip_one_line
|
76
|
+
|
77
|
+
project.stories.all(:story_type => options.type).each do |story|
|
78
|
+
display_story_title story
|
79
|
+
end
|
80
|
+
rescue RestClient::ResourceNotFound
|
81
|
+
display_project_not_found project_id
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# task: story
|
86
|
+
|
87
|
+
desc "story [ID]", "Show the story's details"
|
88
|
+
method_option :project, :type => :numeric, :required => true, :aliases => "-p"
|
89
|
+
|
90
|
+
def story(id)
|
91
|
+
display_text "Details about story", :new_line
|
92
|
+
|
93
|
+
project_id = options.project
|
94
|
+
|
95
|
+
begin
|
96
|
+
project = Project.find(project_id)
|
97
|
+
display_project_title project
|
98
|
+
skip_one_line
|
99
|
+
|
100
|
+
story = project.stories.find(id.to_i)
|
101
|
+
|
102
|
+
if story
|
103
|
+
display_story_info story
|
104
|
+
else
|
105
|
+
display_error "Story #{id} not found in the project #{project_id}"
|
106
|
+
end
|
107
|
+
rescue RestClient::ResourceNotFound
|
108
|
+
display_project_not_found id
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
module Displayable
|
3
|
+
module Main
|
4
|
+
def self.included(base)
|
5
|
+
base.send :extend, self
|
6
|
+
end
|
7
|
+
|
8
|
+
def display_header
|
9
|
+
display YELLOW, "\n:: Pivotal Tracker Console ::\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
def display_text(text, new_line = :no)
|
13
|
+
display text
|
14
|
+
|
15
|
+
puts "" if new_line == :new_line
|
16
|
+
end
|
17
|
+
|
18
|
+
def display_error(message)
|
19
|
+
display RED, "# Error => #{message}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def skip_one_line
|
23
|
+
puts ""
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
RED = "31m"
|
29
|
+
GREEN = "31m"
|
30
|
+
YELLOW = "33m"
|
31
|
+
BLUE = "34m"
|
32
|
+
MAGENTA = "35m"
|
33
|
+
|
34
|
+
def display(color_code = nil, text)
|
35
|
+
if color_code
|
36
|
+
puts "\e[#{color_code}#{text}\e[0m"
|
37
|
+
else
|
38
|
+
puts text
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
module Displayable
|
3
|
+
module Project
|
4
|
+
def display_project_title(project)
|
5
|
+
puts "#{project.id} - #{project.name}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def display_project_info(project)
|
9
|
+
display_project_title project
|
10
|
+
|
11
|
+
puts %Q{
|
12
|
+
- Week start day: #{project.week_start_day}
|
13
|
+
- Point scale: #{project.point_scale}
|
14
|
+
- Velocity scheme: #{project.velocity_scheme}
|
15
|
+
- Iteration lenght: #{project.iteration_length}
|
16
|
+
- Initial velocity: #{project.initial_velocity}
|
17
|
+
- Current velocity: #{project.current_velocity}
|
18
|
+
- Last activity at: #{project.last_activity_at}
|
19
|
+
|
20
|
+
Stories count:
|
21
|
+
|
22
|
+
- Features: #{project.stories.all(:story_type => ["feature"]).count}
|
23
|
+
- Chores: #{project.stories.all(:story_type => ["chore"]).count}
|
24
|
+
- Bugs: #{project.stories.all(:story_type => ["bug"]).count}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def display_project_not_found(id)
|
29
|
+
display_error "Project #{id} not found."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
module Displayable
|
3
|
+
module Story
|
4
|
+
def display_story_title(story)
|
5
|
+
puts " - #{story.story_type.capitalize}: #{story.id} [#{story.current_state}]"
|
6
|
+
end
|
7
|
+
|
8
|
+
def display_story_info(story)
|
9
|
+
display_story_title(story)
|
10
|
+
|
11
|
+
puts %Q{
|
12
|
+
"#{story.name}"
|
13
|
+
|
14
|
+
- Created at: #{story.created_at}
|
15
|
+
- Estimate: #{story.estimate}
|
16
|
+
- Requested by: #{story.requested_by}
|
17
|
+
- Owned by: #{story.owned_by}
|
18
|
+
- Labels: #{story.labels}
|
19
|
+
|
20
|
+
What more?
|
21
|
+
|
22
|
+
#{story.description}
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def display_story_not_found(id)
|
27
|
+
display_error "Story #{id} not found."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PivotalTracker
|
2
|
+
module Setup
|
3
|
+
module API
|
4
|
+
module Authentication
|
5
|
+
class << self
|
6
|
+
def has_token?
|
7
|
+
File.exist? filename
|
8
|
+
end
|
9
|
+
|
10
|
+
def token=(token)
|
11
|
+
File.open(filename, 'w') { |file| file.write "token: #{token}" }
|
12
|
+
end
|
13
|
+
|
14
|
+
def token
|
15
|
+
@token ||= YAML.load_file(filename)['token']
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def filename
|
21
|
+
File.expand_path("~/.pivotal_tracker")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pivotal-tracker-console
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Leandro Silva
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-30 00:00:00 -03:00
|
19
|
+
default_executable: tracker
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
34
|
+
version: 1.2.9
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: thor
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 39
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 14
|
49
|
+
- 0
|
50
|
+
version: 0.14.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
description: A simple console application to interact with Pivotal Tracker
|
54
|
+
email: leandrodoze@gmail.com
|
55
|
+
executables:
|
56
|
+
- tracker
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE
|
61
|
+
- README.rdoc
|
62
|
+
files:
|
63
|
+
- .document
|
64
|
+
- .gitignore
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE
|
67
|
+
- README.rdoc
|
68
|
+
- Rakefile
|
69
|
+
- VERSION
|
70
|
+
- bin/tracker
|
71
|
+
- lib/pivotal-tracker-console.rb
|
72
|
+
- lib/pivotal-tracker-console/authentication.rb
|
73
|
+
- lib/pivotal-tracker-console/console.rb
|
74
|
+
- lib/pivotal-tracker-console/displayable.rb
|
75
|
+
- lib/pivotal-tracker-console/displayable/main.rb
|
76
|
+
- lib/pivotal-tracker-console/displayable/project.rb
|
77
|
+
- lib/pivotal-tracker-console/displayable/story.rb
|
78
|
+
- lib/pivotal-tracker-console/setup.rb
|
79
|
+
- spec/pivotal-tracker-console_spec.rb
|
80
|
+
- spec/spec.opts
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
has_rdoc: true
|
83
|
+
homepage: http://github.com/leandrosilva/pivotal-tracker-console
|
84
|
+
licenses: []
|
85
|
+
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options:
|
88
|
+
- --charset=UTF-8
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.3.7
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: A console application to Pivotal Tracker
|
116
|
+
test_files:
|
117
|
+
- spec/pivotal-tracker-console_spec.rb
|
118
|
+
- spec/spec_helper.rb
|