tracker_packer 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/tp +12 -22
  2. metadata +3 -3
data/bin/tp CHANGED
@@ -1,33 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'pivotal-tracker'
4
- require 'optparse'
5
4
 
6
- options = {}
7
- OptionParser.new do |opts|
8
- opts.program_name = 'tp'
9
- opts.banner = "Usage: tp [options]"
10
- opts.on("--token TOKEN",
11
- "Pivotal Tracker token") do |token|
12
- options[:token] = token
13
- end
14
- opts.on("--project PROJECT_ID",
15
- "Pivotal Tracker project id") do |project|
16
- options[:project] = project
17
- end
18
- opts.on("--file TEMPLATE_FILE",
19
- "YAML template file containing stories") do |file|
20
- options[:file] = file
21
- end
22
- end.parse(ARGV)
5
+ def usage
6
+ <<-HELP
7
+ Usage: tp template_file
8
+ --help you're looking at it
9
+ HELP
10
+ end
23
11
 
24
- PivotalTracker::Client.token = options[:token]
12
+ abort usage if ARGV.empty? or ARGV.first == '--help'
25
13
 
26
- templates = YAML::load(File.read(options[:file]))
14
+ file = YAML::load(File.read(ARGV.first))
27
15
 
28
- project = PivotalTracker::Project.find(options[:project])
16
+ PivotalTracker::Client.token = file[:token]
17
+
18
+ project = PivotalTracker::Project.find(file[:project])
29
19
  puts "Packing..."
30
20
 
31
- ids = templates.map {|story| project.stories.create(story).id }
21
+ ids = file[:stories].map {|story| project.stories.create(story).id }
32
22
  puts "Stories created: "
33
23
  puts ids
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kevin R. Barnes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-12 00:00:00 -06:00
18
+ date: 2012-02-13 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency