donald 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,30 @@
1
- Donald
1
+ h2. About Donald
2
2
 
3
- ---------
3
+ A simple vim based merge tool for git users.
4
+ Use this gem when a git conflict happens and it will open all conflicted files using vim (one file by tab).
4
5
 
5
- A simple vim based merge tool for git users
6
+ h2. Installation:
6
7
 
7
- ---------
8
+ sudo gem sources -a http://gemcutter.org
9
+ sudo gem install donald
10
+
11
+ h2. Usage:
12
+
13
+ donald
14
+
15
+ h2. Options:
16
+
17
+ -m or --mvim
18
+ Open files using mvim
19
+
20
+ -g or --gvim
21
+ Open files using gvim
22
+
23
+ Example:
24
+
25
+ donald -g
26
+
27
+ h2. License
8
28
 
9
29
  (The MIT License)
10
30
 
data/bin/donald CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../lib/donald/merge_tool')
3
3
 
4
- merge_tool = Donald::MergeTool.new
4
+ merge_tool = Donald::MergeTool.new(ARGV)
5
5
 
6
6
  merge_tool.start
@@ -1,6 +1,11 @@
1
1
  module Donald
2
2
  class Donald::MergeTool
3
3
  DELIMITER = '******************************'
4
+ DEFAULT_EDITOR = 'vim'
5
+
6
+ def initialize args = []
7
+ @options = parse_options args
8
+ end
4
9
 
5
10
  def start
6
11
  files = unmerged_files git_status
@@ -33,7 +38,9 @@ module Donald
33
38
  end
34
39
 
35
40
  def call_vim files
36
- system "vim -p #{files.join(' ')}"
41
+ editor = @options[:editor] || DEFAULT_EDITOR
42
+
43
+ system "#{editor} -p #{files.join(' ')}"
37
44
  end
38
45
 
39
46
  def print_files files
@@ -55,5 +62,14 @@ module Donald
55
62
  def print_delimiter
56
63
  puts DELIMITER
57
64
  end
65
+
66
+ def parse_options args
67
+ options = {}
68
+
69
+ options.merge! :editor => 'mvim' if args.include?('-m') || args.include?('--mvim')
70
+ options.merge! :editor => 'gvim' if args.include?('-g') || args.include?('--gvim')
71
+
72
+ options
73
+ end
58
74
  end
59
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: donald
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Grasselli
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-20 00:00:00 -03:00
12
+ date: 2010-03-21 00:00:00 -03:00
13
13
  default_executable: donald
14
14
  dependencies: []
15
15
 
16
- description: Simple vim based mergetool for git users.
16
+ description: Use this gem when a git conflict happens and it will open all conflicted files using vim (one file by tab).
17
17
  email: bruno.grasselli@gmail.com
18
18
  executables:
19
19
  - donald
@@ -22,7 +22,7 @@ extensions: []
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
- - README
25
+ - README.textile
26
26
  - LICENSE
27
27
  - bin/donald
28
28
  - lib/donald/merge_tool.rb