factorylabs-cargo 0.0.2.6 → 0.0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +6 -8
- data/README.rdoc +6 -2
- data/Rakefile +3 -0
- data/bin/cargo +0 -0
- data/bin/hack +4 -28
- data/bin/pack +6 -2
- data/bin/ship +7 -5
- data/bin/yank +6 -7
- data/lib/cargo/cargo_server.rb +4 -3
- data/lib/cargo/commands/base.rb +96 -0
- data/lib/cargo/commands/hack.rb +47 -0
- data/lib/cargo/commands/pack.rb +12 -0
- data/lib/cargo/commands/ship.rb +21 -0
- data/lib/cargo/commands/yank.rb +37 -0
- data/lib/cargo/config.rb +30 -0
- data/lib/cargo.rb +6 -1
- data/test/base_test.rb +24 -0
- data/test/config_test.rb +19 -0
- data/test/hack_test.rb +33 -0
- metadata +26 -13
- data/lib/cargo/command_helpers.rb +0 -61
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/cargo_spec.rb +0 -11
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -10
- data/tasks/rspec.rake +0 -21
data/Manifest.txt
CHANGED
@@ -11,11 +11,9 @@ files/cargo.user.js
|
|
11
11
|
files/cargo.png
|
12
12
|
lib/cargo.rb
|
13
13
|
lib/cargo/cargo_server.rb
|
14
|
-
lib/cargo/
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
spec/spec_helper.rb
|
21
|
-
tasks/rspec.rake
|
14
|
+
lib/cargo/commands/base.rb
|
15
|
+
lib/cargo/commands/hack.rb
|
16
|
+
lib/cargo/commands/pack.rb
|
17
|
+
lib/cargo/commands/ship.rb
|
18
|
+
lib/cargo/commands/yank.rb
|
19
|
+
lib/cargo/config.rb
|
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@ workflow.
|
|
9
9
|
More features will be added. Pivotal integration on git wrapper commands and
|
10
10
|
other features are on the unofficial list.
|
11
11
|
|
12
|
-
This is
|
12
|
+
This is still alpha
|
13
13
|
|
14
14
|
== FEATURES:
|
15
15
|
|
@@ -93,7 +93,11 @@ Future support will include:
|
|
93
93
|
|
94
94
|
== INSTALL:
|
95
95
|
|
96
|
-
sudo gem install factorylabs-cargo --source=http://gems.github.com
|
96
|
+
sudo gem install factorylabs-cargo --source=http://gems.github.com
|
97
|
+
|
98
|
+
== Setup:
|
99
|
+
|
100
|
+
echo "api_key: YOUR_PIVOTAL_TRACKER_API_KEY" > ~/.cargo.yml
|
97
101
|
|
98
102
|
== LICENSE:
|
99
103
|
|
data/Rakefile
CHANGED
@@ -10,6 +10,7 @@ $hoe = Hoe.new('cargo', Cargo::VERSION) do |p|
|
|
10
10
|
p.rubyforge_name = p.name
|
11
11
|
p.extra_deps = [
|
12
12
|
['rack', '>= 0.9.1'],
|
13
|
+
['tpope-pickler', '>= 0.0.8'],
|
13
14
|
]
|
14
15
|
p.extra_dev_deps = [
|
15
16
|
['newgem', ">= #{::Newgem::VERSION}"]
|
@@ -19,6 +20,7 @@ $hoe = Hoe.new('cargo', Cargo::VERSION) do |p|
|
|
19
20
|
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
20
21
|
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
21
22
|
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
+
p.test_globs = 'test/**/*_test.rb'
|
22
24
|
end
|
23
25
|
|
24
26
|
require 'newgem/tasks' # load /tasks/*.rake
|
@@ -26,3 +28,4 @@ Dir['tasks/**/*.rake'].each { |t| load t }
|
|
26
28
|
|
27
29
|
# TODO - want other tests/tasks run by default? Add them to the list
|
28
30
|
# task :default => [:spec, :features]
|
31
|
+
|
data/bin/cargo
CHANGED
File without changes
|
data/bin/hack
CHANGED
@@ -1,32 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "#{File.dirname(__FILE__)}/../lib/cargo/
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/cargo/commands/hack.rb"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if ARGV.empty?
|
8
|
-
total = `git branch`.scan("story").size
|
9
|
-
if total == 0
|
10
|
-
default = "story"
|
11
|
-
else
|
12
|
-
default = "story_#{total + 1}"
|
13
|
-
end
|
14
|
-
name = Readline.readline "Topic name (#{default}): "
|
15
|
-
if name.strip.empty?
|
16
|
-
name = default
|
17
|
-
end
|
18
|
-
else
|
19
|
-
name = ARGV[0]
|
20
|
-
end
|
21
|
-
|
22
|
-
if ARGV.length > 1
|
23
|
-
story_number = ARGV[1]
|
24
|
-
else
|
25
|
-
story_number = Readline.readline "Story number (optional): "
|
26
|
-
end
|
27
|
-
|
28
|
-
unless story_number.strip.empty?
|
29
|
-
name = "#{name}-#{story_number}"
|
4
|
+
trap "INT" do
|
5
|
+
exit!
|
30
6
|
end
|
31
7
|
|
32
|
-
|
8
|
+
Cargo::Commands::Hack.new(ARGV)
|
data/bin/pack
CHANGED
data/bin/ship
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "#{File.dirname(__FILE__)}/../lib/cargo/
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/cargo/commands/ship.rb"
|
3
|
+
|
4
|
+
trap "INT" do
|
5
|
+
exit!
|
6
|
+
end
|
7
|
+
|
8
|
+
Cargo::Commands::Ship.new(ARGV)
|
3
9
|
|
4
|
-
branch = git_branch
|
5
|
-
git_merge_with_master(branch)
|
6
|
-
cmd "git push origin master"
|
7
|
-
cmd "git branch -d #{branch}"
|
data/bin/yank
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "#{File.dirname(__FILE__)}/../lib/cargo/
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/cargo/commands/yank.rb"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
apply_stash_if_was_dirty
|
4
|
+
trap "INT" do
|
5
|
+
exit!
|
6
|
+
end
|
7
|
+
|
8
|
+
Cargo::Commands::Yank.new(ARGV)
|
data/lib/cargo/cargo_server.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rack'
|
3
3
|
require 'cargo'
|
4
|
-
require "#{File.dirname(__FILE__)}/
|
4
|
+
require "#{File.dirname(__FILE__)}/commands/hack.rb"
|
5
|
+
require "#{File.dirname(__FILE__)}/commands/ship.rb"
|
5
6
|
|
6
7
|
puts "=> Starting Cargo #{Cargo::VERSION} on http://0.0.0.0:8081"
|
7
8
|
puts "=> Ctrl-C to shutdown server"
|
@@ -23,7 +24,7 @@ class CargoServer
|
|
23
24
|
case req.path_info
|
24
25
|
|
25
26
|
when '/start' # start a story
|
26
|
-
puts
|
27
|
+
puts Cargo::Commands::Hack.new(req['name'], req['id'])
|
27
28
|
notify("Starting Story", "Starting story '#{req['name']}' [#{req['id']}]", 0)
|
28
29
|
|
29
30
|
[200, { 'Content-Type' => 'application/json; charset=utf-8'},
|
@@ -33,7 +34,7 @@ class CargoServer
|
|
33
34
|
branch = git_branch
|
34
35
|
story_id = branch.split('-').last
|
35
36
|
if story_id == req['id']
|
36
|
-
puts
|
37
|
+
puts Cargo::Commands::Ship.new
|
37
38
|
notify("Finishing Story", "Finishing story '#{req['name']}' [#{req['id']}]", 0)
|
38
39
|
else
|
39
40
|
notify("Story id doesn't match current branch", "Story id doesn't match current branch '#{branch}' [#{req['id']}]", 1)
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'readline'
|
3
|
+
require 'pp'
|
4
|
+
require 'pickler'
|
5
|
+
|
6
|
+
require "#{File.dirname(__FILE__)}/../config.rb"
|
7
|
+
|
8
|
+
module Cargo
|
9
|
+
module Commands
|
10
|
+
class Base
|
11
|
+
attr_accessor :current_project
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@config = get_config
|
15
|
+
|
16
|
+
if @config.integrate_with_tracker
|
17
|
+
@tracker = Pickler::Tracker.new(@config.api_key, :false)
|
18
|
+
|
19
|
+
unless @config.project
|
20
|
+
@config.project = grab_project_id_from_user
|
21
|
+
@config.write_project
|
22
|
+
end
|
23
|
+
|
24
|
+
@current_project = Pickler::Tracker::Project.new(@tracker,@tracker.get_xml("/projects/#{@config.project}")["project"])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(args)
|
29
|
+
setup
|
30
|
+
run(args)
|
31
|
+
end
|
32
|
+
|
33
|
+
def run(args)
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_config
|
37
|
+
Cargo::Config.new(true)
|
38
|
+
end
|
39
|
+
|
40
|
+
def grab_project_id_from_user
|
41
|
+
response = @tracker.get_xml("/projects")
|
42
|
+
|
43
|
+
projects = [response["projects"]].flatten.compact.map {|s| Pickler::Tracker::Project.new(@tracker,s)}
|
44
|
+
|
45
|
+
puts 'Please choose a tracker project for the current directory'
|
46
|
+
projects.each_with_index do |project, i|
|
47
|
+
puts "#{i+1}) #{project.name}"
|
48
|
+
end
|
49
|
+
choice = Readline.readline "Enter: "
|
50
|
+
projects[choice.to_i - 1].id
|
51
|
+
end
|
52
|
+
|
53
|
+
def current_branch
|
54
|
+
`git branch | grep "*"`.strip[2..-1]
|
55
|
+
end
|
56
|
+
|
57
|
+
def checkout_branch(branch)
|
58
|
+
cmd "git checkout #{branch}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def merge_with_master(branch=current_branch)
|
62
|
+
checkout_branch "master"
|
63
|
+
cmd "git merge #{branch}"
|
64
|
+
end
|
65
|
+
|
66
|
+
def refresh_master
|
67
|
+
checkout_branch "master"
|
68
|
+
cmd "git pull origin master"
|
69
|
+
end
|
70
|
+
|
71
|
+
def cmd(input)
|
72
|
+
result = `#{input}`
|
73
|
+
puts result
|
74
|
+
if $?.exitstatus > 0
|
75
|
+
puts "Cargo (#{input}) failed, exiting. [#{$?.exitstatus}]"
|
76
|
+
exit 1
|
77
|
+
end
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
def compare_git_ver
|
82
|
+
m = /git version (\d+).(\d+).(\d+)/.match(`git version`.strip)
|
83
|
+
return true if m[1].to_i > 1
|
84
|
+
return false if m[1].to_i < 1
|
85
|
+
return true if m[2].to_i > 5
|
86
|
+
return false if m[2].to_i < 5
|
87
|
+
return true if m[3].to_i >= 3
|
88
|
+
return false
|
89
|
+
end
|
90
|
+
|
91
|
+
def check_git_ver
|
92
|
+
raise "Invalid git version, use at least 1.5.3" unless compare_git_ver
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/base.rb"
|
2
|
+
|
3
|
+
module Cargo
|
4
|
+
module Commands
|
5
|
+
class Hack < Cargo::Commands::Base
|
6
|
+
attr_accessor :story
|
7
|
+
|
8
|
+
def run(args)
|
9
|
+
refresh_master
|
10
|
+
get_story(args[0])
|
11
|
+
cmd "git checkout -b #{escape(self.story.name)}-#{self.story.id}"
|
12
|
+
self.story.transition!('started')
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_story(story_id)
|
16
|
+
if story_id.nil?
|
17
|
+
stories = fetch_stories
|
18
|
+
choice = Readline.readline "Enter story number: "
|
19
|
+
if !choice.empty? && choice.to_i.to_s == choice
|
20
|
+
story_id = stories[choice.to_i - 1].id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
raise 'Invalid story' if story_id.blank?
|
25
|
+
self.story = Pickler::Tracker::Story.new(@current_project,@current_project.tracker.get_xml("/projects/#{@current_project.id}/stories/#{story_id}")["story"])
|
26
|
+
end
|
27
|
+
|
28
|
+
def fetch_stories
|
29
|
+
puts "Fetching tracker stories"
|
30
|
+
stories = current_project.stories('state:unstarted')
|
31
|
+
puts "Choose a story"
|
32
|
+
stories.each_with_index do |story, i|
|
33
|
+
puts "#{i+1}) #{story.name}"
|
34
|
+
end
|
35
|
+
stories
|
36
|
+
end
|
37
|
+
|
38
|
+
def escape(name)
|
39
|
+
name.gsub!(/\W+/, ' ') # all non-word chars to spaces
|
40
|
+
name.strip! # ohh la la
|
41
|
+
name.downcase! #
|
42
|
+
name.gsub!(/\ +/, '_')
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/base.rb"
|
2
|
+
module Cargo
|
3
|
+
module Commands
|
4
|
+
class Ship < Cargo::Commands::Base
|
5
|
+
|
6
|
+
def run(args)
|
7
|
+
branch = current_branch
|
8
|
+
merge_with_master(branch)
|
9
|
+
cmd "git push origin master"
|
10
|
+
cmd "git branch -d #{branch}"
|
11
|
+
finish_story(branch.split('-').last) if @config.api_available?
|
12
|
+
end
|
13
|
+
|
14
|
+
def finish_story(story_id)
|
15
|
+
story = Pickler::Tracker::Story.new(@current_project,@current_project.tracker.get_xml("/projects/#{@current_project.id}/stories/#{story_id}")["story"])
|
16
|
+
story.finish!
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/base.rb"
|
2
|
+
module Cargo
|
3
|
+
module Commands
|
4
|
+
class Yank < Cargo::Commands::Base
|
5
|
+
|
6
|
+
def run(args)
|
7
|
+
branch = current_branch
|
8
|
+
refresh_master
|
9
|
+
cmd "git checkout #{branch}"
|
10
|
+
was_dirty = stash_if_dirty
|
11
|
+
cmd "git rebase master"
|
12
|
+
apply_stash if was_dirty
|
13
|
+
end
|
14
|
+
|
15
|
+
def is_branch_dirty?
|
16
|
+
status = `git status`
|
17
|
+
/\#\s+modified\:/ =~ status
|
18
|
+
end
|
19
|
+
|
20
|
+
def stash_if_dirty
|
21
|
+
dirty = is_branch_dirty?
|
22
|
+
if dirty
|
23
|
+
cmd "git stash"
|
24
|
+
end
|
25
|
+
dirty
|
26
|
+
end
|
27
|
+
|
28
|
+
def apply_stash
|
29
|
+
stash_list = `git stash list`
|
30
|
+
if /stash\@\{\d\}\:/ =~ stash_list
|
31
|
+
cmd "git stash pop"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/cargo/config.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Cargo
|
4
|
+
class Config
|
5
|
+
attr_accessor :api_key, :project, :integrate_with_tracker
|
6
|
+
|
7
|
+
def initialize(integrate_with_tracker)
|
8
|
+
@integrate_with_tracker = integrate_with_tracker
|
9
|
+
get_file_data
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_file_data
|
13
|
+
raise "No api key in ~/.cargo.yml" unless File.exists? File.expand_path('~/.cargo.yml')
|
14
|
+
config = YAML.load_file(File.expand_path('~/.cargo.yml'))
|
15
|
+
@api_key = config["api_key"] if config
|
16
|
+
raise "No api key in ~/.cargo.yml" if @api_key.nil?
|
17
|
+
config = YAML.load_file('.cargo.yml') if File.exists? '.cargo.yml'
|
18
|
+
@project = config["project"] if config
|
19
|
+
end
|
20
|
+
|
21
|
+
def write_project
|
22
|
+
raise "No project id is set" unless @project
|
23
|
+
File.open(File.expand_path('./.cargo.yml'), 'a'){|file| file.write("\nproject: #{@project}\n")}
|
24
|
+
end
|
25
|
+
|
26
|
+
def api_available?
|
27
|
+
@api_key && @project && @integrate_with_tracker
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/cargo.rb
CHANGED
data/test/base_test.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
require 'lib/cargo/commands/base'
|
4
|
+
|
5
|
+
class Cargo::Commands::BaseTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
Cargo::Config.any_instance.stubs(:get_file_data).returns(true)
|
9
|
+
config = Cargo::Config.new(true)
|
10
|
+
config.api_key = '12345'
|
11
|
+
config.project = '54321'
|
12
|
+
Cargo::Commands::Base.any_instance.stubs(:get_config).returns(config)
|
13
|
+
|
14
|
+
project_xml = {"project" => {"name"=>"Project test", "iteration_length"=>1, "week_start_day"=>"Monday", "point_scale"=>"0,1,2,4,8", "id"=>54321}}
|
15
|
+
Pickler::Tracker.any_instance.stubs(:get_xml).returns(project_xml)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_create
|
19
|
+
base = Cargo::Commands::Base.new([])
|
20
|
+
assert base.current_project
|
21
|
+
assert_equal 54321, base.current_project.id
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/test/config_test.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
require 'lib/cargo/config'
|
4
|
+
|
5
|
+
class Cargo::ConfigTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
Cargo::Config.any_instance.stubs(:get_file_data).returns(true)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_create
|
12
|
+
config = Cargo::Config.new(true)
|
13
|
+
config.api_key = '12345'
|
14
|
+
config.project = '54321'
|
15
|
+
|
16
|
+
assert config.integrate_with_tracker
|
17
|
+
assert config.api_available?
|
18
|
+
end
|
19
|
+
end
|
data/test/hack_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
require 'lib/cargo/commands/hack'
|
4
|
+
|
5
|
+
class Cargo::Commands::HackTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
Cargo::Config.any_instance.stubs(:get_file_data).returns(true)
|
9
|
+
config = Cargo::Config.new(true)
|
10
|
+
config.api_key = '12345'
|
11
|
+
config.project = '54321'
|
12
|
+
Cargo::Commands::Hack.any_instance.stubs(:get_config).returns(config)
|
13
|
+
|
14
|
+
@tracker = Pickler::Tracker.new('78910', :false)
|
15
|
+
@project_id = '54321'
|
16
|
+
@project_xml = {"name"=>"Project test", "iteration_length"=>1, "week_start_day"=>"Monday", "point_scale"=>"0,1,2,4,8", "id"=>54321}
|
17
|
+
@current_project = Pickler::Tracker::Project.new(@tracker,@project_xml)
|
18
|
+
|
19
|
+
@story_id = '12345'
|
20
|
+
@story_xml = {"story" => {"name"=>"Story test", "current_state"=>"unstarted", "requested_by"=>"Craig Partin", "url"=>"http://www.pivotaltracker.com/story/show/12345", "story_type"=>"bug", "id"=>12345, "description"=>nil, "created_at"=>"Mon Apr 27 17:48:26 UTC 2009"}}
|
21
|
+
|
22
|
+
Cargo::Commands::Hack.any_instance.stubs(:cmd).returns(0)
|
23
|
+
Pickler::Tracker.any_instance.stubs(:get_xml).returns(@story_xml)
|
24
|
+
Pickler::Tracker.any_instance.stubs(:request_xml).returns({})
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_create_object
|
28
|
+
hack = Cargo::Commands::Hack.new(["#{@story_id}"])
|
29
|
+
assert_equal 12345, hack.story.id
|
30
|
+
assert_equal 'started', hack.story.current_state
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factorylabs-cargo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Factory Design Labs
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-19 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,16 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.9.1
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: tpope-pickler
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.8
|
34
|
+
version:
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: newgem
|
27
37
|
type: :development
|
@@ -42,7 +52,7 @@ dependencies:
|
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: 1.8.0
|
44
54
|
version:
|
45
|
-
description: http://www.factorylabs.com/images/cargo.png Cargo is a set of tools to help streamline using git. The type of tools and usage vary, but they represent a process that we've adapted to streamline our workflow. More features will be added. Pivotal integration on git wrapper commands and other features are on the unofficial list. This is
|
55
|
+
description: http://www.factorylabs.com/images/cargo.png Cargo is a set of tools to help streamline using git. The type of tools and usage vary, but they represent a process that we've adapted to streamline our workflow. More features will be added. Pivotal integration on git wrapper commands and other features are on the unofficial list. This is still alpha
|
46
56
|
email:
|
47
57
|
- interactive@factorylabs.com
|
48
58
|
executables:
|
@@ -71,14 +81,15 @@ files:
|
|
71
81
|
- files/cargo.png
|
72
82
|
- lib/cargo.rb
|
73
83
|
- lib/cargo/cargo_server.rb
|
74
|
-
- lib/cargo/
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
84
|
+
- lib/cargo/commands/base.rb
|
85
|
+
- lib/cargo/commands/hack.rb
|
86
|
+
- lib/cargo/commands/pack.rb
|
87
|
+
- lib/cargo/commands/ship.rb
|
88
|
+
- lib/cargo/commands/yank.rb
|
89
|
+
- lib/cargo/config.rb
|
90
|
+
- test/base_test.rb
|
91
|
+
- test/config_test.rb
|
92
|
+
- test/hack_test.rb
|
82
93
|
has_rdoc: true
|
83
94
|
homepage: http://www.factorylabs.com/images/cargo.png
|
84
95
|
post_install_message: ""
|
@@ -106,5 +117,7 @@ rubygems_version: 1.2.0
|
|
106
117
|
signing_key:
|
107
118
|
specification_version: 2
|
108
119
|
summary: http://www.factorylabs.com/images/cargo.png Cargo is a set of tools to help streamline using git
|
109
|
-
test_files:
|
110
|
-
|
120
|
+
test_files:
|
121
|
+
- test/base_test.rb
|
122
|
+
- test/config_test.rb
|
123
|
+
- test/hack_test.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'readline'
|
2
|
-
|
3
|
-
def git_branch
|
4
|
-
`git branch | grep "*"`.strip[2..-1]
|
5
|
-
end
|
6
|
-
|
7
|
-
def is_branch_dirty?
|
8
|
-
status = `git status`
|
9
|
-
/\#\s+modified\:/ =~ status
|
10
|
-
end
|
11
|
-
|
12
|
-
def git_checkout(branch)
|
13
|
-
cmd "git checkout #{branch}"
|
14
|
-
end
|
15
|
-
|
16
|
-
def stash_if_dirty
|
17
|
-
if is_branch_dirty?
|
18
|
-
cmd "git stash"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def apply_stash_if_was_dirty
|
23
|
-
stash_list = `git stash list`
|
24
|
-
if /stash\@\{\d\}\:/ =~ stash_list
|
25
|
-
cmd "git stash pop"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def git_merge_with_master(branch=git_branch)
|
30
|
-
git_checkout "master"
|
31
|
-
cmd "git merge #{branch}"
|
32
|
-
end
|
33
|
-
|
34
|
-
def git_freshen_master
|
35
|
-
git_checkout "master"
|
36
|
-
cmd "git pull origin master"
|
37
|
-
end
|
38
|
-
|
39
|
-
def cmd(input)
|
40
|
-
result = `#{input}`
|
41
|
-
puts result
|
42
|
-
if $?.exitstatus > 0
|
43
|
-
puts "Cargo (#{input}) failed, exiting. [#{$?.exitstatus}]"
|
44
|
-
exit 1
|
45
|
-
end
|
46
|
-
result
|
47
|
-
end
|
48
|
-
|
49
|
-
def compare_git_ver
|
50
|
-
m = /git version (\d+).(\d+).(\d+)/.match(`git version`.strip)
|
51
|
-
return true if m[1].to_i > 1
|
52
|
-
return false if m[1].to_i < 1
|
53
|
-
return true if m[2].to_i > 5
|
54
|
-
return false if m[2].to_i < 5
|
55
|
-
return true if m[3].to_i >= 3
|
56
|
-
return false
|
57
|
-
end
|
58
|
-
|
59
|
-
def check_git_ver
|
60
|
-
raise "Invalid git version, use at least 1.5.3" unless compare_git_ver
|
61
|
-
end
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/cargo.rb'}"
|
9
|
-
puts "Loading cargo gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/spec/cargo_spec.rb
DELETED
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/spec/spec_helper.rb
DELETED
data/tasks/rspec.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems'
|
5
|
-
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
|
-
rescue LoadError
|
10
|
-
puts <<-EOS
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run the specs under spec/models"
|
18
|
-
Spec::Rake::SpecTask.new do |t|
|
19
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
-
end
|