svnx 2.5.3 → 2.6.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: 463c73abc8399e2d2523e291ff0ef7811fa6e6aa
4
- data.tar.gz: 274b486f2a2ed07454f0e7558debe3091ffe6011
3
+ metadata.gz: 50079e8c0d3f86c8a009821814c9e9a78c45bdeb
4
+ data.tar.gz: c49d4ebfdad90bd3c802bee3a594568a403382e1
5
5
  SHA512:
6
- metadata.gz: f2328dd5361f057257b8a7a6180b081acb6d2ef38dbf894fdede9ea12139c42731a654fc1a060941ef2b4008e60bb258b8bb1cb1e989c7e9e587baec0e0a7fe2
7
- data.tar.gz: 04ee53c34807d2cad0c8656aced13d0bd1e6856e95c2c25839c121a9d87aa14bef369ec5ba2d0876ceaf6779517b45ed558144d3c1bfcb1cdd2e32555ff5f08b
6
+ metadata.gz: 50257c6d0088444a0f6e879dfb88b6b4fe532637e2f4f5d35a7b9a23953dd56688b1b640a35f118addb9286773ee418764d6d53ac33e8cbf74e8f9f85c9a277e
7
+ data.tar.gz: 7810f14c074ef37485d10a18073852d3b9350446b3cf37b7a21759319cd50a9fedad75d3ac18523d3e4f72fc5634812f8108b83d96fc620d1841f18f966ee1b5
data/README.md CHANGED
@@ -5,6 +5,8 @@ svnx(1) - Subversion extensions
5
5
 
6
6
  Svnx is a module that wraps the `svn` command line.
7
7
 
8
+ ## COMMANDS
9
+
8
10
  ## AUTHOR
9
11
 
10
12
  Jeff Pace
data/Rakefile CHANGED
@@ -6,6 +6,6 @@ task :default => :test
6
6
  Rake::TestTask.new(:test) do |t|
7
7
  t.libs << 'test'
8
8
  t.pattern = 'test/**/*_test.rb'
9
- t.warning = true
9
+ t.warning = false
10
10
  t.verbose = true
11
11
  end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/add/options'
5
+ require 'svnx/base/command'
6
+
7
+ module Svnx::Add
8
+ class Command < Svnx::Base::Command
9
+ noncaching
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/base/options'
5
+
6
+ module Svnx
7
+ module Add
8
+ end
9
+ end
10
+
11
+ module Svnx::Add
12
+ class Options < Svnx::Base::Options
13
+ has :paths
14
+ end
15
+ end
@@ -9,28 +9,42 @@ module Svnx
9
9
  end
10
10
 
11
11
  module Svnx::Base
12
- REVISION_FIELD = Proc.new { |x| [ "-r", x.revision ] }
13
- IGNORE_WHITESPACE = { ignorewhitespace: %w{ -x -bw -x --ignore-eol-style } }
14
-
15
- REVISION_PATHS_URLS_FIELDS = Hash.new.tap do |h|
16
- h[:revision] = REVISION_FIELD
17
- h[:paths] = nil
18
- h[:urls] = nil
19
- end
20
-
21
12
  class Options
22
13
  include Svnx::ObjectUtil
23
14
 
24
15
  class << self
25
- # Creates a reader method for each field
26
- def has_fields(*fields)
27
- what = Array(fields).flatten
28
- attr_reader(*what)
16
+ def mapping field
17
+ case field
18
+ when :revision
19
+ Proc.new { |x| [ "-r", x.revision ] }
20
+ when :ignorewhitespace, :ignore_whitespace
21
+ %w{ -x -bw -x --ignore-eol-style }
22
+ when :paths
23
+ nil
24
+ when :path
25
+ nil
26
+ when :urls
27
+ nil
28
+ when :url
29
+ nil
30
+ when :file
31
+ Proc.new { |x| [ "-F", x.file ] }
32
+ else
33
+ raise "invalid field '#{field}'"
34
+ end
35
+ end
36
+
37
+ def has(*fields)
38
+ fields.each do |field|
39
+ arg = mapping field
40
+ has_field field, arg
41
+ end
29
42
  end
30
43
  end
31
44
 
32
45
  def initialize args
33
46
  fkeys = fields.keys
47
+
34
48
  assign args, fkeys
35
49
  validate args, fkeys
36
50
  end
@@ -40,10 +54,6 @@ module Svnx::Base
40
54
  [ fld, get_args(fld) ]
41
55
  end
42
56
  end
43
-
44
- def fields
45
- raise "not implemented for #{self.class}"
46
- end
47
57
 
48
58
  def to_args
49
59
  options_to_args.collect do |opt|
@@ -10,12 +10,6 @@ end
10
10
 
11
11
  module Svnx::Blame
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Svnx::Base::REVISION_PATHS_URLS_FIELDS.merge(Svnx::Base::IGNORE_WHITESPACE)
14
-
15
- has_fields FIELDS.keys
16
-
17
- def fields
18
- FIELDS
19
- end
13
+ has :revision, :paths, :urls, :ignorewhitespace
20
14
  end
21
15
  end
@@ -10,16 +10,6 @@ end
10
10
 
11
11
  module Svnx::Cat
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:revision] = Svnx::Base::REVISION_FIELD
15
- h[:path] = nil
16
- h[:url] = nil
17
- end
18
-
19
- has_fields FIELDS.keys
20
-
21
- def fields
22
- FIELDS
23
- end
13
+ has :revision, :path, :url
24
14
  end
25
15
  end
@@ -10,15 +10,6 @@ end
10
10
 
11
11
  module Svnx::Commit
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:file] = Proc.new { |x| [ "-F", x.file ] }
15
- h[:paths] = nil
16
- end
17
-
18
- has_fields FIELDS.keys
19
-
20
- def fields
21
- FIELDS
22
- end
13
+ has :file, :paths
23
14
  end
24
15
  end
@@ -10,18 +10,10 @@ end
10
10
 
11
11
  module Svnx::Diff
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:commit] = Proc.new { |x| [ "-c", x.commit ] }
15
- h[:ignoreproperties] = "--ignore-properties"
16
- h[:depth] = Proc.new { |x| [ "--depth", x.depth ] }
17
- h[:paths] = nil
18
- h[:url] = nil
19
- end.merge(Svnx::Base::IGNORE_WHITESPACE)
20
-
21
- has_fields FIELDS.keys
13
+ has_fields commit: Proc.new { |x| [ "-c", x.commit ] },
14
+ ignoreproperties: "--ignore-properties",
15
+ depth: Proc.new { |x| [ "--depth", x.depth ] }
22
16
 
23
- def fields
24
- FIELDS
25
- end
17
+ has :ignorewhitespace, :paths, :url
26
18
  end
27
19
  end
@@ -10,16 +10,6 @@ end
10
10
 
11
11
  module Svnx::Info
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:revision] = Svnx::Base::REVISION_FIELD
15
- h[:path] = nil
16
- h[:url] = nil
17
- end
18
-
19
- has_fields FIELDS.keys
20
-
21
- def fields
22
- FIELDS
23
- end
13
+ has :revision, :path, :url
24
14
  end
25
15
  end
@@ -17,11 +17,7 @@ module Svnx::Log
17
17
  set_elmt_vars elmt, 'author', 'date', 'msg'
18
18
 
19
19
  @paths = elmt.xpath('paths/path').collect do |pe|
20
- kind = attribute_value pe, 'kind'
21
- action = attribute_value pe, 'action'
22
- name = pe.text
23
-
24
- EntryPath.new(kind: kind, action: Svnx::Action.new(action), name: name)
20
+ EntryPath.new attr: pe
25
21
  end.sort # sorted, because svn is not consistent with order
26
22
 
27
23
  @entries = elmt.xpath('logentry').collect do |le|
@@ -34,7 +30,7 @@ module Svnx::Log
34
30
  end
35
31
 
36
32
  def to_s
37
- [ @revision, @author, @date, @msg, @paths ].collect { |x| x.to_s }.join " "
33
+ [ @revision, @author, @date, @msg ].collect { |x| x.to_s }.join " "
38
34
  end
39
35
 
40
36
  def match action, filter
@@ -12,12 +12,23 @@ module Svnx::Log
12
12
  class EntryPath
13
13
  include Comparable
14
14
 
15
- attr_reader :kind, :action, :name
15
+ attr_reader :kind, :action, :name, :prop_mods, :text_mods
16
16
 
17
- def initialize args = Hash.new
18
- @kind = args[:kind]
19
- @action = args[:action]
20
- @name = args[:name]
17
+ def initialize attr: nil, kind: nil, action: nil, name: nil, prop_mods: nil, text_mods: nil
18
+ if attr
19
+ @kind = attribute_value attr, 'kind'
20
+ act = attribute_value attr, 'action'
21
+ @action = Svnx::Action.new act
22
+ @name = attr.text
23
+ @prop_mods = "true" == attribute_value(attr, 'prop-mods')
24
+ @text_mods = "true" == attribute_value(attr, 'text-mods')
25
+ else
26
+ @kind = kind
27
+ @action = action
28
+ @name = name
29
+ @prop_mods = prop_mods
30
+ @text_mods = text_mods
31
+ end
21
32
  end
22
33
 
23
34
  def to_s
@@ -31,5 +42,10 @@ module Svnx::Log
31
42
  def match? action, filter
32
43
  @action.to_s == action.to_s && @name.start_with?(filter)
33
44
  end
45
+
46
+ def attribute_value xmlelement, attrname, meth = nil
47
+ value = xmlelement[attrname.to_s]
48
+ meth ? value.send(meth) : value
49
+ end
34
50
  end
35
51
  end
@@ -10,18 +10,10 @@ end
10
10
 
11
11
  module Svnx::Log
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:limit] = Proc.new { |x| [ "--limit", x.limit ] }
15
- h[:verbose] = "-v"
16
- h[:revision] = Proc.new { |x| "-r" + x.revision.to_s }
17
- h[:url] = nil
18
- h[:path] = nil
19
- end
13
+ has_fields limit: Proc.new { |x| [ "--limit", x.limit ] },
14
+ verbose: "-v",
20
15
 
21
- has_fields FIELDS.keys
22
-
23
- def fields
24
- FIELDS
25
- end
16
+ revision: Proc.new { |x| "-r" + x.revision.to_s }
17
+ has :url, :path
26
18
  end
27
19
  end
@@ -10,18 +10,10 @@ end
10
10
 
11
11
  module Svnx::Merge
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:commit] = Proc.new { |x| [ "-c", x.commit ] }
15
- h[:range] = Proc.new { |x| [ "-r", x.range ] }
16
- h[:accept] = Proc.new { |x| [ "--accept", x.accept ] }
17
- h[:from] = nil
18
- h[:to] = nil
19
- end
20
-
21
- has_fields FIELDS.keys
22
-
23
- def fields
24
- FIELDS
25
- end
13
+ has_fields commit: Proc.new { |x| [ "-c", x.commit ] },
14
+ range: Proc.new { |x| [ "-r", x.range ] },
15
+ accept: Proc.new { |x| [ "--accept", x.accept ] },
16
+ from: nil,
17
+ to: nil
26
18
  end
27
19
  end
@@ -10,18 +10,8 @@ end
10
10
 
11
11
  module Svnx::Propget
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:revision] = Svnx::Base::REVISION_FIELD
15
- h[:revprop] = "--revprop"
16
- h[:name] = nil
17
- h[:url] = nil
18
- h[:path] = nil
19
- end
20
-
21
- has_fields FIELDS.keys
22
-
23
- def fields
24
- FIELDS
25
- end
13
+ has_fields revprop: "--revprop",
14
+ name: nil
15
+ has :revision, :url, :path
26
16
  end
27
17
  end
@@ -10,20 +10,10 @@ end
10
10
 
11
11
  module Svnx::Propset
12
12
  class Options < Svnx::Base::Options
13
-
14
- FIELDS = Hash.new.tap do |h|
15
- h[:name] = nil
16
- h[:revision] = Proc.new { |x| [ "--revprop", "-r", x.revision ] }
17
- h[:file] = Proc.new { |x| [ "--file", x.file ] }
18
- h[:value] = nil
19
- h[:url] = nil
20
- h[:path] = nil
21
- end
22
-
23
- has_fields FIELDS.keys
24
-
25
- def fields
26
- FIELDS
27
- end
13
+ has_fields name: nil,
14
+ revision: Proc.new { |x| [ "--revprop", "-r", x.revision ] }
15
+ has :file
16
+ has_fields value: nil
17
+ has :url, :path
28
18
  end
29
19
  end
@@ -10,16 +10,6 @@ end
10
10
 
11
11
  module Svnx::Status
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:revision] = Svnx::Base::REVISION_FIELD
15
- h[:paths] = nil
16
- h[:url] = nil
17
- end
18
-
19
- has_fields FIELDS.keys
20
-
21
- def fields
22
- FIELDS
23
- end
13
+ has :revision, :paths, :url
24
14
  end
25
15
  end
@@ -10,15 +10,6 @@ end
10
10
 
11
11
  module Svnx::Update
12
12
  class Options < Svnx::Base::Options
13
- FIELDS = Hash.new.tap do |h|
14
- h[:revision] = Svnx::Base::REVISION_FIELD
15
- h[:paths] = nil
16
- end
17
-
18
- has_fields FIELDS.keys
19
-
20
- def fields
21
- FIELDS
22
- end
13
+ has :revision, :paths
23
14
  end
24
15
  end
@@ -26,22 +26,32 @@ module Svnx
26
26
  end.join(" ")
27
27
  end
28
28
 
29
+ def fields
30
+ self.class.instance_variable_get '@fields'
31
+ end
32
+
29
33
  module ClassMethods
30
34
  def attr_readers(*symbols)
31
35
  what = Array(symbols).flatten
32
36
  attr_reader(*what)
33
37
  end
34
-
38
+
35
39
  # Creates a reader method for each field, and assigns and validates them from an initialize
36
40
  # method, which is also created.
37
- def xhas_fields(*fields)
38
- what = Array(fields).flatten
39
- attr_reader(*what)
41
+ def has_fields fields = Hash.new
42
+ @fields ||= Hash.new
43
+ @fields.merge! fields
44
+
45
+ fields.keys.each do |field|
46
+ attr_reader field
47
+ end
48
+ end
49
+
50
+ def has_field name, arg
51
+ @fields ||= Hash.new
52
+ @fields.merge! name => arg
40
53
 
41
- define_method :initialize do |args|
42
- assign args, what
43
- validate args, what
44
- end
54
+ attr_reader name
45
55
  end
46
56
  end
47
57
 
data/lib/svnx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Svnx
5
5
  NAME = 'svnx'
6
- VERSION = '2.5.3'
6
+ VERSION = '2.6.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.5.3
4
+ version: 2.6.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-06-27 00:00:00.000000000 Z
11
+ date: 2019-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: command-cacheable
@@ -139,6 +139,8 @@ files:
139
139
  - Manifest.txt
140
140
  - README.md
141
141
  - Rakefile
142
+ - lib/svnx/add/command.rb
143
+ - lib/svnx/add/options.rb
142
144
  - lib/svnx/base/action.rb
143
145
  - lib/svnx/base/cmdline.rb
144
146
  - lib/svnx/base/command.rb
@@ -219,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
221
  version: '0'
220
222
  requirements: []
221
223
  rubyforge_project:
222
- rubygems_version: 2.5.2.1
224
+ rubygems_version: 2.6.3
223
225
  signing_key:
224
226
  specification_version: 4
225
227
  summary: Ruby objects from the Subversion command line