stories-cli 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +66 -0
- data/Rakefile +2 -0
- data/bin/pivotcli +77 -0
- data/lib/pivotcli.rb +59 -0
- data/lib/pivotcli/runner.rb +49 -0
- data/pivotcli.gemspec +22 -0
- metadata +131 -0
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
pivotcli
|
2
|
+
===========
|
3
|
+
|
4
|
+
CLI for Pivotal Tracker powered by pivotal_tracker: jsmestad/pivotal-tracker
|
5
|
+
|
6
|
+
|
7
|
+
Examples
|
8
|
+
--------
|
9
|
+
|
10
|
+
Add this to your ~/.pivotcli.yml
|
11
|
+
|
12
|
+
token: 'your-pivotal-token'
|
13
|
+
ssl: true
|
14
|
+
|
15
|
+
Run this in your Terminal
|
16
|
+
|
17
|
+
pivotcli -s started -p your_project -o 'Your Name' -t 'token'
|
18
|
+
|
19
|
+
Requirements
|
20
|
+
------------
|
21
|
+
|
22
|
+
* pivotal_tracker
|
23
|
+
* colored
|
24
|
+
|
25
|
+
Install
|
26
|
+
-------
|
27
|
+
|
28
|
+
* gem install pivotcli
|
29
|
+
|
30
|
+
TODO
|
31
|
+
-------
|
32
|
+
|
33
|
+
* Include full support for other `pivotal_tracker` features
|
34
|
+
* Add testing
|
35
|
+
|
36
|
+
Author
|
37
|
+
------
|
38
|
+
|
39
|
+
Original author: Julius F
|
40
|
+
|
41
|
+
|
42
|
+
License
|
43
|
+
-------
|
44
|
+
|
45
|
+
The MIT License
|
46
|
+
|
47
|
+
Copyright (c) Julius F
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
50
|
+
a copy of this software and associated documentation files (the
|
51
|
+
'Software'), to deal in the Software without restriction, including
|
52
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
53
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
54
|
+
permit persons to whom the Software is furnished to do so, subject to
|
55
|
+
the following conditions:
|
56
|
+
|
57
|
+
The above copyright notice and this permission notice shall be
|
58
|
+
included in all copies or substantial portions of the Software.
|
59
|
+
|
60
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
61
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
62
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
63
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
64
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
65
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
66
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/pivotcli
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.expand_path(
|
4
|
+
File.join(File.dirname(__FILE__), %w[.. lib pivotcli]))
|
5
|
+
require "choice"
|
6
|
+
|
7
|
+
PRlGRAM_VERSION = 1
|
8
|
+
|
9
|
+
Choice.options do
|
10
|
+
header ''
|
11
|
+
header 'Specific options:'
|
12
|
+
|
13
|
+
option :create do
|
14
|
+
short '-c'
|
15
|
+
long '--create=STORY_NAME'
|
16
|
+
desc 'New story name'
|
17
|
+
end
|
18
|
+
|
19
|
+
option :project do
|
20
|
+
short '-p'
|
21
|
+
long '--project=PROJECT'
|
22
|
+
desc 'The Project Name'
|
23
|
+
end
|
24
|
+
|
25
|
+
option :owner do
|
26
|
+
short '-o'
|
27
|
+
long '--owner=OWNER'
|
28
|
+
desc 'The owner of the story'
|
29
|
+
end
|
30
|
+
|
31
|
+
option :state do
|
32
|
+
short '-s'
|
33
|
+
long '--state=STATE'
|
34
|
+
desc 'State of the stories (started, unstarted, finished, delivered, accepted, unscheduled)'
|
35
|
+
default 'unstarted'
|
36
|
+
end
|
37
|
+
|
38
|
+
option :show_descriptions do
|
39
|
+
short '-d'
|
40
|
+
long '--description'
|
41
|
+
desc 'Show description from stories'
|
42
|
+
end
|
43
|
+
|
44
|
+
option :story_type do
|
45
|
+
short '-st'
|
46
|
+
long '--story_type=TYPE'
|
47
|
+
desc 'Story Type (feature, bug, chore, release)'
|
48
|
+
end
|
49
|
+
|
50
|
+
option :token do
|
51
|
+
short '-t'
|
52
|
+
long '--token=TOKEN'
|
53
|
+
desc 'Token from Pivotal Tracker'
|
54
|
+
end
|
55
|
+
|
56
|
+
separator ''
|
57
|
+
separator 'Common options: '
|
58
|
+
|
59
|
+
option :help do
|
60
|
+
long '--help'
|
61
|
+
desc 'Show this message'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
runner = Runner.new(:create => Choice.choices[:create],
|
66
|
+
:project => Choice.choices[:project],
|
67
|
+
:owner => Choice.choices[:owner],
|
68
|
+
:token => Choice.choices[:token],
|
69
|
+
:state => Choice.choices[:state],
|
70
|
+
:story_type => Choice.choices[:story_type],
|
71
|
+
:show_descriptions => Choice.choices[:show_descriptions])
|
72
|
+
|
73
|
+
if Choice.choices[:create]
|
74
|
+
runner.create_story
|
75
|
+
else
|
76
|
+
runner.get_stories
|
77
|
+
end
|
data/lib/pivotcli.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
module Pivotcli
|
3
|
+
|
4
|
+
# :stopdoc:
|
5
|
+
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
6
|
+
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
7
|
+
# :startdoc:
|
8
|
+
|
9
|
+
# Returns the library path for the module. If any arguments are given,
|
10
|
+
# they will be joined to the end of the libray path using
|
11
|
+
# <tt>File.join</tt>.
|
12
|
+
#
|
13
|
+
def self.libpath( *args )
|
14
|
+
rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
15
|
+
if block_given?
|
16
|
+
begin
|
17
|
+
$LOAD_PATH.unshift LIBPATH
|
18
|
+
rv = yield
|
19
|
+
ensure
|
20
|
+
$LOAD_PATH.shift
|
21
|
+
end
|
22
|
+
end
|
23
|
+
return rv
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns the lpath for the module. If any arguments are given,
|
27
|
+
# they will be joined to the end of the path using
|
28
|
+
# <tt>File.join</tt>.
|
29
|
+
#
|
30
|
+
def self.path( *args )
|
31
|
+
rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
32
|
+
if block_given?
|
33
|
+
begin
|
34
|
+
$LOAD_PATH.unshift PATH
|
35
|
+
rv = yield
|
36
|
+
ensure
|
37
|
+
$LOAD_PATH.shift
|
38
|
+
end
|
39
|
+
end
|
40
|
+
return rv
|
41
|
+
end
|
42
|
+
|
43
|
+
# Utility method used to require all files ending in .rb that lie in the
|
44
|
+
# directory below this file that has the same name as the filename passed
|
45
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
46
|
+
# the _filename_ does not have to be equivalent to the directory.
|
47
|
+
#
|
48
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
49
|
+
dir ||= ::File.basename(fname, '.*')
|
50
|
+
search_me = ::File.expand_path(
|
51
|
+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
52
|
+
|
53
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
54
|
+
end
|
55
|
+
|
56
|
+
end # module Pivotcli
|
57
|
+
|
58
|
+
Pivotcli.require_all_libs_relative_to(__FILE__)
|
59
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "pivotal_tracker"
|
3
|
+
require "colored"
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
class Runner
|
7
|
+
def initialize(options)
|
8
|
+
config = config = YAML.load_file("#{ENV['HOME']}/.pivotcli.yml")
|
9
|
+
|
10
|
+
@story = options[:create]
|
11
|
+
@project_name = options[:project] || config['project']
|
12
|
+
@owner = options[:owner] || config['owner']
|
13
|
+
@state = options[:state]
|
14
|
+
@token = options[:token] || config['token']
|
15
|
+
@show_desc = options[:show_descriptions]
|
16
|
+
@story_type = options[:story_type]
|
17
|
+
@ssl = config['ssl']
|
18
|
+
|
19
|
+
PivotalTracker::Client.token = @token
|
20
|
+
PivotalTracker::Client.use_ssl = @ssl
|
21
|
+
|
22
|
+
@projects = PivotalTracker::Project.all
|
23
|
+
|
24
|
+
@projects.each do |project|
|
25
|
+
if project.name.downcase.eql? @project_name.downcase
|
26
|
+
@project_id = project.id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
@project = PivotalTracker::Project.find(@project_id)
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_story
|
34
|
+
if @story.include? ":"
|
35
|
+
labels, story = @story.split ":"
|
36
|
+
|
37
|
+
@project.stories.create(:name => story.strip, :labels => labels.split(' '))
|
38
|
+
else
|
39
|
+
@project.stories.create(:name => @story)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_stories
|
44
|
+
@project.stories.all(:current_state => @state, :owned_by => @owner).each do |story|
|
45
|
+
puts "#{story.id.to_s.red} | #{story.name.green}"
|
46
|
+
puts "\t#{story.description.cyan}" unless (@show_desc.nil? or story.description.empty?)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/pivotcli.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ["Matt Diebolt"]
|
5
|
+
gem.email = ["mdiebolt@gmail.com"]
|
6
|
+
gem.description = %q{CLI for Pivotal Tracker powered by pivotal_tracker: jsmestad/pivotal-tracker}
|
7
|
+
gem.summary = %q{CLI for Pivotal Tracker powered by pivotal_tracker: jsmestad/pivotal-tracker}
|
8
|
+
gem.homepage = "http://baldrailers.tumblr.com"
|
9
|
+
|
10
|
+
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = 'stories-cli'
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = '0.0.1'
|
16
|
+
|
17
|
+
gem.add_runtime_dependency 'pivotal-tracker', '~> 0.5.3'
|
18
|
+
gem.add_runtime_dependency 'colored', '~> 1.2'
|
19
|
+
gem.add_runtime_dependency 'choice', '~> 0.1.4'
|
20
|
+
|
21
|
+
gem.add_development_dependency 'rake'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stories-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Matt Diebolt
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-07-11 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: pivotal-tracker
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 13
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 5
|
32
|
+
- 3
|
33
|
+
version: 0.5.3
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: colored
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 11
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 2
|
48
|
+
version: "1.2"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: choice
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 19
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 1
|
63
|
+
- 4
|
64
|
+
version: 0.1.4
|
65
|
+
type: :runtime
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rake
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id004
|
81
|
+
description: "CLI for Pivotal Tracker powered by pivotal_tracker: jsmestad/pivotal-tracker"
|
82
|
+
email:
|
83
|
+
- mdiebolt@gmail.com
|
84
|
+
executables:
|
85
|
+
- pivotcli
|
86
|
+
extensions: []
|
87
|
+
|
88
|
+
extra_rdoc_files: []
|
89
|
+
|
90
|
+
files:
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- bin/pivotcli
|
94
|
+
- lib/pivotcli.rb
|
95
|
+
- lib/pivotcli/runner.rb
|
96
|
+
- pivotcli.gemspec
|
97
|
+
homepage: http://baldrailers.tumblr.com
|
98
|
+
licenses: []
|
99
|
+
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
123
|
+
requirements: []
|
124
|
+
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 1.8.24
|
127
|
+
signing_key:
|
128
|
+
specification_version: 3
|
129
|
+
summary: "CLI for Pivotal Tracker powered by pivotal_tracker: jsmestad/pivotal-tracker"
|
130
|
+
test_files: []
|
131
|
+
|