donald 0.1.3 → 0.1.4

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 (3) hide show
  1. data/README.textile +20 -4
  2. data/lib/donald/merge_tool.rb +22 -5
  3. metadata +2 -2
data/README.textile CHANGED
@@ -5,12 +5,12 @@ Use this gem when a git conflict happens and it will open all conflicted files u
5
5
 
6
6
  h2. Installation:
7
7
 
8
- sudo gem sources -a http://gemcutter.org
9
- sudo gem install donald
8
+ <pre><code>sudo gem sources -a http://gemcutter.org
9
+ sudo gem install donald</code></pre>
10
10
 
11
11
  h2. Usage:
12
12
 
13
- donald
13
+ <pre><code>donald</code></pre>
14
14
 
15
15
  h2. Options:
16
16
 
@@ -20,16 +20,32 @@ Open files using gvim
20
20
 
21
21
  Example:
22
22
 
23
- donald -g
23
+ <pre><code>donald -g</code></pre>
24
24
 
25
25
  h3. -m or --mvim
26
26
 
27
27
  Open files using mvim
28
28
 
29
+ h3. --vim
30
+
31
+ Open files using vim
32
+
29
33
  h3. -t or --textmate
30
34
 
31
35
  Open files using Textmate
32
36
 
37
+ h2. Setting up your default text editor
38
+
39
+ Set the $EDITOR variable in your ~/.bashrc file
40
+
41
+ Example:
42
+
43
+ <pre><code>export EDITOR="mate"</code></pre>
44
+
45
+ h2. Searching for conflicts
46
+
47
+ If you are using vim just type "n" to go to the next conflict.
48
+
33
49
  h2. License
34
50
 
35
51
  (The MIT License)
@@ -50,9 +50,7 @@ module Donald
50
50
  end
51
51
 
52
52
  def call_vim files
53
- editor = @options[:editor] || DEFAULT_EDITOR
54
-
55
- Kernel.system "#{editor}#{tab_argument editor} #{files.join(' ')}"
53
+ Kernel.system "#{editor}#{arguments(editor)} #{files.join(' ')}"
56
54
  end
57
55
 
58
56
  def print_files files
@@ -78,6 +76,7 @@ module Donald
78
76
  def parse_options args
79
77
  options = {}
80
78
 
79
+ options.merge! :editor => 'vim' if args.include?('--vim')
81
80
  options.merge! :editor => 'mvim' if args.include?('-m') || args.include?('--mvim')
82
81
  options.merge! :editor => 'gvim' if args.include?('-g') || args.include?('--gvim')
83
82
  options.merge! :editor => 'mate' if args.include?('-t') || args.include?('--textmate')
@@ -85,8 +84,26 @@ module Donald
85
84
  options
86
85
  end
87
86
 
88
- def tab_argument editor
89
- editor.include?('vim') ? ' -p' : ''
87
+ def editor
88
+ editor = @options[:editor] || system_editor_variable || DEFAULT_EDITOR
89
+ end
90
+
91
+ def system_editor_variable
92
+ editor = `echo $EDITOR`.chomp
93
+
94
+ editor.size.zero? ? nil : editor
95
+ end
96
+
97
+ def arguments editor
98
+ " #{tab_argument} #{search_argument}" if editor.include?('vim')
99
+ end
100
+
101
+ def tab_argument
102
+ '-p'
103
+ end
104
+
105
+ def search_argument
106
+ '+/HEAD'
90
107
  end
91
108
  end
92
109
  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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Grasselli
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-21 00:00:00 -03:00
12
+ date: 2010-04-24 00:00:00 -03:00
13
13
  default_executable: donald
14
14
  dependencies: []
15
15