socialcast-git-extensions 2.3.4 → 2.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@
5
5
  # git reviewrequest
6
6
 
7
7
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
8
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions', 'string_ext.rb')
8
9
  include Socialcast::Git
9
10
  include Socialcast::Github
10
11
 
@@ -24,17 +25,30 @@ if index = (ARGV.index('-d') || ARGV.index('--description'))
24
25
  else
25
26
  require 'tempfile'
26
27
  Tempfile.open('reviewrequest.md') do |f|
27
- f << "\n\n\n# Describe your pull request\n# Use GitHub flavored Markdown http://github.github.com/github-flavored-markdown/\n# Why not include a screenshot? Format is ![title](url)"
28
+ helper_tip = <<-EOS.dedent
29
+ # Describe your pull request
30
+ # Use GitHub flavored Markdown http://github.github.com/github-flavored-markdown/
31
+ # Why not include a screenshot? Format is ![title](url)
32
+ EOS
33
+ f << "\n\n#{helper_tip}"
28
34
  f.flush
29
35
 
30
36
  editor = ENV['EDITOR'] || 'vi'
31
- editor = "#{editor} -w" if %w{mate emacs}.include?(editor)
32
- pid = fork { exec "#{editor} #{f.path}" }
37
+ flags = case editor
38
+ when 'mate', 'emacs'
39
+ '-w'
40
+ when 'mvim'
41
+ '-f'
42
+ else
43
+ ''
44
+ end
45
+ pid = fork { exec "#{editor} #{flags} #{f.path}" }
33
46
  Process.waitpid(pid)
34
47
  description = File.read(f.path)
35
- description.gsub!(/^\#.*/, '')
48
+ description = description.gsub(/^\#.*/, '').chomp.strip
36
49
  end
37
50
  end
51
+
38
52
  short_description = description.split("\n").first(5).join("\n")
39
53
  stats = `git diff --stat master...#{branch}`
40
54
 
@@ -0,0 +1,7 @@
1
+ class String
2
+ def undent
3
+ a = $1 if match(/\A(\s+)(.*\n)(?:\1.*\n)*\z/)
4
+ gsub(/^#{a}/,'')
5
+ end
6
+ alias :dedent :undent
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "2.3.4"
3
+ VERSION = "2.3.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
- - 4
10
- version: 2.3.4
9
+ - 5
10
+ version: 2.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -181,6 +181,7 @@ files:
181
181
  - lib/socialcast-git-extensions.rb
182
182
  - lib/socialcast-git-extensions/git.rb
183
183
  - lib/socialcast-git-extensions/github.rb
184
+ - lib/socialcast-git-extensions/string_ext.rb
184
185
  - lib/socialcast-git-extensions/version.rb
185
186
  - socialcast-git-extensions.gemspec
186
187
  - test/helper.rb