svnx 2.0.6 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.zshrc +2 -0
- data/Rakefile +2 -3
- data/lib/cmdline/arg.rb +12 -0
- data/lib/cmdline/cachefile.rb +37 -0
- data/lib/cmdline/caching.rb +25 -0
- data/lib/cmdline/filename.rb +16 -0
- data/lib/cmdline/gzpathname.rb +26 -0
- data/lib/cmdline/line.rb +57 -0
- data/lib/svnx/base/action.rb +31 -61
- data/lib/svnx/base/action_status.rb +37 -0
- data/lib/svnx/base/cmd.rb +20 -0
- data/lib/svnx/base/cmdline.rb +43 -37
- data/lib/svnx/base/command.rb +57 -50
- data/lib/svnx/base/command_factory.rb +24 -0
- data/lib/svnx/base/entries.rb +42 -40
- data/lib/svnx/base/entry.rb +46 -44
- data/lib/svnx/base/env.rb +14 -15
- data/lib/svnx/base/options.rb +22 -10
- data/lib/svnx/cat/command.rb +4 -2
- data/lib/svnx/cat/options.rb +11 -14
- data/lib/svnx/commit/command.rb +4 -2
- data/lib/svnx/commit/options.rb +11 -16
- data/lib/svnx/diff/command.rb +9 -7
- data/lib/svnx/diff/elements.rb +56 -54
- data/lib/svnx/diff/options.rb +14 -21
- data/lib/svnx/diff/parser.rb +73 -71
- data/lib/svnx/info/command.rb +4 -2
- data/lib/svnx/info/entries.rb +8 -6
- data/lib/svnx/info/entry.rb +23 -17
- data/lib/svnx/info/options.rb +11 -14
- data/lib/svnx/io/directory.rb +3 -1
- data/lib/svnx/io/element.rb +88 -86
- data/lib/svnx/log/command.rb +4 -2
- data/lib/svnx/log/entries.rb +14 -12
- data/lib/svnx/log/entry.rb +36 -58
- data/lib/svnx/log/entrypath.rb +35 -0
- data/lib/svnx/log/options.rb +14 -18
- data/lib/svnx/merge/command.rb +4 -2
- data/lib/svnx/merge/options.rb +17 -22
- data/lib/svnx/project.rb +27 -15
- data/lib/svnx/propget/command.rb +4 -2
- data/lib/svnx/propget/entries.rb +8 -6
- data/lib/svnx/propget/entry.rb +12 -10
- data/lib/svnx/propget/options.rb +13 -17
- data/lib/svnx/propset/command.rb +4 -2
- data/lib/svnx/propset/options.rb +14 -19
- data/lib/svnx/revision/argfactory.rb +6 -2
- data/lib/svnx/revision/argument.rb +22 -19
- data/lib/svnx/revision/date.rb +16 -16
- data/lib/svnx/revision/error.rb +4 -1
- data/lib/svnx/revision/range.rb +2 -1
- data/lib/svnx/status/command.rb +4 -2
- data/lib/svnx/status/entries.rb +13 -11
- data/lib/svnx/status/entry.rb +37 -39
- data/lib/svnx/status/options.rb +12 -15
- data/lib/svnx/update/command.rb +4 -2
- data/lib/svnx/update/options.rb +11 -12
- data/lib/svnx/util/classutil.rb +19 -0
- data/lib/svnx/util/dateutil.rb +1 -0
- data/lib/svnx/util/objutil.rb +36 -6
- data/lib/svnx/version.rb +1 -1
- data/repackage +1 -0
- data/svnx.gemspec +6 -5
- metadata +29 -6
- data/lib/system/command/arg.rb +0 -13
- data/lib/system/command/cachefile.rb +0 -58
- data/lib/system/command/caching.rb +0 -23
- data/lib/system/command/line.rb +0 -58
data/lib/system/command/arg.rb
DELETED
@@ -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
|
data/lib/system/command/line.rb
DELETED
@@ -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
|