nofxx-pickler 0.1.0 → 0.1.1

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.
@@ -131,7 +131,11 @@ class Pickler
131
131
  summary = "%6d " % story.id
132
132
  type = story.estimate || TYPE_SYMBOLS[story.story_type]
133
133
  summary << colorize("01;3#{TYPE_COLORS[story.story_type]}", type) << ' '
134
- summary << story.name
134
+ summary << story.name << ' '
135
+ if story.owned_by
136
+ initials = story.owned_by.split(" ").map { |o| o[0].chr }
137
+ summary << colorize("01;30", "(#{initials})")
138
+ end
135
139
  puts " " + summary
136
140
  end
137
141
 
@@ -472,7 +476,7 @@ Requires launchy (gem install launchy).
472
476
  summary "Create a new bug"
473
477
 
474
478
  process do |*paragraphs|
475
- title, paragraphs = gets_from_editor unless title = paragraphs.delete_at(0)
479
+ title, paragraphs = gets_from_editor("bug") unless title = paragraphs.delete_at(0)
476
480
  Pickler.run ["open", "bug", title, *paragraphs]
477
481
  end
478
482
  end
@@ -482,7 +486,7 @@ Requires launchy (gem install launchy).
482
486
  summary "Create a new chore"
483
487
 
484
488
  process do |*paragraphs|
485
- title, paragraphs = gets_from_editor unless title = paragraphs.delete_at(0)
489
+ title, paragraphs = gets_from_editor("chore") unless title = paragraphs.delete_at(0)
486
490
  Pickler.run ["open", "chore", title, *paragraphs]
487
491
  end
488
492
  end
data/lib/pickler.rb CHANGED
@@ -136,19 +136,18 @@ class Pickler
136
136
 
137
137
  #
138
138
  # Stolen from GHI - git://github.com/stephencelis/ghi.git
139
-
140
139
  module Editor
141
140
  def launch_editor(file)
142
141
  system "#{editor} #{file.path}"
143
142
  end
144
143
 
145
- def gets_from_editor
144
+ def gets_from_editor(type)
146
145
  if windows?
147
146
  warn "Windows fail => Please supply the message appended on the command"
148
147
  exit 1
149
148
  end
150
- File.open message_path, "a+", &file_proc("feature")
151
- return @message.shift.strip, @message.join.sub(/\b\n\b/, " ").strip
149
+ File.open message_path, "a+", &file_proc(type)
150
+ return @message.shift.strip, @message.join("\n")#.strip #gsub(/\n\n/, "\n")#.strip
152
151
  end
153
152
 
154
153
  def delete_message
@@ -158,32 +157,30 @@ class Pickler
158
157
  end
159
158
 
160
159
  def message_path
161
- File.join curr_dir, message_filename
160
+ File.join in_repo? ? gitdir : "/tmp", message_filename
162
161
  end
163
- def edit_format(issue)
162
+
163
+ def edit_format(type)
164
164
  l = []
165
165
  l << ""
166
- l << ""
166
+ l << "# Editing #{type}."
167
167
  l << "# The first line will be the 'title', subsequent ones 'description'."
168
168
  l << "# Lines beginning '#' will be ignored and empty messages discarded."
169
169
  end
170
+
170
171
  private
171
172
 
172
173
  def editor
173
- ENV["GHI_EDITOR"] || ENV["VISUAL"] || ENV["EDITOR"] || "vi"
174
- end
175
-
176
- def curr_dir
177
- @curr_dir ||= `git rev-parse --git-dir 2>/dev/null`.chomp
174
+ ENV["PICKLER_EDITOR"] || ENV["VISUAL"] || ENV["EDITOR"] || "vi"
178
175
  end
179
176
 
180
177
  def message_filename
181
178
  @message_filename ||= "PICKLER_#{Time.now.to_i}_MESSAGE"
182
179
  end
183
180
 
184
- def file_proc(issue)
181
+ def file_proc(type)
185
182
  lambda do |file|
186
- file << edit_format(issue).join("\n") if File.zero? file.path
183
+ file << edit_format(type).join("\n") if File.zero? file.path
187
184
  file.rewind
188
185
  launch_editor file
189
186
  @message = File.readlines(file.path).find_all { |l| !l.match(/^#/) }
@@ -194,7 +191,13 @@ class Pickler
194
191
  end
195
192
  end
196
193
 
197
- private
194
+ def gitdir
195
+ @gitdir ||= `git rev-parse --git-dir 2>/dev/null`.chomp
196
+ end
197
+
198
+ def in_repo?
199
+ !gitdir.empty?
200
+ end
198
201
 
199
202
  def puts(*args)
200
203
  rescue NoMethodError
data/pickler.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "pickler"
3
- s.version = "0.1.0"
3
+ s.version = "0.1.1"
4
4
 
5
5
  s.summary = "PIvotal traCKer Liaison to cucumbER"
6
6
  s.description = "Synchronize between Cucumber and Pivotal Tracker"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nofxx-pickler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope