git-commit-story 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/git-commit-story.gemspec +1 -1
- data/lib/git-commit-story.rb +7 -4
- data/spec/lib/git-commit-story_spec.rb +3 -3
- metadata +1 -1
data/git-commit-story.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = "git-commit-story"
|
3
3
|
s.executables << "git-commit-story"
|
4
4
|
s.executables << "git-cs"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.3"
|
6
6
|
s.date = "2013-04-30"
|
7
7
|
s.summary = "StreamSend git commit wrapper"
|
8
8
|
s.description = "Thin wrapper around git commit that adds a story id to commit messages"
|
data/lib/git-commit-story.rb
CHANGED
@@ -27,9 +27,12 @@ class GitCommitStory
|
|
27
27
|
if @options[:story_id]
|
28
28
|
@options[:story_id]
|
29
29
|
else
|
30
|
-
prompt =
|
31
|
-
|
32
|
-
|
30
|
+
prompt = if @options[:previous_story_id]
|
31
|
+
"Enter a story [#{@options[:previous_story_id]}]: "
|
32
|
+
else
|
33
|
+
"Enter a story: "
|
34
|
+
end
|
35
|
+
$stdout.print prompt
|
33
36
|
response = $stdin.gets.strip
|
34
37
|
if response == ""
|
35
38
|
if @options[:previous_story_id]
|
@@ -55,7 +58,7 @@ class GitCommitStory
|
|
55
58
|
end
|
56
59
|
|
57
60
|
def get_message_from_prompt
|
58
|
-
|
61
|
+
$stdout.print "Enter a commit message: "
|
59
62
|
message = $stdin.gets
|
60
63
|
if message.length == 0
|
61
64
|
puts "No message supplied"
|
@@ -23,7 +23,7 @@ describe GitCommitStory do
|
|
23
23
|
|
24
24
|
describe "without a story id" do
|
25
25
|
it "prompts for a story" do
|
26
|
-
$stdout.should_receive(:
|
26
|
+
$stdout.should_receive(:print).with("Enter a story: ")
|
27
27
|
$stdin.should_receive(:gets).and_return("story")
|
28
28
|
gcs = GitCommitStory.new({})
|
29
29
|
gcs.story_id
|
@@ -40,7 +40,7 @@ describe GitCommitStory do
|
|
40
40
|
it "includes a saved story id in the prompt" do
|
41
41
|
gcs = GitCommitStory.new({message: "new message"})
|
42
42
|
gcs.options[:previous_story_id] = "previous story"
|
43
|
-
$stdout.should_receive(:
|
43
|
+
$stdout.should_receive(:print).with("Enter a story [previous story]: ")
|
44
44
|
$stdin.should_receive(:gets).and_return("")
|
45
45
|
gcs.story_id
|
46
46
|
end
|
@@ -87,7 +87,7 @@ describe GitCommitStory do
|
|
87
87
|
|
88
88
|
describe "without a commit message" do
|
89
89
|
it "prompts for a commit message" do
|
90
|
-
$stdout.should_receive(:
|
90
|
+
$stdout.should_receive(:print).with("Enter a commit message: ")
|
91
91
|
$stdin.should_receive(:gets).and_return("new commit message\n")
|
92
92
|
gcs = GitCommitStory.new(story_id: "whatever")
|
93
93
|
gcs.final_commit_message.should == "new commit message\n\nstory: whatever"
|