departure 4.0.0 → 4.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: 6212b46cc9534ddacaefd8341432e124ccce6247
4
- data.tar.gz: 4f99581bf9f9657ff07adf9684dc93d40b9dfa8c
3
+ metadata.gz: 89a3f4d1cb84878f4a556da1439057a2dc8a402e
4
+ data.tar.gz: c6b8f26150c220f793ef021b7dc1d7ceb0a7ebe7
5
5
  SHA512:
6
- metadata.gz: 85c386d3d73919fe7e61d805835d5ddd8478fc8f204be09bd563151d67f1469424c7a89e40bdee579da483687f9602d071f80dd3bf9cdd547c78d2e80a91e325
7
- data.tar.gz: aeef6570099eee655fc5eb7cd4b9dda7c0f7f4c482d575b83700ad8cbdbe63a1a914e173de1dc68467aa2b84fd2d3ba61d7608ed8a6ea03d422451a798e297c7
6
+ metadata.gz: 66727be4d155815b20da61075f06ddf5e94665e165a3cc9f5ebada94f96e63ac8940efc555a812a127fa013533feb2f3bc0e9342aa5ca0ca699ff8044f000efb
7
+ data.tar.gz: 89ae513dd2268fddea60c3e11325fcdc309ae02283b74d07a719b77ecf8df968d041d7d92af8d6a35f36d8b341e826a2ce6c42ac9154dec5606cf0da18462daa
@@ -12,6 +12,18 @@ Please follow the format in [Keep a Changelog](http://keepachangelog.com/)
12
12
  ### Removed
13
13
  ### Fixed
14
14
 
15
+ ## [4.0.1] - 2017-08-01
16
+
17
+ ### Added
18
+
19
+ - Support for all pt-osc command-line options, including short forms and array
20
+ arguments
21
+
22
+ ### Changed
23
+ ### Deprecated
24
+ ### Removed
25
+ ### Fixed
26
+
15
27
  ## [4.0.0] - 2017-06-12
16
28
 
17
29
  ### Added
@@ -7,7 +7,7 @@ In order to give support to a new major Rails version, we'll branch off of
7
7
  master, name it following the Rails repo convention, such as `v4.2`, and
8
8
  we'll keep it open for bug fixes.
9
9
 
10
- 1. Update `lib/percona_migrator/version.rb` accordingly
10
+ 1. Update `lib/departure/version.rb` accordingly
11
11
  2. Review the `CHANGELOG.md` and add a new section following the format
12
12
  `[version] - YYYY-MM-DD`. We conform to the guidelines of
13
13
  http://keepachangelog.com/
@@ -3,15 +3,11 @@ module Departure
3
3
  attr_reader :name, :value
4
4
 
5
5
  # Builds an instance by parsing its name and value out of the given string.
6
- # Note the string must conform to "--<arg>=<value>" format.
7
6
  #
8
7
  # @param string [String]
9
8
  # @return [Option]
10
9
  def self.from_string(string)
11
- pair = string.split('=')
12
- name = pair[0][2..-1]
13
- value = pair[1]
14
-
10
+ name, value = string.split(/\s|=/, 2)
15
11
  new(name, value)
16
12
  end
17
13
 
@@ -20,7 +16,7 @@ module Departure
20
16
  # @param name [String]
21
17
  # @param optional value [String]
22
18
  def initialize(name, value = nil)
23
- @name = name
19
+ @name = normalize_option(name)
24
20
  @value = value
25
21
  end
26
22
 
@@ -40,21 +36,37 @@ module Departure
40
36
  name.hash
41
37
  end
42
38
 
43
- # Returns the option as string following the "--<name>=<value>" format
39
+ # Returns the option as string following the "--<name>=<value>" format or
40
+ # the short "-n=value" format
44
41
  #
45
42
  # @return [String]
46
43
  def to_s
47
- "--#{name}#{value_as_string}"
44
+ "#{name}#{value_as_string}"
48
45
  end
49
46
 
50
47
  private
51
48
 
49
+ # Returns the option name in "long" format, e.g., "--name"
50
+ #
51
+ # @return [String]
52
+ def normalize_option(name)
53
+ if name.start_with?('-')
54
+ name
55
+ elsif name.length == 1
56
+ "-#{name}"
57
+ else
58
+ "--#{name}"
59
+ end
60
+ end
61
+
52
62
  # Returns the value fragment of the option string if any value is specified
53
63
  #
54
64
  # @return [String]
55
65
  def value_as_string
56
66
  if value.nil?
57
67
  ''
68
+ elsif value.include?("=")
69
+ " #{value}"
58
70
  else
59
71
  "=#{value}"
60
72
  end
@@ -36,7 +36,7 @@ module Departure
36
36
  #
37
37
  # @return [Array<Option>]
38
38
  def build_options
39
- arguments.split(' ').map do |argument|
39
+ arguments.split(/\s(?=-)/).map do |argument|
40
40
  Option.from_string(argument)
41
41
  end
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module Departure
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '4.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: departure
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Zayats
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2017-06-12 00:00:00.000000000 Z
16
+ date: 2017-08-01 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  requirements: []
213
213
  rubyforge_project:
214
- rubygems_version: 2.6.10
214
+ rubygems_version: 2.4.5.2
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: pt-online-schema-change runner for ActiveRecord migrations