ptb 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/ptb/cli.rb +15 -7
  2. data/ptb.gemspec +1 -1
  3. metadata +4 -5
  4. data/ptb-0.0.1.gem +0 -0
data/lib/ptb/cli.rb CHANGED
@@ -30,23 +30,31 @@ module Ptb
30
30
 
31
31
  desc "message",
32
32
  "Generates a PivotalTracker commit message for the current branch"
33
- method_option :lines,
34
- :aliases => '-l',
35
- :type => :numeric,
36
- :default => 3,
37
- :desc => "Number of lines between header and footer"
38
33
  def message
39
34
  branch = `git symbolic-ref --short HEAD`.strip
40
35
  if branch =~ /^[0-9]+$/
41
36
  if story = project.stories.find(branch)
42
- lines = "\n" * options[:lines]
43
- say "[##{ branch }] #{ story.name }\n#{ lines }#{ story.url }"
37
+ puts <<-EOS
38
+ [##{branch}]
39
+
40
+ #{word_wrap(story.name, :line_width => 72)}
41
+ #{story.url}
42
+ EOS
44
43
  end
45
44
  end
46
45
  end
47
46
 
48
47
  private
49
48
 
49
+ def word_wrap(text, *args)
50
+ options = args.last.is_a?(Hash) ? args.pop : {}
51
+ options = { :line_width => 80 }.merge(options)
52
+
53
+ text.split("\n").collect do |line|
54
+ line.length > options[:line_width] ? line.gsub(/(.{1,#{options[:line_width]}})(\s+|$)/, "\\1\n").strip : line
55
+ end * "\n"
56
+ end
57
+
50
58
  def choose(prompt, choices, confirm=false)
51
59
  selection = nil
52
60
  say ""
data/ptb.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = "ptb"
4
- s.version = "0.0.2"
4
+ s.version = "0.0.3"
5
5
  s.authors = ["Anthony Crumley"]
6
6
  s.email = ["anthony.crumley@gmail.com"]
7
7
  s.homepage = "http://craftyco.de"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ptb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Crumley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-21 00:00:00 -05:00
18
+ date: 2013-03-27 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -62,7 +62,6 @@ files:
62
62
  - bin/ptb
63
63
  - lib/ptb.rb
64
64
  - lib/ptb/cli.rb
65
- - ptb-0.0.1.gem
66
65
  - ptb.gemspec
67
66
  has_rdoc: true
68
67
  homepage: http://craftyco.de
data/ptb-0.0.1.gem DELETED
Binary file