thegarage-gitx 2.2.3.pre1 → 2.2.3.pre2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0b14ee5697a2883977afed2c228ab55bffb1465
4
- data.tar.gz: aef6ef947211f421c07b0e3aef71da696c2e9c31
3
+ metadata.gz: 828adabb95945ff82ba93923950a6af74dcff5e4
4
+ data.tar.gz: a153b52c49a3dea67cff353aaf43f63ac50e7a87
5
5
  SHA512:
6
- metadata.gz: 0dad8dba2b0b25ef97c4cd0a1628ba88227270ed2ce68de7cc53777206e762c90ce3e6833bd7ea509b0f8ef8f227d33364b8cb38c94fb364bf7e9baad63ada2f
7
- data.tar.gz: 4ddd4bd7aa598289b85962a2d6065ce40a242090fdb8084382bea447c9e20041e19299d39781453bdf9b5010b51a83fefbbc86ca083fcb7b464b5473940239a4
6
+ metadata.gz: a543bcecabda7e3945377d1fbda43b7d4b1d2222c44d09cfcb13f1e26a9f2f3adb2ce827183dbc980f6720440f73e86210dda80a851717dc81554c4a9e403877
7
+ data.tar.gz: 1e56171b3055a4c14620277d7d77c77ad2170ea7d1c626d7256a5a3bf4b270071b3f0d19339f3ff85b82bab1705122c5a97b0465be3de470e739a33c7612ad9a
@@ -153,30 +153,9 @@ module Thegarage
153
153
  description_template << changelog
154
154
  description_template << PULL_REQUEST_FOOTER
155
155
 
156
- body = input_from_editor(description_template.join("\n"))
156
+ body = ask_editor(description_template.join("\n"))
157
157
  body.gsub(PULL_REQUEST_FOOTER, '').chomp.strip
158
158
  end
159
-
160
- # launch configured editor to retreive message/string
161
- def input_from_editor(initial_text = '')
162
- Tempfile.open('reviewrequest.md') do |f|
163
- f << initial_text
164
- f.flush
165
-
166
- editor = repo.config['core.editor'] || ENV['EDITOR'] || 'vi'
167
- flags = case editor
168
- when 'mate', 'emacs', 'subl'
169
- '-w'
170
- when 'mvim'
171
- '-f'
172
- else
173
- ''
174
- end
175
- pid = fork { exec([editor, flags, f.path].join(' ')) }
176
- Process.waitpid(pid)
177
- File.read(f.path)
178
- end
179
- end
180
159
  end
181
160
  end
182
161
  end
@@ -5,10 +5,6 @@ class String
5
5
  end
6
6
  alias :dedent :undent
7
7
 
8
- def starts_with?(characters)
9
- !!self.match(/^#{characters}/)
10
- end
11
-
12
8
  def blank?
13
9
  self.to_s == ''
14
10
  end
@@ -0,0 +1,27 @@
1
+ class Thor
2
+ module Actions
3
+ # launch configured editor to retreive message/string
4
+ # see http://osdir.com/ml/ruby-talk/2010-06/msg01424.html
5
+ # see https://gist.github.com/rkumar/456809
6
+ # see http://rdoc.info/github/visionmedia/commander/master/Commander/UI.ask_editor
7
+ def ask_editor(initial_text = '')
8
+ Tempfile.open('reviewrequest.md') do |f|
9
+ f << initial_text
10
+ f.flush
11
+
12
+ editor = repo.config['core.editor'] || ENV['EDITOR'] || 'vi'
13
+ flags = case editor
14
+ when 'mate', 'emacs', 'subl'
15
+ '-w'
16
+ when 'mvim'
17
+ '-f'
18
+ else
19
+ ''
20
+ end
21
+ pid = fork { exec([editor, flags, f.path].join(' ')) }
22
+ Process.waitpid(pid)
23
+ File.read(f.path)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  module Thegarage
2
2
  module Gitx
3
- VERSION = '2.2.3.pre1'
3
+ VERSION = '2.2.3.pre2'
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require 'thegarage/gitx/version'
2
2
  require 'thegarage/gitx/string_extensions'
3
+ require 'thegarage/gitx/thor_extensions'
3
4
 
4
5
  module Thegarage
5
6
  module Gitx
@@ -21,7 +21,7 @@ describe Thegarage::Gitx::Cli::ReviewCommand do
21
21
  before do
22
22
  allow(cli).to receive(:repo).and_return(repo)
23
23
  allow(cli).to receive(:current_branch).and_return(branch)
24
- allow(cli).to receive(:input_from_editor).and_return('description')
24
+ allow(cli).to receive(:ask_editor).and_return('description')
25
25
  end
26
26
 
27
27
  describe '#review' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thegarage-gitx
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3.pre1
4
+ version: 2.2.3.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek
@@ -244,6 +244,7 @@ files:
244
244
  - lib/thegarage/gitx/cli/track_command.rb
245
245
  - lib/thegarage/gitx/cli/update_command.rb
246
246
  - lib/thegarage/gitx/string_extensions.rb
247
+ - lib/thegarage/gitx/thor_extensions.rb
247
248
  - lib/thegarage/gitx/version.rb
248
249
  - spec/fixtures/vcr_cassettes/pull_request_does_exist.yml
249
250
  - spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml