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 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
@@ -1,4 +1,4 @@
1
- = RSCM - Ruby Source Control Management (0.4.4)
1
+ = RSCM - Ruby Source Control Management (0.4.5)
2
2
 
3
3
  RSCM is to SCM what DBI/JDBC/ODBC are to databases - an SCM-independent API for accessing different SCMs. The high level features are roughly:
4
4
 
@@ -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(/"/, "\\\"").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}"
@@ -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} --strip-trailing-cr #{e} #{a}"
36
+ cmd = "#{difftool} --ignore-space-change #{e} #{a}"
37
37
  IO.popen(cmd) do |io|
38
38
  yield io, cmd
39
39
  end
@@ -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
@@ -2,7 +2,7 @@ module RSCM
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
@@ -5,8 +5,8 @@ require 'rscm/command_line'
5
5
  module RSCM
6
6
 
7
7
  class DifftoolTest < Test::Unit::TestCase
8
- def setup
9
- @dir = RSCM.new_temp_dir("test_should_write_to_stdout")
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
- assert_equal("#{@prompt} echo \"<hello\"\n<hello\n#{@prompt} echo world\nworld\n", File.open(@stdout).read)
20
- assert_equal("#{@prompt} echo \"<hello\"\n#{@prompt} echo world\n", File.open(@stderr).read)
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\n", File.open(@stderr).read)
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\n", io.read)
34
+ assert_equal("hello", io.read.strip)
32
35
  end
33
- assert_equal("#{@prompt} echo hello\n[output captured and therefore not logged]\n", File.open(@stdout).read)
34
- assert_equal("#{@prompt} echo hello\n", File.open(@stderr).read)
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.4
7
- date: 2006-03-04 00:00:00 -06:00
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