svnx 2.14.0 → 2.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/svnx/exec.rb +68 -0
  3. data/lib/svnx/version.rb +1 -1
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f98b4fa81ad8c5b9bf416f13852b1a67834da1b4
4
- data.tar.gz: dac79326ace98a5f5f09ce621eee54b0af77de02
3
+ metadata.gz: 429df9e9c32a5cbcb75d1885b5f32cdda9e3757c
4
+ data.tar.gz: 797728591cb731e7c5ed65d21e9958f55f546ef0
5
5
  SHA512:
6
- metadata.gz: d455288c34debd96c2cd7fa8d1c821978ff097b835e93211d0c3ecbc82c2cd507f542f752a0d9b38fc375a81601dbba02bda8df6ac29af839d64e7b0ad5ff390
7
- data.tar.gz: 5367fcd349b41599f9a8d7b5b02e8d2034fb865bc268a49df0d0a5aa6cc56c5b3776ad2594d18b33be29f1c8003dc11534b86124de431d2a0b437333a0d99ca8
6
+ metadata.gz: 75aabbe078642d0cd59425cece6a1616a48fafc367d8281837c401fb7ed9a1f2408aa4eceaedea21dae549e1c158bccff20a4a905f81b5ef17014dba0dbb4631
7
+ data.tar.gz: 32a0e303f112266c6a22a9456ae770126edc4607954aa152d3f26da4ee315e09f739c7b9ff9a127cd083b881b2bb545ba83f0582e391ee0d424af3fb4722698f
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ module Svnx
5
+ end
6
+
7
+ # A low-level wrapper around the Svnx commands, converting arguments (svnx/<command>/options) into
8
+ # entries (svnx/<command>/entry) or output. Enhances the low level functionality.
9
+
10
+ class Svnx::Exec
11
+ attr_reader :dir
12
+ attr_reader :url
13
+
14
+ def initialize dir: nil, url: nil, cmdlinecls: nil
15
+ @dir = dir
16
+ @url = url
17
+ @cmdlinecls = cmdlinecls
18
+ end
19
+
20
+ def where
21
+ @url || @dir
22
+ end
23
+
24
+ def url
25
+ @url ||= begin
26
+ entries = info
27
+ entries && entries[0].url
28
+ end
29
+ end
30
+
31
+ def path
32
+ info.path
33
+ end
34
+
35
+ def self.add_delegator cmd
36
+ require "svnx/#{cmd}/command"
37
+ require "svnx/#{cmd}/options"
38
+
39
+ modname = Kernel.const_get "Svnx::" + cmd.to_s.capitalize
40
+ initargs = { url: "@url", path: "@dir", paths: "[ @dir ]" }
41
+ optcls = modname::Options
42
+ opts = optcls.new Hash.new
43
+ fields = opts.fields.keys
44
+ params = fields.collect { |key| key.to_s + ": " + (initargs[key] || "nil") }.join ", "
45
+ cmdargs = fields.collect { |key| key.to_s + ": " + key.to_s }.join ", "
46
+
47
+ src = Array.new.tap do |a|
48
+ a << "def #{cmd} #{params}, cmdlinecls: @cmdlinecls"
49
+ a << " svncmd = #{modname}::Command.new({ #{cmdargs} }, cmdlinecls: cmdlinecls)"
50
+ a << " svncmd.respond_to?(:entries) ? svncmd.entries : svncmd.output"
51
+ a << "end"
52
+ end.join "\n"
53
+
54
+ class_eval src
55
+ end
56
+
57
+ add_delegator :commit
58
+ add_delegator :diff
59
+ add_delegator :info
60
+ add_delegator :log
61
+ add_delegator :propget
62
+ add_delegator :propset
63
+ add_delegator :update
64
+
65
+ def to_s
66
+ where.to_s
67
+ end
68
+ end
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Svnx
5
5
  NAME = 'svnx'
6
- VERSION = '2.14.0'
6
+ VERSION = '2.14.1'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svnx
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.0
4
+ version: 2.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Pace
@@ -165,6 +165,7 @@ files:
165
165
  - lib/svnx/diff/elements.rb
166
166
  - lib/svnx/diff/options.rb
167
167
  - lib/svnx/diff/parser.rb
168
+ - lib/svnx/exec.rb
168
169
  - lib/svnx/info/command.rb
169
170
  - lib/svnx/info/entries.rb
170
171
  - lib/svnx/info/entry.rb