rscm 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/README +1 -1
- data/lib/rscm/command_line.rb +3 -1
- data/lib/rscm/difftool.rb +1 -1
- data/lib/rscm/scm/darcs.rb +3 -9
- data/lib/rscm/version.rb +1 -1
- data/test/rscm/command_line_test.rb +11 -8
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= RSCM Changelog
|
2
2
|
|
3
|
+
== 0.4.5
|
4
|
+
This is a minor bugfix release that corrects the tests for command_line.rb to work on win32
|
5
|
+
|
6
|
+
* made tests for command_line.rb pass on win32
|
7
|
+
|
3
8
|
== 0.4.4
|
4
9
|
This release introduces a new test suite that makes it a LOT easier to implement
|
5
10
|
new RSCM adapters. The main difference is that implementations no longer have to
|
data/README
CHANGED
data/lib/rscm/command_line.rb
CHANGED
@@ -2,6 +2,8 @@ require 'rscm/platform'
|
|
2
2
|
|
3
3
|
module RSCM
|
4
4
|
module CommandLine
|
5
|
+
QUOTE_REPLACEMENT = (Platform.family == "mswin32") ? "\"" : "\\\""
|
6
|
+
LESS_THAN_REPLACEMENT = (Platform.family == "mswin32") ? "<" : "\\<"
|
5
7
|
class OptionError < StandardError; end
|
6
8
|
class ExecutionError < StandardError
|
7
9
|
attr_reader :cmd, :dir, :exitstatus, :stderr
|
@@ -67,7 +69,7 @@ module RSCM
|
|
67
69
|
capture_info_command = (block_given? && options[:stdout])? "echo [output captured and therefore not logged] >> #{options[:stdout]} && " : ""
|
68
70
|
|
69
71
|
full_cmd = commands.collect do |c|
|
70
|
-
escaped_command = c.gsub(/"/,
|
72
|
+
escaped_command = c.gsub(/"/, QUOTE_REPLACEMENT).gsub(/</, LESS_THAN_REPLACEMENT)
|
71
73
|
stdout_prompt_command = options[:stdout] ? "echo #{RSCM::Platform.prompt} #{escaped_command} >> #{options[:stdout]} && " : ""
|
72
74
|
stderr_prompt_command = options[:stderr] ? "echo #{RSCM::Platform.prompt} #{escaped_command} >> #{options[:stderr]} && " : ""
|
73
75
|
redirected_command = block_given? ? "#{c} #{stderr_opt}" : "#{c} #{stdout_opt} #{stderr_opt}"
|
data/lib/rscm/difftool.rb
CHANGED
@@ -33,7 +33,7 @@ module RSCM
|
|
33
33
|
difftool = WINDOWS ? File.dirname(__FILE__) + "/../../bin/diff.exe" : "diff"
|
34
34
|
e = RSCM::PathConverter.filepath_to_nativepath(expected_file, false)
|
35
35
|
a = RSCM::PathConverter.filepath_to_nativepath(actual_file, false)
|
36
|
-
cmd = "#{difftool} --
|
36
|
+
cmd = "#{difftool} --ignore-space-change #{e} #{a}"
|
37
37
|
IO.popen(cmd) do |io|
|
38
38
|
yield io, cmd
|
39
39
|
end
|
data/lib/rscm/scm/darcs.rb
CHANGED
@@ -4,6 +4,7 @@ require 'rscm'
|
|
4
4
|
|
5
5
|
module RSCM
|
6
6
|
class Darcs < Base
|
7
|
+
# See http://progetti.arstecnica.it/tailor/browser/vcpx/darcs.py
|
7
8
|
attr_accessor :dir
|
8
9
|
|
9
10
|
def initialize(dir=".")
|
@@ -102,16 +103,9 @@ module RSCM
|
|
102
103
|
|
103
104
|
private
|
104
105
|
|
105
|
-
def darcs(darcs_cmd)
|
106
|
+
def darcs(darcs_cmd, options={}, &proc)
|
106
107
|
cmd = "darcs #{darcs_cmd}"
|
107
|
-
|
108
|
-
Better.popen(cmd, "r+") do |io|
|
109
|
-
if(block_given?)
|
110
|
-
return(yield(io))
|
111
|
-
else
|
112
|
-
io.read
|
113
|
-
end
|
114
|
-
end
|
108
|
+
execute(cmd, options, &proc)
|
115
109
|
end
|
116
110
|
end
|
117
111
|
end
|
data/lib/rscm/version.rb
CHANGED
@@ -5,8 +5,8 @@ require 'rscm/command_line'
|
|
5
5
|
module RSCM
|
6
6
|
|
7
7
|
class DifftoolTest < Test::Unit::TestCase
|
8
|
-
def
|
9
|
-
@dir = RSCM.new_temp_dir(
|
8
|
+
def setup_dir(prefix)
|
9
|
+
@dir = RSCM.new_temp_dir(prefix)
|
10
10
|
@stdout = "#{@dir}/stdout"
|
11
11
|
@stderr = "#{@dir}/stderr"
|
12
12
|
@prompt = "#{File.expand_path(@dir)} #{Platform.user}$"
|
@@ -15,23 +15,26 @@ module RSCM
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_should_write_to_both_when_both_streams_specified_and_no_block
|
18
|
+
setup_dir(method_name)
|
18
19
|
CommandLine.execute("echo \"<hello\" && echo world", {:dir => @dir, :stdout => @stdout, :stderr => @stderr})
|
19
|
-
|
20
|
-
|
20
|
+
assert_match(/.* echo \"<hello\"\s*\n.?\<hello.?\s*\n.* echo world\s*\nworld/n, File.open(@stdout).read)
|
21
|
+
assert_match(/.* echo \"<hello\"\s*\n.* echo world\s*/n, File.open(@stderr).read)
|
21
22
|
end
|
22
23
|
|
23
24
|
def test_should_not_write_to_stdout_when_no_stdout_specified
|
25
|
+
setup_dir(method_name)
|
24
26
|
CommandLine.execute("echo hello", {:dir => @dir, :stderr => @stderr})
|
25
27
|
assert(!File.exist?(@stdout))
|
26
|
-
assert_equal("#{@prompt} echo hello
|
28
|
+
assert_equal("#{@prompt} echo hello", File.open(@stderr).read.strip)
|
27
29
|
end
|
28
30
|
|
29
31
|
def test_should_only_write_command_to_stdout_when_block_specified
|
32
|
+
setup_dir(method_name)
|
30
33
|
CommandLine.execute("echo hello", {:dir => @dir, :stdout => @stdout, :stderr => @stderr}) do |io|
|
31
|
-
assert_equal("hello
|
34
|
+
assert_equal("hello", io.read.strip)
|
32
35
|
end
|
33
|
-
|
34
|
-
assert_equal("#{@prompt} echo hello
|
36
|
+
assert_match(/.* echo hello\s*\[output captured and therefore not logged\]/n, File.open(@stdout).read.strip)
|
37
|
+
assert_equal("#{@prompt} echo hello", File.open(@stderr).read.strip)
|
35
38
|
end
|
36
39
|
|
37
40
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rscm
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2006-03-
|
6
|
+
version: 0.4.5
|
7
|
+
date: 2006-03-06 00:00:00 -06:00
|
8
8
|
summary: RSCM - Ruby Source Control Management
|
9
9
|
require_paths:
|
10
10
|
- lib
|