wipit 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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 by John Thomas Marino
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ wipit
2
+ ======
3
+
4
+ wipit is a git command line utility that makes it easier to save work in progress.
5
+
6
+ Install
7
+ -------
8
+
9
+ gem install wipit
10
+
11
+ Commands
12
+ --------
13
+
14
+ Save your work.
15
+
16
+ $ wipit
17
+ > git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'
18
+
19
+ Save your work to a topic branch.
20
+
21
+ $ wipit my_wip_branch
22
+ > git checkout -b my_wip_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'
23
+
24
+ Save your work to a topic branch and push to origin.
25
+
26
+ $ wipit my_wip_branch -p
27
+ > git checkout -b my_wip_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP' && git push origin my_wip_branch
@@ -0,0 +1,11 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ task :default => :test
6
+ Rake::TestTask.new do |t|
7
+ t.libs << 'lib'
8
+ t.ruby_opts << '-rubygems'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
+
6
+ require 'wipit'
7
+ Wipit.run(*ARGV)
@@ -0,0 +1,33 @@
1
+ module Wipit
2
+ extend self
3
+
4
+ def command
5
+ @command ||= ''
6
+ end
7
+
8
+ def run(*args)
9
+ process *args
10
+ puts command
11
+ system command
12
+ end
13
+
14
+ def process(*args)
15
+ options = {:branch => '', :push => false}
16
+ until args.empty?
17
+ case arg = args.shift
18
+ when '-p' then options[:push] = true
19
+ else
20
+ options[:branch] = arg
21
+ end
22
+ end
23
+ build options
24
+ end
25
+
26
+ def build(options={})
27
+ @command = ''
28
+ @command << "git checkout -b #{options[:branch]} && " unless options[:branch].empty?
29
+ @command << "git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'"
30
+ @command << " && git push origin #{options[:branch]}" unless options[:branch].empty? || options[:push] != true
31
+ @command
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module Wipit
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
+ require 'test/unit'
3
+ require 'util_capture'
4
+ require 'wipit'
5
+
6
+ class Test::Unit::TestCase
7
+ def Wipit(args)
8
+ Wipit.process(*args.split(' '))
9
+ end
10
+
11
+ def assert_command(input, expected)
12
+ assert_equal expected, Wipit(input)
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'stringio'
2
+
3
+ module Kernel
4
+
5
+ def capture_stdout
6
+ out = StringIO.new
7
+ $stdout = out
8
+ yield
9
+ return out
10
+ ensure
11
+ $stdout = STDOUT
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__)
2
+ require 'helper'
3
+
4
+ class WipitTest < Test::Unit::TestCase
5
+
6
+ def test_basic_run
7
+ assert_command '', "git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'"
8
+ end
9
+
10
+ def test_branch_run
11
+ assert_command 'my_branch', "git checkout -b my_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'"
12
+ end
13
+
14
+ def test_two_branches_run
15
+ assert_command 'my_branch my_branch2', "git checkout -b my_branch2 && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'"
16
+ end
17
+
18
+ def test_branch_push_run
19
+ assert_command 'my_branch -p', "git checkout -b my_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP' && git push origin my_branch"
20
+ end
21
+
22
+ def test_push_branch_run
23
+ assert_command '-p my_branch', "git checkout -b my_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP' && git push origin my_branch"
24
+ end
25
+
26
+ def test_push_run
27
+ assert_command '-p', "git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'"
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wipit
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - John Thomas Marino
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-29 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: "\n Save your work.\n\n $ wipit\n > git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'\n\n Save your work to a topic branch.\n\n $ wipit my_wip_branch\n > git checkout -b my_wip_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP'\n\n Save your work to a topic branch and push to origin.\n\n $ wipit my_wip_branch -p\n > git checkout -b my_wip_branch && git add . && git rm $(git ls-files --deleted) && git commit -m 'WIP' && git push origin my_wip_branch\n "
23
+ email: writejm@gmail.com
24
+ executables:
25
+ - wipit
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - README.md
32
+ - Rakefile
33
+ - LICENSE
34
+ - lib/wipit/version.rb
35
+ - lib/wipit.rb
36
+ - bin/wipit
37
+ - test/helper.rb
38
+ - test/util_capture.rb
39
+ - test/wipit_test.rb
40
+ has_rdoc: true
41
+ homepage: http://github.com/johmas/wipit
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirements: []
68
+
69
+ rubyforge_project: wipit
70
+ rubygems_version: 1.3.7
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: wipit is a command line utility for git that makes it easier to save work in progress.
74
+ test_files: []
75
+