gisikw-pivotpro 0.1.0 → 0.2.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.
data/History.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ === 0.1.0 / 2009-08-12
2
+
3
+ * Released basic functionality, listing stories and features
data/README.rdoc CHANGED
@@ -6,6 +6,9 @@ PivotPro is a RubyGem used to interface with PivotalTracker. It relied on the Pi
6
6
 
7
7
  help # show this usage
8
8
  list # list your PivotalTracker projects
9
+ install <api_key> # set up pivotpro to use your api key
10
+
11
+ checkout <id> # associate the current folder with a project
9
12
 
10
13
  === App Commands (execute inside a checkout directory, or use --project <id>
11
14
 
@@ -14,6 +17,9 @@ PivotPro is a RubyGem used to interface with PivotalTracker. It relied on the Pi
14
17
  stories:bugs # list all stories that are bugs
15
18
  stories:releases # list all stories that are releases
16
19
 
20
+ cucumber:pull # creates cucumber features from project feature descriptions
21
+ cucumber:push # updates project features with cucumber stories
22
+
17
23
  == Known Issues
18
24
 
19
25
  This is still in early development. As such, there will be frequent changes, which may or not break previous versions of the Gem.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/pivotpro/base.rb CHANGED
@@ -6,10 +6,12 @@ module PivotPro
6
6
  class << self
7
7
 
8
8
  def authenticate
9
- Pivotal::Configuration.options[:api_key] = "acf3d20d12757cfd975f8551122b10a9"
9
+ raise "missing api key" unless PivotPro::Configuration.api_key
10
+ Pivotal::Configuration.options[:api_key] = PivotPro::Configuration.api_key
10
11
  end
11
12
 
12
13
  def scoped_project
14
+ raise "project unknown" unless PivotPro::Configuration.scoped_project
13
15
  @@scoped_project = PivotPro::Configuration.scoped_project
14
16
  end
15
17
 
@@ -4,8 +4,12 @@ module PivotPro
4
4
  attr_accessor :options
5
5
  @options = {}
6
6
 
7
+ def api_key
8
+ options[:api_key] ||= YAML.load_file(File.join(ENV['HOME'],".pivotal"))[:api_key] rescue nil
9
+ end
10
+
7
11
  def scoped_project
8
- options[:scoped_project] # ||= File.open(YAML)
12
+ options[:scoped_project] ||= YAML.load_file('config/pivotal.yml')[:project_id] rescue nil
9
13
  end
10
14
 
11
15
  def scoped_project_name
@@ -9,6 +9,19 @@ module PivotPro
9
9
  PivotPro::User.print_projects
10
10
  when /^stories:?(.*)/
11
11
  ($1.blank? || STORY_TYPES.include?($1)) ? PivotPro::User.print_stories($1) : print_usage
12
+ when /^install/
13
+ args[1] ? PivotPro::User.install(args[1]) : print_usage
14
+ when /^checkout/
15
+ args[1] ? PivotPro::Project.checkout(args[1]) : print_usage
16
+ when /^cucumber:(.+)/
17
+ case $1
18
+ when 'pull'
19
+ PivotPro::Project.pull_stories
20
+ when 'push'
21
+ PivotPro::Project.push_stories
22
+ else
23
+ print_usage
24
+ end
12
25
  else
13
26
  print_usage
14
27
  end
@@ -19,18 +32,24 @@ module PivotPro
19
32
 
20
33
  def self.print_usage
21
34
  puts %q{
35
+ ==================================== PivotPro ====================================
22
36
  === General Commands
23
37
 
24
38
  help # show this usage
25
39
  list # list your PivotalTracker projects
40
+ install <api_key> # set up pivotpro to use your api key
26
41
 
27
- === App Commands (execute inside a checkout directory, or use --project <id>
42
+ checkout <id> # associate the current folder with a project
43
+
44
+ === App Commands (execute inside a checkout directory, or use --project, -p <id>)
28
45
 
29
46
  stories # list all stories associated with this project
30
47
  stories:features # list all stories that are features
31
48
  stories:bugs # list all stories that are bugs
32
49
  stories:releases # list all stories that are releases
33
50
 
51
+ cucumber:pull # creates cucumber features from project feature descriptions
52
+ cucumber:push # updates project features with cucumber stories
34
53
  }
35
54
  end
36
55
 
@@ -1,14 +1,35 @@
1
1
  module PivotPro
2
2
  class Project < PivotPro::Base
3
3
 
4
- def self.stories
5
- Pivotal::Project.find
6
- end
4
+ class << self
5
+
6
+ def checkout(project_id)
7
+ begin
8
+ FileUtils.mkdir_p('config')
9
+ File.open('config/pivotal.yml','w'){|f|f.write({:project_id => project_id}.to_yaml)}
10
+ rescue
11
+ "There was an error checking out this project"
12
+ end
13
+ end
14
+
15
+ def pull_stories
16
+ begin
17
+ FileUtils.mkdir_p('features')
18
+ PivotPro::User.stories("features").each do |s|
19
+ File.open("features/#{s.id}_#{(sn=s.name.gsub(/[^A-Za-z0-9\ ]/,'').gsub(' ','_').downcase)[0,25] rescue sn}.feature","w"){|f|f.write(
20
+ %Q{Scenario: #{s.name}
7
21
 
8
- def self.print_stories(project_id)
9
- stories(project_id).each do |story|
10
- puts story.name
22
+ #{s.description}})}
23
+ end
24
+ rescue
25
+ "There was an error importing project features"
26
+ end
11
27
  end
28
+
29
+ def push_stories
30
+
31
+ end
32
+
12
33
  end
13
34
 
14
35
  end
data/lib/pivotpro/user.rb CHANGED
@@ -31,6 +31,17 @@ module PivotPro
31
31
  end
32
32
  end
33
33
 
34
+ def install(key)
35
+ file = File.join(ENV['HOME'],'.pivotal')
36
+ begin
37
+ File.open(file,"w"){|f|f.write({:api_key => key}.to_yaml)}
38
+ puts "API key logged to #{file}. Happy tracking!"
39
+ rescue
40
+ puts "Unable to access #{file}. Please add the following content manually:"
41
+ puts "#{{:api_key => key}.to_yaml}"
42
+ end
43
+ end
44
+
34
45
  end
35
46
 
36
47
  end
data/lib/pivotpro.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'pivotal'
3
+ require 'yaml'
4
+ require 'fileutils'
3
5
 
4
6
  require 'pivotpro/base'
5
7
  require 'pivotpro/configuration'
data/pivotpro.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pivotpro}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kevin Gisi"]
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.files = [
22
22
  ".document",
23
23
  ".gitignore",
24
+ "History.rdoc",
24
25
  "LICENSE",
25
26
  "README.rdoc",
26
27
  "Rakefile",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gisikw-pivotpro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gisi
@@ -34,6 +34,7 @@ extra_rdoc_files:
34
34
  files:
35
35
  - .document
36
36
  - .gitignore
37
+ - History.rdoc
37
38
  - LICENSE
38
39
  - README.rdoc
39
40
  - Rakefile