branch-name 2.0.0.pre.beta → 2.1.0

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
  SHA256:
3
- metadata.gz: 166d6b67749f23a48cca5435c6b4b923d57b9e8f4e716ff61c5765da932b686a
4
- data.tar.gz: e5c041c60834c56da210d0843e0bf099e62fa21adb120f46a1d58b07793f2cbb
3
+ metadata.gz: 56671e5fc00e4ad0045dad3658a70038a878d4352fb711c8aad559d5132516ff
4
+ data.tar.gz: 7317863bb70d45b73df3c64ff0e6a73251e6245a920b1e99f21fa7ffa9b31a95
5
5
  SHA512:
6
- metadata.gz: 48334163ec2756cdebfd45344ec91b34e602d0b78573e52aa61418ff8915b77107513e3745cf0cd10c353cb84f669993ff0835c37b964500405c67b9b46cc9ce
7
- data.tar.gz: f3ec35602f29a9edcd699383697fcb5aac3773122f9db42f82dc7748f646fa2c20bedf6fbaf0cb48d716b93a6d154ce2d5c1a5e34a657f0ea8d6c23265bff976
6
+ metadata.gz: 9078aa3f683ff648fcfe3a4d37ac4e0f39346d13f207a82c32e2c090c1549914626d225114985ff23190203daf101226af4aa4494e8ba340ef73f600f5b98ed3
7
+ data.tar.gz: cd69167ddb0f89e7e70e68d8c936ee9aa2c411445f31e46cd624cbc5ee7664247ecd0619d66d5e04fb50d3ef8a2f53e773411eecca96ab3a635b42e579be94e7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
- ## [Unreleased]
1
+ ## ['2.1.0'] - 2022-09-22
2
+ * Enhancements: Add support for Windows clipboard. Branch names created are copied to the clibboard for macOS and Windows now.
2
3
 
3
- ## [0.1.0] - 2022-09-15
4
-
5
- - Initial release
4
+ ## ['2.0.1-beta] - 2022-09-20
5
+ * Bug fixes: ticket description was not joined properly (without token separator).
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- branch-name (2.0.0.pre.beta)
4
+ branch-name (2.1.0)
5
5
  activesupport (~> 7.0, >= 7.0.4)
6
6
  colorize (~> 0.8.1)
7
+ os (~> 1.1, >= 1.1.4)
7
8
  thor (~> 1.2, >= 1.2.1)
8
9
 
9
10
  GEM
@@ -27,6 +28,7 @@ GEM
27
28
  kwalify (0.7.2)
28
29
  method_source (1.0.0)
29
30
  minitest (5.16.3)
31
+ os (1.1.4)
30
32
  parallel (1.22.1)
31
33
  parser (3.1.2.1)
32
34
  ast (~> 2.4.1)
data/README.md CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  ## Caveats
10
10
 
11
- NOTE: This documentation assumes *macos* and any reference to `<username>` should be assumed to equal `$ whoami` unless otherwise noted.
11
+ NOTE: This documentation assumes *macOS* and any reference to `<username>` should be assumed to equal `$ whoami` unless otherwise noted.
12
12
 
13
- NOTE: This documentation makes reference to *cards* and/or *tickets*; these terms should be considered synonymous, and are used to refer to *user stories*, *tasks*, *bugs*, etc.: work that is normally created against a software development team's [Jira](https://www.atlassian.com/software/jira) Project board while adhering to [Agile development methodology](https://www.atlassian.com/agile#:~:text=Agile%20is%20an%20iterative%20approach,small%2C%20but%20consumable%2C%20increments.). While `branch-name` was created to be used while practicing Agile, `branch-name` can be used outside the Agile context as well.
13
+ NOTE: This documentation makes reference to *cards* and/or *tickets*; these terms should be considered synonymous, and are used to refer to *user stories*, *tasks*, *bugs*, etc.; that is, work that is normally created against a software development team's [Jira](https://www.atlassian.com/software/jira) Project board while adhering to [Agile development methodology](https://www.atlassian.com/agile#:~:text=Agile%20is%20an%20iterative%20approach,small%2C%20but%20consumable%2C%20increments.). While `branch-name` was created to be used while practicing Agile, `branch-name` can be used outside the Agile context as well.
14
14
 
15
15
 
16
16
  ## Installation
@@ -19,7 +19,7 @@ NOTE: This documentation makes reference to *cards* and/or *tickets*; these term
19
19
 
20
20
  ## Usage/Examples
21
21
 
22
- ### `branch-name` help
22
+ ### `branch-name` Help
23
23
  ```shell
24
24
  # Display general branch-name help
25
25
  $ branch-name help
@@ -34,7 +34,7 @@ $ branch-name config help init
34
34
  $ branch-name config help delete
35
35
  ```
36
36
 
37
- ### Initialize `branch-name` configuration files
37
+ ### Initialize `branch-name` Configuration Files
38
38
  Setting up *global* settings would be a good place to start:
39
39
 
40
40
  ```
@@ -42,7 +42,7 @@ $ branch-name config init global
42
42
  #=> Configuration file (/Users/<username>/.branch-name) created
43
43
  ```
44
44
 
45
- This creates a `.branch-name` .yaml configuration file the home folder of the current user (`$ whoami` on *macos*) with the following option defaults. The option defaults created will be used with their respective `branch-name` command indicated by the `branch-name` command name under which each option resides. You may manually alter any of the option values to suite your needs. To determine what options are available for each `branch-name` command, simply view help for that particular command. If a `brnch-name` command is *not* found in the `.branch-name` confg file when it is first initialized (e.g. `$ branch-name config init global #=> /Users/<username>/.branch-name`), default options for that particular `branch-name` command is not currently supported.
45
+ This creates a `.branch-name` .yaml configuration file the home folder of the current user (`$ whoami` on *macOS*) with the following option defaults. The option defaults created will be used with their respective `branch-name` command indicated by the `branch-name` command name under which each option resides. You may manually alter any of the option values to suite your needs. To determine what options are available for each `branch-name` command, simply view help for that particular command. If a `brnch-name` command is *not* found in the `.branch-name` confg file when it is first initialized (e.g. `$ branch-name config init global #=> /Users/<username>/.branch-name`), default options for that particular `branch-name` command are not currently supported.
46
46
 
47
47
  For example, the following default options will be used whenever the `branch-name create` command is executed for the user "`<username>`":
48
48
 
@@ -59,7 +59,7 @@ create:
59
59
  - readme.txt
60
60
  ```
61
61
 
62
- NOTE: It is recommended that you change the default `create: project_location` to a more suitable location depending on your *os*. For example, on *macos* you might want to change this to `"/Users/<username>/Documents"`, `"/Users/<username>/Documents/features"`, or something similar.
62
+ NOTE: It is recommended that you change the default `create: project_location` to a more suitable location depending on your *os*. For example, on *macOS* you might want to change this to `"/Users/<username>/Documents"`, `"/Users/<username>/Documents/features"`, or something similar.
63
63
 
64
64
  Any or all of these options can be overwritten on the command-line:
65
65
 
@@ -86,7 +86,7 @@ create:
86
86
  - snippets.rb
87
87
  ```
88
88
 
89
- This example formulates feature a branch named *lg-12345-pay-down-tech-debt-on-user-model* by converting the ticket and ticket description to lowercase (`-d`) and delimiting the feature branch name tokens with a "-" character (`-s -`). The `-p` option instructs `branch-name create` to create the project folder */Users/<username>/feature-branches/2022/lg-12345-pay-down-tech-debt-on-user-model*. The aforementioned project folder will also contain the following files: readme.txt, scratch.rb and snippets.rb. In addition to this, `branch-name create` will also copy the feature brach name to the clipboard for you. This is convienient when you need to create a feature branch in github, or from the command-line.
89
+ This example formulates feature a branch named *lg-12345-pay-down-tech-debt-on-user-model* by converting the ticket and ticket description to lowercase (`-d`) and delimiting the feature branch name tokens with a "-" character (`-s -`). The `-p` option instructs `branch-name create` to create the project folder */Users/<username>/feature-branches/2022/lg-12345-pay-down-tech-debt-on-user-model*. The aforementioned project folder will also contain the following files: readme.txt, scratch.rb and snippets.rb. In addition to this, `branch-name create` will also copy the feature brach name to the clipboard for you (macOS and Windows currently supported). This is convenient when you need to create a feature branch in github, or from the command-line.
90
90
 
91
91
  ```shell
92
92
  $ branch-name create -p -d -s - "Pay down tech debt on User model" LG-12345
data/branch-name.gemspec CHANGED
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.add_dependency 'activesupport', '~> 7.0', '>= 7.0.4'
36
36
  spec.add_dependency 'colorize', '~> 0.8.1'
37
+ spec.add_dependency 'os', '~> 1.1', '>= 1.1.4'
37
38
  spec.add_dependency 'thor', '~> 1.2', '>= 1.2.1'
38
39
 
39
40
  # Remove this for now.
@@ -1,16 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'os'
4
+
3
5
  module Branch
4
6
  module Name
5
7
  module Clipable
6
8
  module_function
7
9
 
8
10
  def copy_to_clipboard(text)
9
- if /darwin/.match?(RUBY_PLATFORM)
10
- IO.popen('pbcopy', 'w') { |pipe| pipe.puts text }
11
+ if OS.mac?
12
+ copy_to_clipboard_macos text
13
+ true
14
+ elsif OS.windows?
15
+ copy_to_clipboard_windows text
11
16
  true
17
+ else
18
+ false
12
19
  end
13
20
  end
21
+
22
+ def copy_to_clipboard_macos(text)
23
+ copy_to_clipboard_with(app: 'pbcopy', text: text)
24
+
25
+ end
26
+
27
+ def copy_to_clipboard_windows(text)
28
+ copy_to_clipboard_with(app: 'clip', text: text)
29
+ end
30
+
31
+ def copy_to_clipboard_with(app:, text:)
32
+ IO.popen(app, 'w') { |pipe| pipe.puts text }
33
+ end
14
34
  end
15
35
  end
16
36
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/object/blank'
3
4
  require 'colorize'
4
5
  require 'pathname'
5
6
 
@@ -3,7 +3,7 @@
3
3
  module Branch
4
4
  module Name
5
5
  module Normalizable
6
- NON_WORD_CHARS_REGEX = /[^\w]/
6
+ NON_WORD_CHARS_REGEX = /[\W_]/
7
7
 
8
8
  def normalize_branch_name(ticket_description, ticket)
9
9
  normalized_ticket_description = normalize_ticket_description ticket_description
@@ -26,10 +26,10 @@ module Branch
26
26
  end
27
27
 
28
28
  def normalize_token(token)
29
+ token = token.gsub(NON_WORD_CHARS_REGEX, ' ')
29
30
  token = token.strip
30
31
  .squeeze(' ')
31
32
  .split.join(options[:separator])
32
- token = token.gsub(NON_WORD_CHARS_REGEX, '')
33
33
  token = token.squeeze(options[:separator])
34
34
  token = token.downcase if options[:downcase]
35
35
  token
@@ -3,6 +3,6 @@
3
3
  module Branch
4
4
  module Name
5
5
  # branch-name version
6
- VERSION = '2.0.0-beta'
6
+ VERSION = '2.1.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: branch-name
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.beta
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gene M. Angelo, Jr.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-20 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,6 +44,26 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.8.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: os
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.1'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.1.4
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '1.1'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 1.1.4
47
67
  - !ruby/object:Gem::Dependency
48
68
  name: thor
49
69
  requirement: !ruby/object:Gem::Requirement
@@ -119,9 +139,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
139
  version: 3.0.1
120
140
  required_rubygems_version: !ruby/object:Gem::Requirement
121
141
  requirements:
122
- - - ">"
142
+ - - ">="
123
143
  - !ruby/object:Gem::Version
124
- version: 1.3.1
144
+ version: '0'
125
145
  requirements: []
126
146
  rubygems_version: 3.3.22
127
147
  signing_key: