svnx 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.zshrc +2 -0
  4. data/Rakefile +2 -3
  5. data/lib/cmdline/arg.rb +12 -0
  6. data/lib/cmdline/cachefile.rb +37 -0
  7. data/lib/cmdline/caching.rb +25 -0
  8. data/lib/cmdline/filename.rb +16 -0
  9. data/lib/cmdline/gzpathname.rb +26 -0
  10. data/lib/cmdline/line.rb +57 -0
  11. data/lib/svnx/base/action.rb +31 -61
  12. data/lib/svnx/base/action_status.rb +37 -0
  13. data/lib/svnx/base/cmd.rb +20 -0
  14. data/lib/svnx/base/cmdline.rb +43 -37
  15. data/lib/svnx/base/command.rb +57 -50
  16. data/lib/svnx/base/command_factory.rb +24 -0
  17. data/lib/svnx/base/entries.rb +42 -40
  18. data/lib/svnx/base/entry.rb +46 -44
  19. data/lib/svnx/base/env.rb +14 -15
  20. data/lib/svnx/base/options.rb +22 -10
  21. data/lib/svnx/cat/command.rb +4 -2
  22. data/lib/svnx/cat/options.rb +11 -14
  23. data/lib/svnx/commit/command.rb +4 -2
  24. data/lib/svnx/commit/options.rb +11 -16
  25. data/lib/svnx/diff/command.rb +9 -7
  26. data/lib/svnx/diff/elements.rb +56 -54
  27. data/lib/svnx/diff/options.rb +14 -21
  28. data/lib/svnx/diff/parser.rb +73 -71
  29. data/lib/svnx/info/command.rb +4 -2
  30. data/lib/svnx/info/entries.rb +8 -6
  31. data/lib/svnx/info/entry.rb +23 -17
  32. data/lib/svnx/info/options.rb +11 -14
  33. data/lib/svnx/io/directory.rb +3 -1
  34. data/lib/svnx/io/element.rb +88 -86
  35. data/lib/svnx/log/command.rb +4 -2
  36. data/lib/svnx/log/entries.rb +14 -12
  37. data/lib/svnx/log/entry.rb +36 -58
  38. data/lib/svnx/log/entrypath.rb +35 -0
  39. data/lib/svnx/log/options.rb +14 -18
  40. data/lib/svnx/merge/command.rb +4 -2
  41. data/lib/svnx/merge/options.rb +17 -22
  42. data/lib/svnx/project.rb +27 -15
  43. data/lib/svnx/propget/command.rb +4 -2
  44. data/lib/svnx/propget/entries.rb +8 -6
  45. data/lib/svnx/propget/entry.rb +12 -10
  46. data/lib/svnx/propget/options.rb +13 -17
  47. data/lib/svnx/propset/command.rb +4 -2
  48. data/lib/svnx/propset/options.rb +14 -19
  49. data/lib/svnx/revision/argfactory.rb +6 -2
  50. data/lib/svnx/revision/argument.rb +22 -19
  51. data/lib/svnx/revision/date.rb +16 -16
  52. data/lib/svnx/revision/error.rb +4 -1
  53. data/lib/svnx/revision/range.rb +2 -1
  54. data/lib/svnx/status/command.rb +4 -2
  55. data/lib/svnx/status/entries.rb +13 -11
  56. data/lib/svnx/status/entry.rb +37 -39
  57. data/lib/svnx/status/options.rb +12 -15
  58. data/lib/svnx/update/command.rb +4 -2
  59. data/lib/svnx/update/options.rb +11 -12
  60. data/lib/svnx/util/classutil.rb +19 -0
  61. data/lib/svnx/util/dateutil.rb +1 -0
  62. data/lib/svnx/util/objutil.rb +36 -6
  63. data/lib/svnx/version.rb +1 -1
  64. data/repackage +1 -0
  65. data/svnx.gemspec +6 -5
  66. metadata +29 -6
  67. data/lib/system/command/arg.rb +0 -13
  68. data/lib/system/command/cachefile.rb +0 -58
  69. data/lib/system/command/caching.rb +0 -23
  70. data/lib/system/command/line.rb +0 -58
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'pathname'
5
-
6
4
  module Svnx
7
5
  module Revision
8
6
  end
9
7
  end
10
8
 
11
- class Svnx::Revision::DateToDate
12
- attr_reader :from
13
- attr_reader :to
14
-
15
- def initialize from, to
16
- @from = from
17
- @to = to
18
- end
9
+ module Svnx::Revision
10
+ class DateToDate
11
+ attr_reader :from
12
+ attr_reader :to
13
+
14
+ def initialize from, to
15
+ @from = from
16
+ @to = to
17
+ end
19
18
 
20
- def to_svn_str
21
- [ @from, @to ].collect { |dt| "{" + to_svn_date(dt) + "}" }.join(":")
22
- end
23
-
24
- def to_svn_date date
25
- date.strftime "%Y-%m-%d"
19
+ def to_svn_str
20
+ [ @from, @to ].collect { |dt| "{" + to_svn_date(dt) + "}" }.join(":")
21
+ end
22
+
23
+ def to_svn_date date
24
+ date.strftime "%Y-%m-%d"
25
+ end
26
26
  end
27
27
  end
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- module Svnx; module Revision; end; end
4
+ module Svnx
5
+ module Revision
6
+ end
7
+ end
5
8
 
6
9
  module Svnx::Revision
7
10
  class RevisionError < RuntimeError
@@ -43,7 +43,8 @@ module Svnx::Revision
43
43
  end
44
44
 
45
45
  def head?
46
- @to && @to.value == 'HEAD'
46
+ # return true/false instead of true/false/nil
47
+ @to ? @to.value == 'HEAD' : false
47
48
  end
48
49
 
49
50
  def working_copy?
@@ -5,6 +5,8 @@ require 'svnx/base/command'
5
5
  require 'svnx/status/options'
6
6
  require 'svnx/status/entries'
7
7
 
8
- class Svnx::Status::Command < Svnx::Base::EntriesCommand
9
- noncaching
8
+ module Svnx::Status
9
+ class Command < Svnx::Base::EntriesCommand
10
+ noncaching
11
+ end
10
12
  end
@@ -4,18 +4,20 @@
4
4
  require 'svnx/status/entry'
5
5
  require 'svnx/base/entries'
6
6
 
7
- class Svnx::Status::Entries < Svnx::Base::Entries
8
- def initialize args = Hash.new
9
- @rootpath = args[:rootpath]
10
- super
11
- end
7
+ module Svnx::Status
8
+ class Entries < Svnx::Base::Entries
9
+ def initialize args = Hash.new
10
+ @rootpath = args[:rootpath]
11
+ super
12
+ end
12
13
 
13
- def get_elements doc
14
- # status/target
15
- doc.elements['status'].elements['target'].elements
16
- end
14
+ def get_elements doc
15
+ # status/target
16
+ doc.elements['status'].elements['target'].elements
17
+ end
17
18
 
18
- def create_entry xmlelement
19
- Svnx::Status::Entry.new xmlelement: xmlelement, rootpath: @rootpath
19
+ def create_entry xmlelement
20
+ Entry.new xmlelement: xmlelement, rootpath: @rootpath
21
+ end
20
22
  end
21
23
  end
@@ -9,49 +9,47 @@ module Svnx
9
9
  end
10
10
  end
11
11
 
12
- class Svnx::Status::Entry < Svnx::Base::Entry
13
- include Comparable, Logue::Loggable
14
-
15
- attr_reader :status
16
- attr_reader :path
17
- attr_reader :status_revision
18
- attr_reader :action
19
- attr_reader :commit_revision
20
- attr_reader :name
21
-
22
- def initialize xmlelement: nil, rootpath: nil
23
- @rootpath = rootpath
24
- super xmlelement: xmlelement
25
- # @status is an Svnx::Action
26
- @action = @status
27
- end
28
-
29
- def set_from_element elmt
30
- set_attr_var elmt, 'path'
31
-
32
- wcstatus = elmt.elements['wc-status']
33
- @status = Svnx::Action.new(wcstatus.attributes['item'])
34
- @status_revision = wcstatus.attributes['revision']
12
+ module Svnx::Status
13
+ class Entry < Svnx::Base::Entry
14
+ include Comparable
35
15
 
36
- commit = wcstatus.elements['commit']
37
- @commit_revision = commit && commit.attributes['revision']
38
- @name = @path.dup
39
-
40
- info "@name: #{@name}"
41
- info "@path: #{@path}"
42
- info "@rootpath: #{@rootpath}"
16
+ attr_reader :status
17
+ attr_reader :path
18
+ attr_reader :status_revision
19
+ attr_reader :action
20
+ attr_reader :commit_revision
21
+ attr_reader :name
22
+
23
+ def initialize xmlelement: nil, rootpath: nil
24
+ @rootpath = rootpath
25
+ super xmlelement: xmlelement
26
+ # @status is an Svnx::Action
27
+ @action = @status
28
+ end
43
29
 
44
- if @rootpath
45
- # name is prefixed with directory unless '.' is used as the argument
46
- @name.sub! Regexp.new('^' + @rootpath), ''
30
+ def set_from_element elmt
31
+ set_attr_var elmt, 'path'
32
+
33
+ wcstatus = elmt.elements['wc-status']
34
+ @status = Svnx::Action.new(wcstatus.attributes['item'])
35
+ @status_revision = wcstatus.attributes['revision']
36
+
37
+ commit = wcstatus.elements['commit']
38
+ @commit_revision = commit && commit.attributes['revision']
39
+ @name = @path.dup
40
+
41
+ if @rootpath
42
+ # name is prefixed with directory unless '.' is used as the argument
43
+ @name.sub! Regexp.new('^' + @rootpath), ''
44
+ end
47
45
  end
48
- end
49
46
 
50
- def to_s
51
- "path: #{@path}; status: #{@status}"
52
- end
47
+ def to_s
48
+ "path: #{@path}; status: #{@status}"
49
+ end
53
50
 
54
- def <=> other
55
- path <=> other.path
51
+ def <=> other
52
+ path <=> other.path
53
+ end
56
54
  end
57
55
  end
@@ -2,27 +2,24 @@
2
2
  # -*- ruby -*-
3
3
 
4
4
  require 'svnx/util/objutil'
5
- require 'svnx/base/options'
6
5
 
7
6
  module Svnx
8
7
  module Status
9
8
  end
10
9
  end
11
10
 
12
- class Svnx::Status::Options < Svnx::Base::Options
13
- attr_reader :revision
14
- attr_reader :url
15
- attr_reader :paths
16
-
17
- def initialize args
18
- assign args, :revision, :url, :paths
19
- end
20
-
21
- def options_to_args
22
- Array.new.tap do |optargs|
23
- optargs << [ :revision, [ "-r", @revision ] ]
24
- optargs << [ :url, @url ]
25
- optargs << [ :paths, @paths ]
11
+ module Svnx::Status
12
+ class Options < Svnx::Base::Options
13
+ FIELDS = [ :revision, :url, :paths ]
14
+
15
+ has_fields FIELDS
16
+
17
+ def options_to_args
18
+ Array.new.tap do |a|
19
+ a << [ :revision, [ "-r", revision ] ]
20
+ a << [ :url, url ]
21
+ a << [ :paths, paths ]
22
+ end
26
23
  end
27
24
  end
28
25
  end
@@ -4,6 +4,8 @@
4
4
  require 'svnx/base/command'
5
5
  require 'svnx/update/options'
6
6
 
7
- class Svnx::Update::Command < Svnx::Base::Command
8
- noncaching
7
+ module Svnx::Update
8
+ class Command < Svnx::Base::Command
9
+ noncaching
10
+ end
9
11
  end
@@ -8,18 +8,17 @@ module Svnx
8
8
  end
9
9
  end
10
10
 
11
- class Svnx::Update::Options < Svnx::Base::Options
12
- attr_reader :revision
13
- attr_reader :paths
14
-
15
- def initialize args = Hash.new
16
- assign args, :revision, :paths
17
- end
18
-
19
- def options_to_args
20
- Array.new.tap do |optargs|
21
- optargs << [ :revision, [ "-r", revision ] ]
22
- optargs << [ :paths, paths ]
11
+ module Svnx::Update
12
+ class Options < Svnx::Base::Options
13
+ FIELDS = [ :revision, :paths ]
14
+
15
+ has_fields FIELDS
16
+
17
+ def options_to_args
18
+ Array.new.tap do |a|
19
+ a << [ :revision, [ "-r", revision ] ]
20
+ a << [ :paths, paths ]
21
+ end
23
22
  end
24
23
  end
25
24
  end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ module ClassUtil
5
+ module Util
6
+ def module_elements cls
7
+ mods = cls.name.split "::"
8
+ mods[0 .. -2]
9
+ end
10
+
11
+ def find_module cls
12
+ mod = module_elements(cls) * "::"
13
+ Kernel.const_get mod
14
+ end
15
+
16
+ module_function :module_elements
17
+ module_function :find_module
18
+ end
19
+ end
@@ -14,6 +14,7 @@ class DateUtil
14
14
  end
15
15
  end
16
16
 
17
+ # returns the value in seconds, minutes, hours, or days, if within a week
17
18
  def to_time_units seconds
18
19
  secs = seconds.to_i
19
20
 
@@ -2,13 +2,43 @@
2
2
  # -*- ruby -*-
3
3
 
4
4
  module Svnx
5
- end
5
+ module ObjectUtil
6
+ # shortcut for "@var = args[:var]", for multiple variable names, which are symbols.
7
+ def assign args, symbols = Array.new
8
+ symbols.each do |symbol|
9
+ instance_variable_set "@" + symbol.to_s, args[symbol]
10
+ end
11
+ end
12
+
13
+ def validate args, valid = Array.new
14
+ invalid = args.keys.reject do |field|
15
+ valid.include? field
16
+ end
17
+
18
+ unless invalid.empty?
19
+ raise "invalid fields for #{self.class}: #{invalid.join(' ')}"
20
+ end
21
+ end
22
+
23
+ module ClassMethods
24
+ def attr_readers symbols = Array.new
25
+ attr_reader(*symbols)
26
+ end
27
+
28
+ def has_fields fields
29
+ attr_reader(*fields)
30
+
31
+ define_method :initialize do |args|
32
+ assign args, fields
33
+ validate args, fields
34
+ end
35
+ end
36
+ end
37
+
38
+ extend ClassMethods
6
39
 
7
- module Svnx::ObjectUtil
8
- # shortcut for "@var = args[:var]", for multiple variable names, which are symbols.
9
- def assign args, *symbols
10
- symbols.each do |symbol|
11
- instance_variable_set "@" + symbol.to_s, args[symbol]
40
+ def self.included other
41
+ other.extend ClassMethods
12
42
  end
13
43
  end
14
44
  end
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Svnx
5
5
  NAME = 'svnx'
6
- VERSION = '2.0.6'
6
+ VERSION = '2.1.0'
7
7
  end
@@ -0,0 +1 @@
1
+ rake && rm -rf pkg/svnx-2.0.8* && rake build && sudo gem uni svnx && sudo gem i ./pkg/svnx-2.0.8.gem
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2
+ lib = File.expand_path '../lib', __FILE__
3
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib
4
4
  require 'svnx/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
@@ -16,19 +16,20 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
19
+ if spec.respond_to? :metadata
20
20
  spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
21
  else
22
22
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
23
  end
24
24
 
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match %r{^(test|spec|features)/} }
26
26
  spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 1.12"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency "logue", "~> 1.0.6"
33
33
  spec.add_development_dependency "test-unit", "~> 3.1.5"
34
+ spec.add_development_dependency "paramesan"
34
35
  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.0.6
4
+ version: 2.1.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: 2017-06-08 00:00:00.000000000 Z
11
+ date: 2017-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.1.5
69
+ - !ruby/object:Gem::Dependency
70
+ name: paramesan
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Bridges the Subversion command line, returning Ruby objects.
70
84
  email:
71
85
  - jeugenepace@gmail.com
@@ -75,6 +89,7 @@ extra_rdoc_files: []
75
89
  files:
76
90
  - ".gitignore"
77
91
  - ".glarkrc"
92
+ - ".zshrc"
78
93
  - Features.txt
79
94
  - Gemfile
80
95
  - History.txt
@@ -82,9 +97,18 @@ files:
82
97
  - Manifest.txt
83
98
  - README.md
84
99
  - Rakefile
100
+ - lib/cmdline/arg.rb
101
+ - lib/cmdline/cachefile.rb
102
+ - lib/cmdline/caching.rb
103
+ - lib/cmdline/filename.rb
104
+ - lib/cmdline/gzpathname.rb
105
+ - lib/cmdline/line.rb
85
106
  - lib/svnx/base/action.rb
107
+ - lib/svnx/base/action_status.rb
108
+ - lib/svnx/base/cmd.rb
86
109
  - lib/svnx/base/cmdline.rb
87
110
  - lib/svnx/base/command.rb
111
+ - lib/svnx/base/command_factory.rb
88
112
  - lib/svnx/base/entries.rb
89
113
  - lib/svnx/base/entry.rb
90
114
  - lib/svnx/base/env.rb
@@ -106,6 +130,7 @@ files:
106
130
  - lib/svnx/log/command.rb
107
131
  - lib/svnx/log/entries.rb
108
132
  - lib/svnx/log/entry.rb
133
+ - lib/svnx/log/entrypath.rb
109
134
  - lib/svnx/log/options.rb
110
135
  - lib/svnx/merge/command.rb
111
136
  - lib/svnx/merge/options.rb
@@ -127,13 +152,11 @@ files:
127
152
  - lib/svnx/status/options.rb
128
153
  - lib/svnx/update/command.rb
129
154
  - lib/svnx/update/options.rb
155
+ - lib/svnx/util/classutil.rb
130
156
  - lib/svnx/util/dateutil.rb
131
157
  - lib/svnx/util/objutil.rb
132
158
  - lib/svnx/version.rb
133
- - lib/system/command/arg.rb
134
- - lib/system/command/cachefile.rb
135
- - lib/system/command/caching.rb
136
- - lib/system/command/line.rb
159
+ - repackage
137
160
  - svnx.gemspec
138
161
  homepage: https://github.com/jpace/svnx
139
162
  licenses: