svnx 0.6.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/svnx/base/args.rb +24 -0
- data/lib/svnx/base/command.rb +1 -14
- data/lib/svnx/log/args.rb +54 -0
- data/lib/svnx/log/command.rb +1 -39
- data/lib/svnx.rb +1 -1
- data/lib/system/command/line.rb +14 -18
- data/test/unit/system/command/line_test.rb +48 -19
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07670d8b843e714ca4bd3a0c8849eb19567191ee
|
4
|
+
data.tar.gz: 43c39c05b0ff27a68578e31f376494cbcfafd5db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afb1a70c67312ec8f952c0877521bdae844cb58bb8d105076dd4f2a4aa8148473668262bec0d596ab2192e738cf34ccfc345d243a5bee2f77802a2a63666f1f2
|
7
|
+
data.tar.gz: 822f61fe3bba8e331466502f60524cfe1ccd58454480a7409e7c2ff37523d5a1db20e17618f775410f4f33062b0809200f5196b95d65ae3e64ccf9db650b5de4
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'system/command/line'
|
5
|
+
require 'logue/loggable'
|
6
|
+
require 'system/command/caching'
|
7
|
+
|
8
|
+
# this replaces svnx/lib/command/svncommand.
|
9
|
+
|
10
|
+
module SVNx
|
11
|
+
class CommandArgs
|
12
|
+
include Logue::Loggable
|
13
|
+
|
14
|
+
attr_accessor :path
|
15
|
+
|
16
|
+
def initialize args = Hash.new
|
17
|
+
@path = args[:path]
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_a
|
21
|
+
[ @path ].compact
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/svnx/base/command.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'system/command/line'
|
5
5
|
require 'logue/loggable'
|
6
6
|
require 'system/command/caching'
|
7
|
+
require 'svnx/base/args'
|
7
8
|
|
8
9
|
# this replaces svnx/lib/command/svncommand.
|
9
10
|
|
@@ -41,20 +42,6 @@ module SVNx
|
|
41
42
|
include CmdLine
|
42
43
|
end
|
43
44
|
|
44
|
-
class CommandArgs
|
45
|
-
include Logue::Loggable
|
46
|
-
|
47
|
-
attr_accessor :path
|
48
|
-
|
49
|
-
def initialize args = Hash.new
|
50
|
-
@path = args[:path]
|
51
|
-
end
|
52
|
-
|
53
|
-
def to_a
|
54
|
-
[ @path ].compact
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
45
|
class Command
|
59
46
|
include Logue::Loggable
|
60
47
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'system/command/line'
|
5
|
+
require 'system/command/caching'
|
6
|
+
require 'svnx/base/command'
|
7
|
+
require 'logue/loggable'
|
8
|
+
require 'svnx/base/args'
|
9
|
+
|
10
|
+
module SVNx
|
11
|
+
module LogCmdLine
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module SVNx::LogCmdLine
|
16
|
+
class LogCommandArgs < SVNx::CommandArgs
|
17
|
+
include Logue::Loggable
|
18
|
+
|
19
|
+
attr_reader :limit
|
20
|
+
attr_reader :verbose
|
21
|
+
attr_reader :revision
|
22
|
+
attr_reader :use_cache
|
23
|
+
|
24
|
+
def initialize args
|
25
|
+
@limit = args[:limit]
|
26
|
+
@verbose = args[:verbose]
|
27
|
+
@use_cache = args.key?(:use_cache) ? args[:use_cache] : false
|
28
|
+
@revision = args[:revision]
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_a
|
33
|
+
ary = Array.new
|
34
|
+
if @limit
|
35
|
+
ary << '--limit' << @limit
|
36
|
+
end
|
37
|
+
if @verbose
|
38
|
+
ary << '-v'
|
39
|
+
end
|
40
|
+
|
41
|
+
if @revision
|
42
|
+
[ @revision ].flatten.each do |rev|
|
43
|
+
ary << "-r#{rev}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if @path
|
48
|
+
ary << @path
|
49
|
+
end
|
50
|
+
|
51
|
+
ary.compact
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/svnx/log/command.rb
CHANGED
@@ -5,6 +5,7 @@ require 'system/command/line'
|
|
5
5
|
require 'system/command/caching'
|
6
6
|
require 'svnx/base/command'
|
7
7
|
require 'logue/loggable'
|
8
|
+
require 'svnx/log/args'
|
8
9
|
|
9
10
|
module SVNx
|
10
11
|
module LogCmdLine
|
@@ -22,45 +23,6 @@ module SVNx
|
|
22
23
|
class LogCommandLineCaching < CachingCommandLine
|
23
24
|
include LogCmdLine
|
24
25
|
end
|
25
|
-
|
26
|
-
class LogCommandArgs < CommandArgs
|
27
|
-
include Logue::Loggable
|
28
|
-
|
29
|
-
attr_reader :limit
|
30
|
-
attr_reader :verbose
|
31
|
-
attr_reader :revision
|
32
|
-
attr_reader :use_cache
|
33
|
-
|
34
|
-
def initialize args
|
35
|
-
@limit = args[:limit]
|
36
|
-
@verbose = args[:verbose]
|
37
|
-
@use_cache = args.key?(:use_cache) ? args[:use_cache] : false
|
38
|
-
@revision = args[:revision]
|
39
|
-
super
|
40
|
-
end
|
41
|
-
|
42
|
-
def to_a
|
43
|
-
ary = Array.new
|
44
|
-
if @limit
|
45
|
-
ary << '--limit' << @limit
|
46
|
-
end
|
47
|
-
if @verbose
|
48
|
-
ary << '-v'
|
49
|
-
end
|
50
|
-
|
51
|
-
if @revision
|
52
|
-
[ @revision ].flatten.each do |rev|
|
53
|
-
ary << "-r#{rev}"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
if @path
|
58
|
-
ary << @path
|
59
|
-
end
|
60
|
-
|
61
|
-
ary.compact
|
62
|
-
end
|
63
|
-
end
|
64
26
|
|
65
27
|
class LogCommand < Command
|
66
28
|
def initialize args
|
data/lib/svnx.rb
CHANGED
data/lib/system/command/line.rb
CHANGED
@@ -4,43 +4,39 @@
|
|
4
4
|
require 'system/command/arg'
|
5
5
|
require 'logue/loggable'
|
6
6
|
require 'open3'
|
7
|
-
require 'rainbow'
|
7
|
+
require 'rainbow/ext/string'
|
8
8
|
|
9
9
|
module System
|
10
10
|
class CommandLine
|
11
11
|
include Logue::Loggable
|
12
12
|
|
13
|
+
attr_reader :args
|
13
14
|
attr_reader :output
|
15
|
+
attr_reader :error
|
16
|
+
attr_reader :status
|
14
17
|
|
15
18
|
def initialize args = Array.new
|
16
19
|
@args = args.dup
|
17
20
|
end
|
18
21
|
|
19
22
|
def << arg
|
20
|
-
# @args << Argument.new(arg)
|
21
23
|
@args << arg
|
22
24
|
end
|
23
25
|
|
24
26
|
def execute
|
25
27
|
cmd = to_command
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# not 1.8.x:
|
33
|
-
IO.popen(cmd + " 2>&1") do |io|
|
34
|
-
@output = io.readlines
|
35
|
-
end
|
36
|
-
|
37
|
-
if $? && $?.exitstatus != 0
|
38
|
-
info "cmd: #{cmd}".color(:red)
|
39
|
-
info "$?: #{$?.inspect}".color(:red)
|
40
|
-
info "$?.exitstatus: #{$? && $?.exitstatus}".color(:red)
|
41
|
-
raise "ERROR running command '#{cmd}': #{@output[-1]}"
|
28
|
+
debug "cmd: #{cmd}".color("8A8A43")
|
29
|
+
|
30
|
+
Open3.popen3(cmd) do |stdin, stdout, stderr, wthr|
|
31
|
+
@output = stdout.readlines
|
32
|
+
@error = stderr.readlines
|
33
|
+
@status = wthr.value
|
42
34
|
end
|
43
35
|
|
36
|
+
debug "@output: #{@output}"
|
37
|
+
debug "@error: #{@error}"
|
38
|
+
debug "@status: #{@status}"
|
39
|
+
|
44
40
|
@output
|
45
41
|
end
|
46
42
|
|
@@ -4,31 +4,60 @@
|
|
4
4
|
require 'tc'
|
5
5
|
require 'system/command/line'
|
6
6
|
|
7
|
+
Logue::Log.level = Logue::Log::DEBUG
|
8
|
+
|
7
9
|
module System
|
8
10
|
class CommandLineTestCase < SVNx::TestCase
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
# init
|
12
|
+
|
13
|
+
def assert_init expecetd, initargs
|
14
|
+
cl = System::CommandLine.new initargs
|
15
|
+
assert_equal expected, cl.args
|
16
|
+
|
17
|
+
def test_init
|
18
|
+
assert_init [ "ls" ], [ "ls" ]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# <<
|
23
|
+
|
24
|
+
def assert_lshift expected, initargs, add
|
25
|
+
info "self: #{self}"
|
26
|
+
cl = System::CommandLine.new initargs
|
27
|
+
cl << add
|
28
|
+
assert_equal expected, cl.args
|
12
29
|
end
|
13
30
|
|
14
31
|
def test_lshift
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
def
|
21
|
-
cl = System::CommandLine.new
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
assert_lshift [ "ls", "/tmp" ], [ "ls" ], "/tmp"
|
33
|
+
end
|
34
|
+
|
35
|
+
# to_command
|
36
|
+
|
37
|
+
def assert_to_command expect, args
|
38
|
+
cl = System::CommandLine.new args
|
39
|
+
assert_equal expect, cl.to_command
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_to_command_init
|
43
|
+
assert_to_command "ls", [ "ls" ]
|
44
|
+
end
|
45
|
+
|
46
|
+
# execute/status
|
47
|
+
|
48
|
+
def assert_execute_status expect_success, args
|
49
|
+
info "self: #{self}"
|
50
|
+
cl = System::CommandLine.new args
|
51
|
+
cl.execute
|
52
|
+
assert_equal expect_success, cl.status.success?, "args: #{args}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_execute_status_success
|
56
|
+
assert_execute_status true, [ "ls", "/tmp" ]
|
57
|
+
end
|
30
58
|
|
31
|
-
|
59
|
+
def test_execute_status_failure
|
60
|
+
assert_execute_status false, [ "ls", "/tmpx" ]
|
32
61
|
end
|
33
62
|
end
|
34
63
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svnx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Pace
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logue
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rainbow
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '2.1'
|
41
41
|
description: A bridge between Subversion functionality, via the command line, and
|
42
42
|
Ruby.
|
43
43
|
email: jeugenepace@gmail.com
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- lib/svnx.rb
|
49
49
|
- lib/svnx/base/action.rb
|
50
|
+
- lib/svnx/base/args.rb
|
50
51
|
- lib/svnx/base/command.rb
|
51
52
|
- lib/svnx/base/entries.rb
|
52
53
|
- lib/svnx/base/entry.rb
|
@@ -56,6 +57,7 @@ files:
|
|
56
57
|
- lib/svnx/info/entry.rb
|
57
58
|
- lib/svnx/io/directory.rb
|
58
59
|
- lib/svnx/io/element.rb
|
60
|
+
- lib/svnx/log/args.rb
|
59
61
|
- lib/svnx/log/command.rb
|
60
62
|
- lib/svnx/log/entries.rb
|
61
63
|
- lib/svnx/log/entry.rb
|
@@ -96,17 +98,17 @@ require_paths:
|
|
96
98
|
- lib
|
97
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
100
|
requirements:
|
99
|
-
- -
|
101
|
+
- - ">="
|
100
102
|
- !ruby/object:Gem::Version
|
101
103
|
version: '0'
|
102
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
105
|
requirements:
|
104
|
-
- -
|
106
|
+
- - ">="
|
105
107
|
- !ruby/object:Gem::Version
|
106
108
|
version: '0'
|
107
109
|
requirements: []
|
108
110
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.4.8
|
110
112
|
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: Wrapper around Subversion command line.
|