pt-flow 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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pt-flow.gemspec
4
+ gemspec
5
+ gem 'rake'
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jens Balvig
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,29 @@
1
+ # Pt::Flow
2
+
3
+ TODO: Write a gem description.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'pt-flow'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install pt-flow
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/flow ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+
5
+ lib = (Pathname.new(__FILE__).realpath.dirname + '../lib').to_s
6
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
7
+
8
+ require 'pt-flow'
9
+
10
+ PT::Flow::UI.new ARGV
data/lib/pt-flow.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "pt"
2
+ require "pt-flow/version"
3
+ require "pt-flow/ui"
4
+
5
+ module PT
6
+ module Flow
7
+ # Your code goes here...
8
+ end
9
+ end
data/lib/pt-flow/ui.rb ADDED
@@ -0,0 +1,71 @@
1
+ class PT::Flow::UI < PT::UI
2
+
3
+ def setup
4
+ `git-tracker install`
5
+ message 'git-tracker ready to add story numbers to commits'
6
+ congrats 'All done!'
7
+ end
8
+
9
+ def load_local_config
10
+ config = super
11
+ config[:github_url] = ask "What is the url for the Github repo?"
12
+ save_config(config, LOCAL_CONFIG_PATH)
13
+ config
14
+ end
15
+
16
+ def list
17
+ @params[0] ||= 'all'
18
+ super
19
+ end
20
+
21
+ def checkout
22
+ tasks = @client.get_work(@project)
23
+ table = PT::TasksTable.new(tasks)
24
+ if @params[0]
25
+ task = table[@params[0].to_i]
26
+ else
27
+ title("Available tasks in #{project_to_s}")
28
+ task = select("Please select a task to start working on", table)
29
+ end
30
+
31
+ result = @client.assign_task(@project, task, owner)
32
+ if result.errors.any?
33
+ error(result.errors.errors)
34
+ else
35
+ congrats("Task assigned to #{owner}, checking out new branch!")
36
+ end
37
+
38
+ `git checkout -B #{task.id}`
39
+ end
40
+
41
+ def request
42
+ `git push origin #{current_branch}`
43
+ task = PivotalTracker::Story.find(current_branch, @project.id)
44
+ `open '#{github_url}/pull/new/#{current_branch}?title=#{task.name} [##{task.id}]'`
45
+ end
46
+
47
+ def merge
48
+ branch = @params[0] || current_branch
49
+ `git checkout master`
50
+ `git merge #{branch}`
51
+ `git push origin master`
52
+ `git push origin :#{branch}`
53
+ `git branch -d #{branch}`
54
+ task = PivotalTracker::Story.find(branch, @project.id)
55
+ deliver_task(task)
56
+ end
57
+
58
+ private
59
+
60
+ def github_url
61
+ 'https://github.com/balvig/pt-flow'
62
+ end
63
+
64
+ def current_branch
65
+ @current_branch ||= `git rev-parse --abbrev-ref HEAD`.strip
66
+ end
67
+
68
+ def owner
69
+ @local_config[:user_name]
70
+ end
71
+ end
@@ -0,0 +1,5 @@
1
+ module PT
2
+ module Flow
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/pt-flow.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/pt-flow/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jens Balvig"]
6
+ gem.email = ["jens@balvig.com"]
7
+ gem.description = %q{Some extra methods for the pt gem to use in our dev flow.}
8
+ gem.summary = %q{Some extra methods for the pt gem to use in our dev flow.}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "pt-flow"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = PT::Flow::VERSION
17
+
18
+ gem.add_dependency 'pt'
19
+ gem.add_dependency 'git_tracker'
20
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pt-flow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jens Balvig
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pt
16
+ requirement: &70314329665840 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70314329665840
25
+ - !ruby/object:Gem::Dependency
26
+ name: git_tracker
27
+ requirement: &70314329665040 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70314329665040
36
+ description: Some extra methods for the pt gem to use in our dev flow.
37
+ email:
38
+ - jens@balvig.com
39
+ executables:
40
+ - flow
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - bin/flow
50
+ - lib/pt-flow.rb
51
+ - lib/pt-flow/ui.rb
52
+ - lib/pt-flow/version.rb
53
+ - pt-flow.gemspec
54
+ homepage: ''
55
+ licenses: []
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ segments:
67
+ - 0
68
+ hash: -3910727666003809260
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ segments:
76
+ - 0
77
+ hash: -3910727666003809260
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 1.8.11
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Some extra methods for the pt gem to use in our dev flow.
84
+ test_files: []