story_branch 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d7d4d41d52f404121543545261d35ee4549bf4c
4
- data.tar.gz: 501c4cbf920c86d5d3e161e232670b2e3f813570
3
+ metadata.gz: be4f0873eb09acca67a272cfbedfc75c3317265b
4
+ data.tar.gz: 6d44e1bf700cc8e96805ea15330f15326b03aca1
5
5
  SHA512:
6
- metadata.gz: d41edd251bb11ec5adb61e0e852574f6d3bd27a7d475a00c91d025e8a6bed44f1c2d7356c169b0eb0c4eab864de1f270d3c410a357564f378b948b186e9526d7
7
- data.tar.gz: 3d3016b1ae2ea18df7b6c7c5cf1730d7bb011567fd55eec5866698e4dfff8456d45a508fd3095a6d46ea864c194dbcaa21da359d06279332b1298a0f02b455d0
6
+ metadata.gz: cc5ec660f36f5756de57ab6e8e1e3755fd1a2e0ad8cb1c14958988052f6f93e72d3e7cc0c5d89c272a2d27f6c716b34ceb4068266089c4170ed7a45c0a49835a
7
+ data.tar.gz: 81150e943304a054796cc6a0ee927b82d811c39f7687c5eabfc0682c9fa330dff04c8c9698eb75de8551d344750ff19bcc572b83d3dc33828d5e76f60a2a7994
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- story_branch (0.4.1)
4
+ story_branch (0.4.2)
5
5
  blanket_wrapper (~> 3.0)
6
6
  levenshtein-ffi (~> 1.0)
7
7
  pastel (~> 0.7.2)
@@ -20,7 +20,7 @@ GEM
20
20
  diff-lcs (1.3)
21
21
  equatable (0.5.0)
22
22
  fakefs (0.18.0)
23
- ffi (1.9.25)
23
+ ffi (1.10.0)
24
24
  git (1.5.0)
25
25
  httparty (0.16.3)
26
26
  mime-types (~> 3.0)
data/README.md CHANGED
@@ -43,9 +43,30 @@ Commands:
43
43
  Story branch has a command available that will help you creating the configurations
44
44
  for the projects, but essentially you'll be asked for the pivotal tracker project id and your api key.
45
45
 
46
+ ### Configuring the project id
47
+
46
48
  The project id you can get it easily from the url when viewing the project.
49
+ This value will be stored in the local configuration file that will be committed
50
+ to the working repository
51
+
52
+ ### Configuring the api key
47
53
 
48
54
  The api key you can get it from your account settings.
55
+ This value will be stored in your global configuration file that typically is
56
+ not shared with your co-workers in the repository. This way, each user will
57
+ be properly identified in the tracker
58
+
59
+ ### Configuring the finish tag
60
+
61
+ On your local config you can add a line with `finish_tag: <Some random word>`.
62
+ This tag will be used in the commit message when running `story_branch finish`.
63
+
64
+ E.g.
65
+ `finish_tag: Resolves`
66
+
67
+ `story_branch finish` will make a commit with the message
68
+ `[Resolves #12313] story title`
69
+
49
70
 
50
71
  ### .story_branch files
51
72
 
@@ -28,6 +28,9 @@ module StoryBranch
28
28
  private
29
29
 
30
30
  def create_local_config
31
+ return if local_config_has_value?
32
+
33
+ puts "Appending #{project_id}"
31
34
  @local_config.append(project_id, to: :project_id)
32
35
  @local_config.write(force: true)
33
36
  end
@@ -44,6 +47,15 @@ module StoryBranch
44
47
  @project_id = prompt.ask "Please provide this project's id:"
45
48
  @project_id
46
49
  end
50
+
51
+ def local_config_has_value?
52
+ config_value = @local_config.fetch(:project_id)
53
+ if config_value.is_a? Array
54
+ config_value.include?(project_id)
55
+ else
56
+ config_value == project_id
57
+ end
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -37,7 +37,7 @@ module StoryBranch
37
37
  matches = current_story
38
38
  return {} unless matches.length == 3
39
39
 
40
- title = matches[1].tr('-', ' ')
40
+ title = matches[1].tr('-', ' ').strip
41
41
  { title: title, id: matches[2].to_i }
42
42
  end
43
43
 
@@ -160,15 +160,14 @@ module StoryBranch
160
160
  return @project_id if @project_id
161
161
 
162
162
  project_ids = @local_config.fetch(:project_id)
163
+ @project_id = choose_project_id(project_ids)
164
+ end
165
+
166
+ def choose_project_id(project_ids)
167
+ return project_ids unless project_ids.is_a? Array
168
+ return project_ids[0] unless project_ids.length > 1
163
169
 
164
- @project_id = if project_ids.is_a? Array
165
- prompt.select(
166
- 'Which project you want to fetch from?',
167
- project_ids
168
- )
169
- else
170
- project_ids
171
- end
170
+ prompt.select('Which project you want to fetch from?', project_ids)
172
171
  end
173
172
 
174
173
  def api_key
@@ -49,7 +49,7 @@ module StoryBranch
49
49
  # TODO: add other possible args
50
50
  def stories(options = {}, estimated = true)
51
51
  stories = if options[:id]
52
- [@project.stories(options[:id])]
52
+ [@project.stories(options[:id]).get.payload]
53
53
  else
54
54
  params = { with_state: options[:with_state] }
55
55
  @project.stories.get(params: params).payload
@@ -3,8 +3,8 @@
3
3
  module StoryBranch
4
4
  # Utility class for string manipulation
5
5
  class StringUtils
6
- def self.sanitize(s)
7
- res = s.strip
6
+ def self.sanitize(text)
7
+ res = text.strip
8
8
  res.tr!("\n", '-')
9
9
  encoding_options = {
10
10
  invalid: :replace, # Replace invalid byte sequences
@@ -14,16 +14,16 @@ module StoryBranch
14
14
  res.encode(Encoding.find('ASCII'), encoding_options)
15
15
  end
16
16
 
17
- def self.dashed(s)
18
- sanitize(s).tr(" _,./:;+&'\"?", '-').squeeze('-')
17
+ def self.dashed(text)
18
+ sanitize(text).tr(" _,./:;+&'\"?<>", '-').squeeze('-').gsub(/-$|^-/, '')
19
19
  end
20
20
 
21
- def self.normalised_branch_name(s)
22
- dashed(s).downcase
21
+ def self.normalised_branch_name(text)
22
+ dashed(text).downcase
23
23
  end
24
24
 
25
- def self.undashed(s)
26
- s.tr('-', ' ').squeeze(' ').strip.capitalize
25
+ def self.undashed(text)
26
+ text.tr('-', ' ').squeeze(' ').strip.capitalize
27
27
  end
28
28
  end
29
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StoryBranch
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
data/story_branch.gemspec CHANGED
@@ -31,7 +31,13 @@ Gem::Specification.new do |spec|
31
31
  on the selected story
32
32
  DESCRIPTION
33
33
 
34
- spec.homepage = 'https://github.com/story-branch/story_branch'
34
+ spec.metadata = {
35
+ 'bug_tracker_uri' => 'https://github.com/story-branch/story_branch/issues',
36
+ 'changelog_uri' => 'https://github.com/story-branch/story_branch/blob/master/Changelog.md',
37
+ 'documentation_uri' => 'https://github.com/story-branch/story_branch/blob/master/README.md',
38
+ 'homepage_uri' => 'https://github.com/story-branch/story_branch',
39
+ 'source_code_uri' => 'https://github.com/story-branch/story_branch'
40
+ }
35
41
  spec.required_ruby_version = ['>= 2.3', '< 2.6']
36
42
 
37
43
  # Specify which files should be added to the gem when it is released.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: story_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rui Baltazar
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2018-11-23 00:00:00.000000000 Z
15
+ date: 2019-02-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: blanket_wrapper
@@ -274,10 +274,15 @@ files:
274
274
  - lib/story_branch/templates/unstart/.gitkeep
275
275
  - lib/story_branch/version.rb
276
276
  - story_branch.gemspec
277
- homepage: https://github.com/story-branch/story_branch
277
+ homepage:
278
278
  licenses:
279
279
  - MIT
280
- metadata: {}
280
+ metadata:
281
+ bug_tracker_uri: https://github.com/story-branch/story_branch/issues
282
+ changelog_uri: https://github.com/story-branch/story_branch/blob/master/Changelog.md
283
+ documentation_uri: https://github.com/story-branch/story_branch/blob/master/README.md
284
+ homepage_uri: https://github.com/story-branch/story_branch
285
+ source_code_uri: https://github.com/story-branch/story_branch
281
286
  post_install_message:
282
287
  rdoc_options: []
283
288
  require_paths: