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,13 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- module System
5
- end
6
-
7
- class System::Argument < String
8
- # just a string, but quotes itself
9
-
10
- def to_s
11
- '"' + super + '"'
12
- end
13
- end
@@ -1,58 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'system/command/line'
5
- require 'zlib'
6
- require 'logue/loggable'
7
-
8
- module System
9
- class GzipPathname < Pathname
10
- include Logue::Loggable
11
-
12
- def save_file content
13
- parent.mkpath unless parent.exist?
14
- unlink if exist?
15
- Zlib::GzipWriter.open(to_s) do |gz|
16
- gz.puts content
17
- end
18
- end
19
-
20
- def read_file
21
- Array.new.tap do |content|
22
- Zlib::GzipReader.open(to_s) do |gz|
23
- content.concat gz.readlines
24
- end
25
- end
26
- end
27
- end
28
-
29
- class CacheFile
30
- include Logue::Loggable
31
-
32
- attr_reader :output
33
- attr_reader :pathname
34
-
35
- def initialize cache_dir, args
36
- @args = args
37
- basename = args.join('-').gsub('/', '_slash_') + '.gz'
38
- fullname = Pathname(cache_dir) + basename
39
- @pathname = GzipPathname.new fullname
40
- @output = nil
41
- end
42
-
43
- def readlines
44
- if @pathname.exist?
45
- @output = @pathname.read_file
46
- else
47
- cl = CommandLine.new @args
48
- @output = cl.execute
49
- @pathname.save_file @output
50
- @output
51
- end
52
- end
53
-
54
- def to_s
55
- @pathname.to_s
56
- end
57
- end
58
- end
@@ -1,23 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'system/command/line'
5
- require 'system/command/cachefile'
6
-
7
- class System::CachingCommandLine < System::CommandLine
8
- # caches its input and values.
9
-
10
- def cache_dir
11
- @cache_dir ||= '/tmp' + Pathname.new($0).expand_path.to_s
12
- @cache_dir
13
- end
14
-
15
- def cache_file
16
- System::CacheFile.new cache_dir, @args
17
- end
18
-
19
- def execute
20
- cachefile = cache_file
21
- @output = cachefile.readlines
22
- end
23
- end
@@ -1,58 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'logue/loggable'
5
- require 'open3'
6
-
7
- module System
8
- end
9
-
10
- class System::CommandLine
11
- include Logue::Loggable
12
-
13
- attr_reader :args
14
- attr_reader :output
15
- attr_reader :error
16
- attr_reader :status
17
-
18
- def initialize args = Array.new
19
- @args = args.dup
20
- end
21
-
22
- def << arg
23
- @args << arg
24
- end
25
-
26
- def execute
27
- cmd = to_command
28
- $stderr.puts "cmd: #{cmd}"
29
-
30
- Open3.popen3(cmd) do |stdin, stdout, stderr, wthr|
31
- @output = stdout.readlines
32
- @error = stderr.readlines
33
- @status = wthr.value
34
- end
35
-
36
- if false && @output
37
- puts "output"
38
- @output.each_with_index do |line, idx|
39
- debug "output[#{idx}]: #{line}"
40
- end
41
- end
42
-
43
- if false && @error
44
- puts "error"
45
- @error.each_with_index do |line, idx|
46
- debug "error[#{idx}]: #{line}"
47
- end
48
- end
49
-
50
- debug "@status: #{@status}"
51
-
52
- @output
53
- end
54
-
55
- def to_command
56
- @args.join ' '
57
- end
58
- end