git-story-workflow 0.0.0 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccc8eb83665b1e52179000c20ce0629c6a8ea0c4
4
- data.tar.gz: 3d8ea8dde58d188a43c01a7c42eb6982524d26c8
3
+ metadata.gz: 46807494af7a6be5225943b1039b703e780e17a5
4
+ data.tar.gz: 5127db01c16bbc1da8eaae977a1daa697a0ad8d7
5
5
  SHA512:
6
- metadata.gz: 1739520e8a7ef30273b32b3751371673660f23619c2e742fa148d6aecefdb6b0bb78b9068a3dfba655dc74603a8702486d084e25cb8193d612070f287aef6985
7
- data.tar.gz: a601252d87afa0a9fbffe74806e1578dd140e1442745fc66389461dc0787583a7cf5cb08d375d8ab79495fd56fbbbcd8220b9fac2c811febfafc738a667beb74
6
+ metadata.gz: f05b445a33d9259f375c3b092e256f27ef2ee16ec4c634beb580ef0163281536f32223517f7e85937856817e235edfb5fdc82f7fb4ff132052683545a3327510
7
+ data.tar.gz: 821da3ebd77d2426467121f112eca6e21a9f1d8488b587476c95179aa56891ac7bb35020d2285b68fa26bacbfbaf59058bc91fdff75487be868e9d1348fafa69
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: git-story-workflow 0.0.0 ruby lib
2
+ # stub: git-story-workflow 0.0.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "git-story-workflow".freeze
6
- s.version = "0.0.0"
6
+ s.version = "0.0.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -13,13 +13,13 @@ Gem::Specification.new do |s|
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["git-story".freeze]
15
15
  s.extra_rdoc_files = ["README.md".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze]
16
- s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/git-story".freeze, "config/story.yml".freeze, "git-story-workflow.gemspec".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/prepare-commit-msg".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze, "spec/git/story/feature_spec.rb".freeze, "spec/spec_helper.rb".freeze]
16
+ s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/git-story".freeze, "config/story.yml".freeze, "git-story-workflow.gemspec".freeze, "lib/git/story.rb".freeze, "lib/git/story/app.rb".freeze, "lib/git/story/prepare-commit-msg".freeze, "lib/git/story/setup.rb".freeze, "lib/git/story/utils.rb".freeze, "lib/git/story/version.rb".freeze, "spec/git/story/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
17
17
  s.homepage = "http://flori.github.com/git-story-workflow".freeze
18
18
  s.licenses = ["Apache-2.0".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "Git-story-workflow".freeze, "--main".freeze, "README.md".freeze]
20
20
  s.rubygems_version = "2.6.13".freeze
21
21
  s.summary = "Gem abstracting a git workflow".freeze
22
- s.test_files = ["spec/git/story/feature_spec.rb".freeze, "spec/spec_helper.rb".freeze]
22
+ s.test_files = ["spec/git/story/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
23
 
24
24
  if s.respond_to? :specification_version then
25
25
  s.specification_version = 4
data/lib/git/story/app.rb CHANGED
@@ -30,15 +30,23 @@ class Git::Story::App
30
30
  if command_of(@command)
31
31
  puts __send__(@command, *@argv)
32
32
  else
33
- fail "Unknown command #{@command.inspect}"
33
+ @command and @command = @command.inspect
34
+ @command ||= 'n/a'
35
+ STDERR.puts "Unknown command #{@command}\n\n#{help.join(?\n)}"
36
+ exit 1
34
37
  end
35
38
  rescue Errno::EPIPE
36
39
  end
37
40
 
38
41
  command doc: 'this help'
39
42
  def help
43
+ result = [ 'Available commands are:' ]
40
44
  longest = command_annotations.keys.map(&:size).max
41
- command_annotations.map { |name, a| "#{name.to_s.ljust(longest)} #{a[:doc]}" }
45
+ result.concat(
46
+ command_annotations.map { |name, a|
47
+ "#{name.to_s.ljust(longest)} #{a[:doc]}"
48
+ }
49
+ )
42
50
  end
43
51
 
44
52
  command doc: 'output the current story branch if it is checked out'
@@ -47,16 +55,22 @@ class Git::Story::App
47
55
  current_branch
48
56
  end
49
57
 
50
- def create_name(story_id = nil)
58
+ def provide_name(story_id = nil)
51
59
  until story_id.present?
52
60
  story_id = ask(prompt: 'Story id? ').strip
53
61
  end
54
62
  story_id = story_id.gsub(/[^0-9]+/, '')
55
- stories
56
63
  @story_id = Integer(story_id)
64
+ if stories.any? { |s| s.story_id == @story_id }
65
+ @reason = "story for ##@story_id already created"
66
+ return
67
+ end
57
68
  if name = fetch_story_name(@story_id)
58
69
  name = name.downcase.gsub(/[^a-z0-9-]+/, '-').gsub(/(\A-*|[\-0-9]*\z)/, '')
59
70
  [ 'story', name, @story_id ] * ?_
71
+ else
72
+ @reason = "name for ##@story_id could not be fetched from tracker"
73
+ return
60
74
  end
61
75
  end
62
76
 
@@ -113,8 +127,8 @@ class Git::Story::App
113
127
  command doc: '[STORYID] create a story for story STORYID'
114
128
  def create(story_id = nil)
115
129
  sh 'git fetch'
116
- name = create_name(story_id) or
117
- error "Could not create a story name for story id #{story_id}"
130
+ name = provide_name(story_id) or
131
+ error "Cannot provide a new story name for story ##{story_id}: #{@reason.inspect}"
118
132
  if old_story = stories.find { |s| s.story_id == @story_id }
119
133
  error "story ##{@story_id} already exists in #{old_story}".red
120
134
  end
@@ -1,6 +1,6 @@
1
1
  module Git::Story
2
2
  # Git::Story version
3
- VERSION = '0.0.0'
3
+ VERSION = '0.0.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Git::Story::Feature do
3
+ describe Git::Story::App do
4
4
  it 'foos'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-story-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -136,7 +136,7 @@ files:
136
136
  - lib/git/story/setup.rb
137
137
  - lib/git/story/utils.rb
138
138
  - lib/git/story/version.rb
139
- - spec/git/story/feature_spec.rb
139
+ - spec/git/story/app_spec.rb
140
140
  - spec/spec_helper.rb
141
141
  homepage: http://flori.github.com/git-story-workflow
142
142
  licenses:
@@ -167,5 +167,5 @@ signing_key:
167
167
  specification_version: 4
168
168
  summary: Gem abstracting a git workflow
169
169
  test_files:
170
- - spec/git/story/feature_spec.rb
170
+ - spec/git/story/app_spec.rb
171
171
  - spec/spec_helper.rb