legit 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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dotfile_linker.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Dillon Kearns
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,9 @@
1
+ # Legit
2
+
3
+ ## Contributing
4
+
5
+ 1. Fork it
6
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
7
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
8
+ 4. Push to the branch (`git push origin my-new-feature`)
9
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #! /usr/bin/ruby
2
+
3
+ require 'lib/legit_helper'
4
+
5
+ todo_string = ARGV[0] || 'TODO'
6
+ system("git diff --staged | grep '^+' | grep #{todo_string}")
7
+
8
+ if $?.success?
9
+ show("[pre-commit hook] Aborting commit... found staged `#{todo_string}`s.", :warning)
10
+ exit 1
11
+ else
12
+ show("Success: No `#{todo_string}`s staged.", :success)
13
+ exit 0
14
+ end
data/bin/git-delete ADDED
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/ruby
2
+
3
+ require 'lib/legit_helper'
4
+
5
+ branch_name = ARGV[0] or raise 'Must pass in branch name'
6
+
7
+ system("git branch -d #{branch_name}")
8
+
9
+ if $?.success?
10
+ delete_remote_branch(branch_name)
11
+ else
12
+ show("Force delete branch #{branch_name}? (y/n)", :warning)
13
+ if STDIN.gets.chomp =~ /^y/
14
+ system("git branch -D #{branch_name}")
15
+ delete_remote_branch(branch_name)
16
+ else
17
+ puts "Abort. #{branch_name} not deleted"
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/ruby
2
+
3
+ require 'lib/legit_helper'
4
+
5
+ branch_name = ARGV[0] or raise 'Must pass in branch name'
6
+
7
+ system("git branch -d #{branch_name}")
8
+
9
+ if $?.success?
10
+ delete_remote_branch(branch_name)
11
+ else
12
+ show("Force delete branch #{branch_name}? (y/n)", :warning)
13
+ if STDIN.gets.chomp =~ /^y/
14
+ system("git branch -D #{branch_name}")
15
+ delete_remote_branch(branch_name)
16
+ else
17
+ puts "Abort. #{branch_name} not deleted"
18
+ end
19
+ end
data/legit.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ require File.expand_path("../lib/legit/version", __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Dillon Kearns"]
5
+ gem.email = ["dillon@dillonkearns.com"]
6
+ gem.description = "A collection of scripts for common git tasks, to simplify and improve workflow."
7
+ gem.summary = gem.description
8
+ gem.homepage = "https://github.com/dillonkearns/legit"
9
+
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "legit"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = Legit::VERSION
16
+
17
+ gem.required_ruby_version = ">=1.8.7"
18
+
19
+ gem.add_development_dependency "rake", "~> 10.0.3"
20
+ gem.add_runtime_dependency "colorize", "~> 0.5.8"
21
+ end
@@ -0,0 +1,3 @@
1
+ module Legit
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,24 @@
1
+ require 'colorize'
2
+
3
+ def current_branch
4
+ system "git rev-parse --abbrev-ref HEAD"
5
+ end
6
+
7
+ def delete_remote_branch(branch_name)
8
+ system("git push --delete origin #{branch_name}")
9
+ end
10
+
11
+ def show(message, type = :success)
12
+ color =
13
+ case type
14
+ when :success
15
+ :green
16
+ when :warning
17
+ :red
18
+ else
19
+ raise 'Unknown prompt type'
20
+ end
21
+
22
+ puts message.send(color)
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: legit
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Dillon Kearns
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-01-11 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ hash: 73
28
+ segments:
29
+ - 10
30
+ - 0
31
+ - 3
32
+ version: 10.0.3
33
+ requirement: *id001
34
+ prerelease: false
35
+ name: rake
36
+ type: :development
37
+ - !ruby/object:Gem::Dependency
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 27
44
+ segments:
45
+ - 0
46
+ - 5
47
+ - 8
48
+ version: 0.5.8
49
+ requirement: *id002
50
+ prerelease: false
51
+ name: colorize
52
+ type: :runtime
53
+ description: A collection of scripts for common git tasks, to simplify and improve workflow.
54
+ email:
55
+ - dillon@dillonkearns.com
56
+ executables:
57
+ - git-catch-todos
58
+ - git-delete
59
+ - git-push-upstream
60
+ extensions: []
61
+
62
+ extra_rdoc_files: []
63
+
64
+ files:
65
+ - .gitignore
66
+ - Gemfile
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - bin/git-catch-todos
71
+ - bin/git-delete
72
+ - bin/git-push-upstream
73
+ - legit.gemspec
74
+ - lib/legit/version.rb
75
+ - lib/legit_helper.rb
76
+ has_rdoc: true
77
+ homepage: https://github.com/dillonkearns/legit
78
+ licenses: []
79
+
80
+ post_install_message:
81
+ rdoc_options: []
82
+
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 57
91
+ segments:
92
+ - 1
93
+ - 8
94
+ - 7
95
+ version: 1.8.7
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ requirements: []
106
+
107
+ rubyforge_project:
108
+ rubygems_version: 1.5.3
109
+ signing_key:
110
+ specification_version: 3
111
+ summary: A collection of scripts for common git tasks, to simplify and improve workflow.
112
+ test_files: []
113
+