svnx 2.11.0 → 2.12.0

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: 1122bd68ff487bab49f705895f6055e7515fd976
4
- data.tar.gz: fdaa77e7db8b9f74096297b900db7dbc4d17d323
3
+ metadata.gz: af7831460d0a7cf194803286b08e91c66352cd09
4
+ data.tar.gz: 524c096737fc930fa597a455efc04e02fa2fd661
5
5
  SHA512:
6
- metadata.gz: b023f779f02aacba414699568ac6056fc62cf06c7c26729723034e8e4c16c40709dd062c10cadd37a4121a9aa694485169292df4a3a3e7e617ef61818a12e4f3
7
- data.tar.gz: 6b81673dcaad702f88bbb826c2e609014dbe0599103e308a04d21d08192beb68e2b594574cc8ab2016ee6c4180bd006727393e2bc222048f33decfd846333b75
6
+ metadata.gz: 7033404d1c9507cd1ac59c3d110e0e42a064d36952ab5bc4cf24d2cdec225feea2f85d05ca4125bd75c04c0eaa83e43b69b4c2244b8dbb7c4edb7c74eb6118f0
7
+ data.tar.gz: 198c69b523aa7cc2b0ea465aac9dba564918edc95e32d68160c6450cec46d1ce6ac987af251f84f67a5906566266c82edcb3659880d59e8cc8136a043ebeafc5
@@ -32,8 +32,14 @@ module Svnx::Base
32
32
  end
33
33
 
34
34
  def fields
35
+ # instance variable on the class itself, not an instance of the class
35
36
  varname = '@fields'
36
- self.class.instance_variable_defined?(varname) && self.class.instance_variable_get(varname)
37
+ cls = self.class
38
+ if cls.instance_variable_defined? varname
39
+ cls.instance_variable_get varname
40
+ else
41
+ false
42
+ end
37
43
  end
38
44
 
39
45
  module ClassMethods
@@ -42,8 +48,6 @@ module Svnx::Base
42
48
  attr_reader(*what)
43
49
  end
44
50
 
45
- # Creates a reader method for each field, and assigns and validates them from an initialize
46
- # method, which is also created.
47
51
  def has_fields fields = Hash.new
48
52
  fields.each do |name, arg|
49
53
  has_field name, arg
@@ -11,7 +11,7 @@ module Svnx::Base
11
11
  case field
12
12
  when :revision
13
13
  to_args "-r", field
14
- when :ignorewhitespace, :ignore_whitespace
14
+ when :ignore_whitespace
15
15
  %w{ -x -bw -x --ignore-eol-style }
16
16
  when :paths
17
17
  nil
@@ -28,6 +28,7 @@ module Svnx::Base
28
28
  end
29
29
  end
30
30
 
31
+ # for common options/tags
31
32
  def has(*fields)
32
33
  fields.each do |field|
33
34
  arg = mapping field
@@ -35,42 +36,32 @@ module Svnx::Base
35
36
  end
36
37
  end
37
38
 
39
+ # gets the value for the tag/option by calling methname
38
40
  def to_args tagname, methname
39
41
  Proc.new { |obj| [ tagname, obj.send(methname) ] }
40
42
  end
41
43
 
42
- def to_tag sym, invoke = nil
43
- tag = "--" + Svnx::StringUtil.with_dashes(sym)
44
- if invoke
45
- Proc.new { |x| [ tag, x.send(sym) ] }
46
- else
47
- tag
48
- end
49
- end
50
-
51
- def has_tag_field name
52
- has_field name, to_tag(name)
53
- end
54
-
55
- def has_tag_fields(*names)
56
- names.each do |name|
57
- has_tag_field name
58
- end
44
+ # converts the symbol to a tag
45
+ def to_tag sym
46
+ "--" + Svnx::StringUtil.with_dashes(sym)
59
47
  end
60
48
 
61
- def has_tag_argument tagname, methname
62
- has_field methname, to_args(tagname, methname)
49
+ # tags with no argument
50
+ def has_tag_field(*names)
51
+ has_tags(false, *names)
63
52
  end
64
53
 
65
- def has_tag_arg name
66
- has_field name, to_args(to_tag(name), name)
54
+ # tags with an argument
55
+ def has_tag_argument(*names)
56
+ has_tags(true, *names)
67
57
  end
68
58
 
69
- def has_tag_arguments(*names)
59
+ # tags with an argument
60
+ def has_tags(argument, *names)
70
61
  names.each do |name|
71
62
  tag = to_tag name
72
- args = to_args tag, name
73
- has_field name, args
63
+ value = argument ? to_args(tag, name) : tag
64
+ has_field name, value
74
65
  end
75
66
  end
76
67
  end
@@ -10,6 +10,6 @@ end
10
10
 
11
11
  module Svnx::Blame
12
12
  class Options < Svnx::Base::Options
13
- has :revision, :paths, :urls, :ignorewhitespace
13
+ has :revision, :paths, :urls, :ignore_whitespace
14
14
  end
15
15
  end
@@ -11,6 +11,6 @@ end
11
11
  module Svnx::Commit
12
12
  class Options < Svnx::Base::Options
13
13
  has :file, :paths
14
- has_tag_arguments :with_revprop, :message, :username, :password
14
+ has_tag_argument :with_revprop, :message, :username, :password
15
15
  end
16
16
  end
@@ -10,10 +10,8 @@ end
10
10
 
11
11
  module Svnx::Diff
12
12
  class Options < Svnx::Base::Options
13
- has_fields commit: to_args("-c", :commit),
14
- ignoreproperties: "--ignore-properties",
15
- depth: to_args("--depth", :depth)
16
-
17
- has :ignorewhitespace, :paths, :url
13
+ has_tag_argument :change, :depth
14
+ has_tag_field :ignore_properties
15
+ has :ignore_whitespace, :paths, :url
18
16
  end
19
17
  end
@@ -11,8 +11,8 @@ end
11
11
 
12
12
  module Svnx::Log
13
13
  class Options < Svnx::Base::Options
14
- has_tag_arguments :limit, :depth
15
- has_tag_fields :verbose, :stop_on_copy, :use_merge_history
14
+ has_tag_argument :limit, :depth
15
+ has_tag_field :verbose, :stop_on_copy, :use_merge_history
16
16
  has :revision, :url, :path
17
17
  end
18
18
  end
@@ -12,6 +12,6 @@ module Svnx::Propget
12
12
  class Options < Svnx::Base::Options
13
13
  has_tag_field :revprop
14
14
  has :revision, :url, :path
15
- has_fields name: nil
15
+ has_field :name, nil
16
16
  end
17
17
  end
@@ -11,7 +11,7 @@ end
11
11
  module Svnx::Update
12
12
  class Options < Svnx::Base::Options
13
13
  has :revision, :paths
14
- has_tag_arguments :depth, :set_depth
14
+ has_tag_argument :depth, :set_depth
15
15
  has_tag_field :ignore_externals
16
16
  end
17
17
  end
data/lib/svnx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Svnx
5
5
  NAME = 'svnx'
6
- VERSION = '2.11.0'
6
+ VERSION = '2.12.0'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svnx
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Pace
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-01 00:00:00.000000000 Z
11
+ date: 2019-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: command-cacheable