pivotal-bootstrap 1.0.0
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.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +16 -0
- data/LICENSE.txt +22 -0
- data/README.md +110 -0
- data/Rakefile +1 -0
- data/bin/pivotal-bootstrap +121 -0
- data/lib/pivotal-bootstrap/version.rb +5 -0
- data/lib/pivotal-bootstrap.rb +7 -0
- data/pivotal-bootstrap.gemspec +33 -0
- data/stories.yml +51 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGQzOGVjN2M1NzI0ZjliODM5NzQ2N2NkNWYyYzE4ZjZhNDM2NDk1YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWQzNzlmOTU3ZTU3MTc0MDUwYzgwOGEzNzE1NzExMzc2ZTUxMTRiMA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OWU4YzM4MWQ2OGRmNDMzYWFhZmQ1ODJkNzk3YjM3NTBhMDQ0MDE5MWZjODRl
|
10
|
+
M2FiZjBhZWI5NzliOTM3YTVhYTgyZTM1ZjE4MTViYWNmNjY5NTU2NmIxYWE5
|
11
|
+
NzllN2UwNWY4OGY5MTc5MzYzNmFkOTgxNTA3MDQ0NmYwMmIyNTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjRlZDU0MDQ2Y2NiODVhOTczNzU2NzA3NzFiMTI4NmUxMGQ5ZDkyYjllNGY0
|
14
|
+
MjhhNTk5ZDNjODM5M2ExNjcyZmFiNThkYTBjYTRkNWE2ZjM2OGI5YTA4MWIx
|
15
|
+
YzEyYWUyNzc1ZGEzYjc5MWU3YWQwNjNjYzFmZWVlZjc4MTRmNjE=
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p194@pivotal-bootstrap
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Element 84, LLC
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# pivotal-bootstrap
|
2
|
+
|
3
|
+
This gem provides a command-line application, "pivotal-bootstrap", which
|
4
|
+
imports stories from one or more YAML files into Pivotal Tracker.
|
5
|
+
|
6
|
+
The command makes it easy to bootstrap new projects with a common set of
|
7
|
+
pre-canned stories or to quickly capture stories in a text file for later
|
8
|
+
import.
|
9
|
+
|
10
|
+
YAML files contain grouped stories, allowing you to choose which groups to import.
|
11
|
+
This is useful when bootstrapping a new Pivotal project with common stories,
|
12
|
+
since every group of stories may not be applicable to every type of project
|
13
|
+
(see the example stories.yml for an instance of this).
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Run
|
18
|
+
|
19
|
+
$ gem install pivotal-bootstrap
|
20
|
+
|
21
|
+
Retrieve a Pivotal Tracker API token from https://www.pivotaltracker.com/profile
|
22
|
+
|
23
|
+
You may specify this token on the command line or place it in ~/.pivotal_tracker
|
24
|
+
for easier reuse. ~/.pivotal_tracker should look like this:
|
25
|
+
|
26
|
+
token: your_token_here
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
To retrieve a list of available arguments, run
|
31
|
+
|
32
|
+
$ pivotal-bootstrap --help
|
33
|
+
|
34
|
+
By default, the application reads stories from stories.yml in the current directory.
|
35
|
+
If you have your stories in stories.yml and your token in ~/.pivotal_tracker as
|
36
|
+
described above, simply run
|
37
|
+
|
38
|
+
$ pivotal-bootstrap --project=$PROJECT_ID
|
39
|
+
|
40
|
+
Where $PROJECT_ID is the ID of the pivotal project contained in the project's URL.
|
41
|
+
|
42
|
+
The application will ask you which groups of stories to import. You may also specify
|
43
|
+
groups on the command line:
|
44
|
+
|
45
|
+
$ pivotal-bootstrap --project=$PROJECT_ID --groups=group1 group2
|
46
|
+
|
47
|
+
or you can import all the stories:
|
48
|
+
|
49
|
+
$ pivotal-bootstrap --project=$PROJECT_ID --all
|
50
|
+
|
51
|
+
Another example providing an API token and a project ID, importing all stories from
|
52
|
+
multiple files:
|
53
|
+
|
54
|
+
$ pivotal-bootstrap --token=$PIVOTAL_TOKEN --project=$PROJECT_ID --all some_stories.yml other_stories.yml
|
55
|
+
|
56
|
+
|
57
|
+
## Sample YAML stories file:
|
58
|
+
|
59
|
+
# Sample stories to import into Pivotal Tracker when first creating a project
|
60
|
+
|
61
|
+
# The top level specifies a group. The CLI allows you to specify which groups
|
62
|
+
# to import or interactively select groups using these keys. By default, this
|
63
|
+
# string is used as a label for each item in the group.
|
64
|
+
project:
|
65
|
+
|
66
|
+
# Within each group, you may include a list of chores, features, releases,
|
67
|
+
# and/or bugs to import (all optional).
|
68
|
+
chores:
|
69
|
+
# Each story type contains a list of stories. If these are strings, they
|
70
|
+
# represent the story name.
|
71
|
+
- Set up git project
|
72
|
+
- Set up customer Pivotal accounts
|
73
|
+
|
74
|
+
# You may also specify more fields for the story. The field names match
|
75
|
+
# those provided by the Pivotal API
|
76
|
+
- name: Set up tests
|
77
|
+
labels: project, tests # Multiple labels are separated by commas
|
78
|
+
description: >- # Use YAML syntax for multi-line strings
|
79
|
+
Set up automated testing within the project and a TeamCity build to run
|
80
|
+
the tests.
|
81
|
+
features:
|
82
|
+
- Design user interface
|
83
|
+
releases:
|
84
|
+
- Release v1.0
|
85
|
+
|
86
|
+
ios-project:
|
87
|
+
labels: project
|
88
|
+
chores:
|
89
|
+
- Provision customer devices
|
90
|
+
- Submit app for review
|
91
|
+
features:
|
92
|
+
- Add analytics to the project
|
93
|
+
|
94
|
+
web-project:
|
95
|
+
labels: project
|
96
|
+
chores:
|
97
|
+
- Set up staging server
|
98
|
+
- Set up production server
|
99
|
+
|
100
|
+
accounts:
|
101
|
+
features:
|
102
|
+
- Create account
|
103
|
+
- Log in
|
104
|
+
- Log out
|
105
|
+
- Change password
|
106
|
+
- Recover password
|
107
|
+
- Show user account information
|
108
|
+
- Update user account information
|
109
|
+
|
110
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,121 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Allow the binary to be run during development
|
4
|
+
if File.exists?(File.join(File.expand_path('../..', __FILE__), '.git'))
|
5
|
+
pivotal_bootstrap_path = File.expand_path('../../lib', __FILE__)
|
6
|
+
$:.unshift(pivotal_bootstrap_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
require 'httparty'
|
11
|
+
require 'trollop'
|
12
|
+
require 'yaml'
|
13
|
+
require 'pivotal-bootstrap/version'
|
14
|
+
|
15
|
+
def parse_story_file(file, opts)
|
16
|
+
groups = YAML.load_file(file)
|
17
|
+
|
18
|
+
result = []
|
19
|
+
groups.each do |name, attrs|
|
20
|
+
if opts[:interactive]
|
21
|
+
print("Include group \"#{name}\"? [y/N] ")
|
22
|
+
next unless STDIN.gets.chomp.downcase == 'y'
|
23
|
+
else
|
24
|
+
next unless opts[:all] || opts[:groups].include?(name)
|
25
|
+
end
|
26
|
+
|
27
|
+
label = attrs['labels'] || name
|
28
|
+
|
29
|
+
# Iterating the hash this way preserves the order of the YML file
|
30
|
+
attrs.each do |name, value|
|
31
|
+
if ['chores', 'features', 'bugs', 'releases'].include? name
|
32
|
+
|
33
|
+
story_type = name.chop
|
34
|
+
stories = value
|
35
|
+
|
36
|
+
defaults = {
|
37
|
+
'labels' => label,
|
38
|
+
'story_type' => story_type
|
39
|
+
}
|
40
|
+
|
41
|
+
result += stories.map do |story|
|
42
|
+
story = {'name' => story} if story.is_a? String
|
43
|
+
defaults.merge(story)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
result
|
49
|
+
end
|
50
|
+
|
51
|
+
def parse_stories(opts)
|
52
|
+
# Load all stories in all provided files in reverse order so they appear
|
53
|
+
# in the correct order in Pivotal
|
54
|
+
opts[:files].map {|f| parse_story_file(f, opts)}.flatten(1).reverse
|
55
|
+
end
|
56
|
+
|
57
|
+
def bootstrap_stories(opts)
|
58
|
+
project_stories_url = "https://www.pivotaltracker.com/services/v3/projects/#{opts[:project]}/stories"
|
59
|
+
http_options = {headers: {'X-TrackerToken' => opts[:token]}}
|
60
|
+
|
61
|
+
$stdout.sync = true
|
62
|
+
|
63
|
+
parse_stories(opts).each do |story|
|
64
|
+
print "Loading \"[#{story['labels']}] #{story['name']}\"........"
|
65
|
+
response = HTTParty.post(project_stories_url, http_options.merge(body: {story: story}))
|
66
|
+
if response.code >= 400
|
67
|
+
puts "Fail!"
|
68
|
+
puts "An error occurred while loading stories:"
|
69
|
+
puts response.parsed_response["response"]["__content__"]
|
70
|
+
puts "Exiting"
|
71
|
+
exit false
|
72
|
+
end
|
73
|
+
puts "Done!"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def parse_options
|
79
|
+
opts = Trollop::options do
|
80
|
+
banner <<-EOS
|
81
|
+
pivotal-bootstrap (v#{Pivotal::Bootstrap::VERSION})
|
82
|
+
|
83
|
+
Loads stories into pivotal
|
84
|
+
|
85
|
+
Usage:
|
86
|
+
pivotal-bootstrap [options] <filenames>*
|
87
|
+
|
88
|
+
|
89
|
+
where <filenames> are a list of YAML files containing stories to load. See stories.yml for details on the YAML format.
|
90
|
+
|
91
|
+
Available options:
|
92
|
+
EOS
|
93
|
+
|
94
|
+
opt :all, "Import all groups in the given files without prompting"
|
95
|
+
opt :groups, "A space-separated list of groups to import", type: :strings
|
96
|
+
opt :token, "Your Pivotal API token. You may also set this in ~/.pivotal_tracker with the text \"token: <your token>\"", type: :string
|
97
|
+
opt :project, "Pivotal project id from the project URL", type: :string, required: true
|
98
|
+
end
|
99
|
+
|
100
|
+
opts[:files] = ARGV
|
101
|
+
opts[:files] << 'stories.yml' if opts[:files].size == 0 && File.exist?('stories.yml')
|
102
|
+
|
103
|
+
opts[:groups] ||= []
|
104
|
+
opts[:interactive] ||= !opts[:all] && opts[:groups].size == 0
|
105
|
+
|
106
|
+
unless opts[:token]
|
107
|
+
token_file_path = "#{Dir.home}/.pivotal_tracker"
|
108
|
+
if File.exist?(token_file_path)
|
109
|
+
opts[:token] = YAML.load_file(token_file_path)['token']
|
110
|
+
end
|
111
|
+
|
112
|
+
Trollop::die "You must specify a token on the command line or ~/.pivotal_tracker" unless opts[:token]
|
113
|
+
end
|
114
|
+
|
115
|
+
Trollop::die "Please specify at least one filename containing stories to import" unless ARGV.length > 0
|
116
|
+
|
117
|
+
opts
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
bootstrap_stories(parse_options)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pivotal-bootstrap/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "pivotal-bootstrap"
|
8
|
+
gem.version = Pivotal::Bootstrap::VERSION
|
9
|
+
gem.authors = ["Patrick Quinn"]
|
10
|
+
gem.email = ["patrick@element84.com"]
|
11
|
+
gem.description = %q{Imports stories in a YAML file into Pivotal Tracker}
|
12
|
+
gem.summary = <<-EOS
|
13
|
+
This gem provides a command-line application, "pivotal-bootstrap", which
|
14
|
+
imports stories from one or more YAML files into Pivotal Tracker.
|
15
|
+
|
16
|
+
The command makes it easy to bootstrap new projects with a common set of
|
17
|
+
pre-canned stories or to quickly capture stories in a text file for later
|
18
|
+
import.
|
19
|
+
|
20
|
+
YAML files contain grouped stories, allowing you to choose which groups to import.
|
21
|
+
This is useful when bootstrapping a new Pivotal project with common stories,
|
22
|
+
since every group of stories may not be applicable to every type of project
|
23
|
+
(see the example stories.yml for an instance of this).
|
24
|
+
EOS
|
25
|
+
|
26
|
+
gem.homepage = ""
|
27
|
+
|
28
|
+
gem.license = 'MIT'
|
29
|
+
gem.files = `git ls-files`.split($/)
|
30
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
31
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
32
|
+
gem.require_paths = ["lib"]
|
33
|
+
end
|
data/stories.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Sample stories to import into Pivotal Tracker when first creating a project
|
2
|
+
|
3
|
+
# The top level specifies a group. The CLI allows you to specify which groups
|
4
|
+
# to import or interactively select groups using these keys. By default, this
|
5
|
+
# string is used as a label for each item in the group.
|
6
|
+
project:
|
7
|
+
|
8
|
+
# Within each group, you may include a list of chores, features, releases,
|
9
|
+
# and/or bugs to import (all optional).
|
10
|
+
chores:
|
11
|
+
# Each story type contains a list of stories. If these are strings, they
|
12
|
+
# represent the story name.
|
13
|
+
- Set up git project
|
14
|
+
- Set up customer Pivotal accounts
|
15
|
+
|
16
|
+
# You may also specify more fields for the story. The field names match
|
17
|
+
# those provided by the Pivotal API
|
18
|
+
- name: Set up tests
|
19
|
+
labels: project, tests # Multiple labels are separated by commas
|
20
|
+
description: >- # Use YAML syntax for multi-line strings
|
21
|
+
Set up automated testing within the project and a TeamCity build to run
|
22
|
+
the tests.
|
23
|
+
features:
|
24
|
+
- Design user interface
|
25
|
+
releases:
|
26
|
+
- Release v1.0
|
27
|
+
|
28
|
+
ios-project:
|
29
|
+
labels: project
|
30
|
+
chores:
|
31
|
+
- Provision customer devices
|
32
|
+
- Submit app for review
|
33
|
+
features:
|
34
|
+
- Add analytics to the project
|
35
|
+
|
36
|
+
web-project:
|
37
|
+
labels: project
|
38
|
+
chores:
|
39
|
+
- Set up staging server
|
40
|
+
- Set up production server
|
41
|
+
|
42
|
+
accounts:
|
43
|
+
features:
|
44
|
+
- Create account
|
45
|
+
- Log in
|
46
|
+
- Log out
|
47
|
+
- Change password
|
48
|
+
- Recover password
|
49
|
+
- Show user account information
|
50
|
+
- Update user account information
|
51
|
+
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pivotal-bootstrap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Patrick Quinn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Imports stories in a YAML file into Pivotal Tracker
|
14
|
+
email:
|
15
|
+
- patrick@element84.com
|
16
|
+
executables:
|
17
|
+
- pivotal-bootstrap
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- .ruby-version
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- bin/pivotal-bootstrap
|
29
|
+
- lib/pivotal-bootstrap.rb
|
30
|
+
- lib/pivotal-bootstrap/version.rb
|
31
|
+
- pivotal-bootstrap.gemspec
|
32
|
+
- stories.yml
|
33
|
+
homepage: ''
|
34
|
+
licenses:
|
35
|
+
- MIT
|
36
|
+
metadata: {}
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.0.3
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: This gem provides a command-line application, "pivotal-bootstrap", which
|
57
|
+
imports stories from one or more YAML files into Pivotal Tracker. The command makes
|
58
|
+
it easy to bootstrap new projects with a common set of pre-canned stories or to
|
59
|
+
quickly capture stories in a text file for later import. YAML files contain grouped
|
60
|
+
stories, allowing you to choose which groups to import. This is useful when bootstrapping
|
61
|
+
a new Pivotal project with common stories, since every group of stories may not
|
62
|
+
be applicable to every type of project (see the example stories.yml for an instance
|
63
|
+
of this).
|
64
|
+
test_files: []
|