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.
- data/lib/pickler/runner.rb +7 -3
- data/lib/pickler.rb +18 -15
- data/pickler.gemspec +1 -1
- metadata +1 -1
data/lib/pickler/runner.rb
CHANGED
@@ -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(
|
151
|
-
return @message.shift.strip, @message.join
|
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
|
160
|
+
File.join in_repo? ? gitdir : "/tmp", message_filename
|
162
161
|
end
|
163
|
-
|
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["
|
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(
|
181
|
+
def file_proc(type)
|
185
182
|
lambda do |file|
|
186
|
-
file << edit_format(
|
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
|
-
|
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