git-issue 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 01f9b4c815c6600fdbbd0e03f1fcf733bd289614
4
+ data.tar.gz: 9f0a6a2d6269879e2a73e8ea96e0ad1f8fe8a574
5
+ SHA512:
6
+ metadata.gz: fbb286f444f6a1da27d4a0789d24e76735ca9a93393e4995c359653e5c3fbbe00e61eb9958edb57a16d8c106fd6e6252d9779deb8f0c370fea21b2b0fd06de18
7
+ data.tar.gz: 2423b5ae798686aef0dc336bf3ff0d705abd8b78bb5f169f3520fbf85b307081f65a81385ca0f7b529912e6970ec565031d2b7d8d835c750a33819249f69acf2
@@ -10,7 +10,7 @@ now available issue-tracker system is Redmine and Github-issues.
10
10
  <img src='https://github.com/yuroyoro/git-issue/raw/master/images/git-issue_screenshot-1.png' width='600'/>
11
11
  <img src='https://github.com/yuroyoro/git-issue/raw/master/images/git-issue_screenshot-2.png' width='600'/>
12
12
 
13
- ## Instration
13
+ ## Installation
14
14
 
15
15
  $ gem install git-issue
16
16
 
@@ -24,6 +24,7 @@ require 'term/ansicolor'
24
24
 
25
25
  Term::ANSIColor::coloring = STDOUT.isatty && RUBY_PLATFORM.downcase !~ /mswin(?!ce)|mingw|bccwin|cygwin/
26
26
 
27
+
27
28
  module GitIssue
28
29
  class Command
29
30
  attr_reader :name, :short_name, :description
@@ -121,7 +122,7 @@ module GitIssue
121
122
  File.open(message_file, 'w') { |msg|
122
123
  msg.puts message
123
124
  }
124
- begin
125
+ begin
125
126
  edit_cmd = Array(git_editor).dup
126
127
  edit_cmd << '-c' << 'set ft=gitcommit' if edit_cmd[0] =~ /^[mg]?vim$/
127
128
  edit_cmd << message_file
@@ -179,3 +180,7 @@ require File.dirname(__FILE__) + '/git_issue/base'
179
180
  require File.dirname(__FILE__) + '/git_issue/bitbucket'
180
181
  require File.dirname(__FILE__) + '/git_issue/github'
181
182
  require File.dirname(__FILE__) + '/git_issue/redmine'
183
+ require File.dirname(__FILE__) + '/git_issue/version'
184
+
185
+ # define version number as global constant for optparse
186
+ Version = GitIssue::VERSION
@@ -15,18 +15,36 @@ class GitIssue::Base
15
15
  @sysout = options[:sysout] || $stdout
16
16
  @syserr = options[:syserr] || $stderr
17
17
 
18
- split_ticket = lambda{|s| s.nil? || s.empty? ? nil : s.split(/,/).map{|v| v.strip.to_i} }
19
18
 
19
+ parse_command_and_tickets(args)
20
+ end
21
+
22
+ def parse_command_and_tickets(args)
20
23
  @tickets = []
24
+
25
+ # search "-" options from args
26
+ @options[:from_stdin] = args.find{|v| v == "-"}
27
+ args.delete_if{|v| v == "-"}
28
+
21
29
  cmd = args.shift
22
30
 
23
- if cmd =~ /(\d+,?\s?)+/
24
- @tickets = split_ticket.call(cmd)
25
- cmd = nil
26
- end
31
+ split_ticket = lambda{|s| s.nil? || s.empty? ? nil : s.split(/,/).map{|v| v.strip.to_i} }
32
+
33
+ if options[:from_stdin]
34
+ # read tickets from stdin
35
+ $stdin.each_line do |l|
36
+ @tickets += split_ticket.call(l)
37
+ end
38
+ else
39
+ # parse args
40
+ if cmd =~ /(\d+,?\s?)+/
41
+ @tickets = split_ticket.call(cmd)
42
+ cmd = nil
43
+ end
27
44
 
28
- @tickets += args.map{|s| split_ticket.call(s)}.flatten.uniq
29
- @tickets = [guess_ticket].compact if @tickets.empty?
45
+ @tickets += args.map{|s| split_ticket.call(s)}.flatten.uniq
46
+ @tickets = [guess_ticket].compact if @tickets.empty?
47
+ end
30
48
 
31
49
  cmd ||= (@tickets.nil? || @tickets.empty?) ? default_cmd : :show
32
50
  cmd = cmd.to_sym
@@ -198,7 +216,8 @@ class GitIssue::Base
198
216
  def mlength(s)
199
217
  width = 0
200
218
  cnt = 0
201
- s.split(//u).each{|c| cnt += 1 ;width += 1 if c.length > 1 }
219
+ bytesize_method = (RUBY_VERSION >= "1.9") ? :bytesize : :length
220
+ s.split(//u).each{|c| cnt += 1 ;width += 1 if c.send(bytesize_method) > 1 }
202
221
  cnt + width
203
222
  end
204
223
 
@@ -274,6 +293,8 @@ class GitIssue::Base
274
293
  def opt_parser
275
294
  OptionParser.new{|opts|
276
295
  opts.banner = 'git issue <command> [ticket_id] [<args>]'
296
+ # Register "-" only to be shown in help. Actualy this definition is not used
297
+ opts.on("-", /^$/, "read ticket-ids from stdin"){ @options[:from_stdin] = true }
277
298
  opts.on("--all", "-a", "update all paths in the index file "){ @options[:all] = true }
278
299
  opts.on("--force", "-f", "force create branch"){ @options[:force] = true }
279
300
  opts.on("--verbose", "-v", "show issue details"){|v| @options[:verbose] = true}
@@ -1,3 +1,3 @@
1
1
  module GitIssue
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-issue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
5
- prerelease:
4
+ version: 0.9.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tomohito Ozaki
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: pit
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: term-ansicolor
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description:
@@ -83,8 +74,8 @@ executables:
83
74
  extensions: []
84
75
  extra_rdoc_files: []
85
76
  files:
86
- - .document
87
- - .gitignore
77
+ - ".document"
78
+ - ".gitignore"
88
79
  - Gemfile
89
80
  - LICENSE
90
81
  - README.markdown
@@ -108,27 +99,26 @@ files:
108
99
  - spec/spec_helper.rb
109
100
  homepage: https://github.com/yuroyoro/git-issue
110
101
  licenses: []
102
+ metadata: {}
111
103
  post_install_message:
112
104
  rdoc_options: []
113
105
  require_paths:
114
106
  - lib
115
107
  required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
108
  requirements:
118
- - - ! '>='
109
+ - - ">="
119
110
  - !ruby/object:Gem::Version
120
111
  version: '0'
121
112
  required_rubygems_version: !ruby/object:Gem::Requirement
122
- none: false
123
113
  requirements:
124
- - - ! '>='
114
+ - - ">="
125
115
  - !ruby/object:Gem::Version
126
116
  version: '0'
127
117
  requirements: []
128
118
  rubyforge_project: git-issue
129
- rubygems_version: 1.8.23
119
+ rubygems_version: 2.2.0
130
120
  signing_key:
131
- specification_version: 3
121
+ specification_version: 4
132
122
  summary: git extention command for issue tracker system.
133
123
  test_files:
134
124
  - spec/git_issue/base_spec.rb