donald 0.1.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.
Files changed (5) hide show
  1. data/LICENSE +23 -0
  2. data/README +31 -0
  3. data/bin/donald +6 -0
  4. data/lib/donald/merge_tool.rb +59 -0
  5. metadata +58 -0
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ (The MIT License)
2
+
3
+ Copyright © 2009
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 NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
data/README ADDED
@@ -0,0 +1,31 @@
1
+ Donald
2
+
3
+ ---------
4
+
5
+ A simple vim based merge tool for git users
6
+
7
+ ---------
8
+
9
+ (The MIT License)
10
+
11
+ Copyright © 2009
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining
14
+ a copy of this software and associated documentation files (the
15
+ ‘Software’), to deal in the Software without restriction, including
16
+ without limitation the rights to use, copy, modify, merge, publish,
17
+ distribute, sublicense, and/or sell copies of the Software, and to
18
+ permit persons to whom the Software is furnished to do so, subject to
19
+ the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be
22
+ included in all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
25
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
28
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
+
data/bin/donald ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path(File.dirname(__FILE__) + '/../lib/donald/merge_tool')
3
+
4
+ merge_tool = Donald::MergeTool.new
5
+
6
+ merge_tool.start
@@ -0,0 +1,59 @@
1
+ module Donald
2
+ class Donald::MergeTool
3
+ DELIMITER = '******************************'
4
+
5
+ def start
6
+ files = unmerged_files git_status
7
+
8
+ if files.any?
9
+ print_files files
10
+
11
+ call_vim files
12
+ else
13
+ print_no_files_message
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def git_status
20
+ `git status`
21
+ end
22
+
23
+ def unmerged_files text
24
+ files = []
25
+
26
+ text.each_line do |line|
27
+ if line.match /unmerged: (.*)/
28
+ files << $1.strip
29
+ end
30
+ end
31
+
32
+ files
33
+ end
34
+
35
+ def call_vim files
36
+ system "vim -p #{files.join(' ')}"
37
+ end
38
+
39
+ def print_files files
40
+ print_delimiter
41
+
42
+ files.each {|f| puts f}
43
+
44
+ print_delimiter
45
+ end
46
+
47
+ def print_no_files_message
48
+ print_delimiter
49
+
50
+ puts 'No unmerged files found'
51
+
52
+ print_delimiter
53
+ end
54
+
55
+ def print_delimiter
56
+ puts DELIMITER
57
+ end
58
+ end
59
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: donald
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bruno Grasselli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-20 00:00:00 -03:00
13
+ default_executable: donald
14
+ dependencies: []
15
+
16
+ description: Simple vim based mergetool for git users.
17
+ email: bruno.grasselli@gmail.com
18
+ executables:
19
+ - donald
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README
26
+ - LICENSE
27
+ - bin/donald
28
+ - lib/donald/merge_tool.rb
29
+ has_rdoc: true
30
+ homepage: http://brunograsselli.com.br
31
+ licenses: []
32
+
33
+ post_install_message:
34
+ rdoc_options: []
35
+
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ version:
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ requirements: []
51
+
52
+ rubyforge_project:
53
+ rubygems_version: 1.3.5
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Simple vim based mergetool for git users.
57
+ test_files: []
58
+