rscm 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +1 -1
- data/Rakefile +2 -2
- data/lib/rscm.rb +1 -0
- data/lib/rscm/difftool.rb +34 -0
- data/lib/rscm/tempdir.rb +2 -2
- data/test/rscm/difftool_test.rb +21 -0
- metadata +4 -3
- data/lib/rscm/difftool_test.rb +0 -46
data/CHANGES
CHANGED
data/README
CHANGED
data/Rakefile
CHANGED
@@ -10,11 +10,11 @@ require 'meta_project'
|
|
10
10
|
|
11
11
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
12
12
|
PKG_NAME = 'rscm'
|
13
|
-
PKG_VERSION = '0.3.
|
13
|
+
PKG_VERSION = '0.3.3' + PKG_BUILD
|
14
14
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
15
15
|
|
16
16
|
desc "Default Task"
|
17
|
-
task :default => [:gem]
|
17
|
+
task :default => [:test, :gem]
|
18
18
|
#task :gem => [:test]
|
19
19
|
task :test => [:starteam]
|
20
20
|
|
data/lib/rscm.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rscm/tempdir'
|
3
|
+
require 'rscm/path_converter'
|
4
|
+
require 'rscm/difftool'
|
5
|
+
|
6
|
+
module RSCM
|
7
|
+
module Difftool
|
8
|
+
# assertion method that reports differences as diff.
|
9
|
+
# useful when comparing big strings
|
10
|
+
def assert_equal_with_diff(expected, actual, temp_basedir=File.dirname(__FILE__) + "/../../target")
|
11
|
+
diff(expected, actual, temp_basedir) do |diff_io|
|
12
|
+
diff_string = diff_io.read
|
13
|
+
assert_equal("", diff_string, diff_string)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
module_function :assert_equal_with_diff
|
17
|
+
|
18
|
+
def diff(expected, actual, temp_basedir, &block)
|
19
|
+
dir = RSCM.new_temp_dir("diff", temp_basedir)
|
20
|
+
|
21
|
+
expected_file = "#{dir}/expected"
|
22
|
+
actual_file = "#{dir}/actual"
|
23
|
+
File.open(expected_file, "w") {|io| io.write(expected)}
|
24
|
+
File.open(actual_file, "w") {|io| io.write(actual)}
|
25
|
+
|
26
|
+
difftool = WINDOWS ? File.dirname(__FILE__) + "/../../bin/diff.exe" : "diff"
|
27
|
+
IO.popen("#{difftool} #{RSCM::PathConverter.filepath_to_nativepath(expected_file, false)} #{RSCM::PathConverter.filepath_to_nativepath(actual_file, false)}") do |io|
|
28
|
+
yield io
|
29
|
+
end
|
30
|
+
end
|
31
|
+
module_function :diff
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/rscm/tempdir.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
module RSCM
|
4
|
-
def new_temp_dir(suffix="")
|
4
|
+
def new_temp_dir(suffix="", basedir=File.dirname(__FILE__) + "/../../target")
|
5
5
|
identifier = identifier.to_s
|
6
6
|
identifier.gsub!(/\(|:|\)/, '_')
|
7
|
-
dir =
|
7
|
+
dir = "#{basedir}/temp_#{identifier}_#{Time.new.to_i}#{suffix}"
|
8
8
|
FileUtils.mkdir_p(dir)
|
9
9
|
dir
|
10
10
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rscm/tempdir'
|
3
|
+
require 'rscm/difftool'
|
4
|
+
require 'rscm/path_converter'
|
5
|
+
|
6
|
+
module RSCM
|
7
|
+
|
8
|
+
class DifftoolTest < Test::Unit::TestCase
|
9
|
+
include Difftool
|
10
|
+
|
11
|
+
def test_diffing_fails_with_diff_when_different
|
12
|
+
assert_raises(Test::Unit::AssertionFailedError) {
|
13
|
+
assert_equal_with_diff("This is a\nmessage with\nsome text", "This is a\nmessage without\nsome text")
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_diffing_passes_with_diff_when_equal
|
18
|
+
assert_equal_with_diff("This is a\nmessage with\nsome text", "This is a\nmessage with\nsome text")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
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.3.
|
7
|
-
date: 2005-09-
|
6
|
+
version: 0.3.3
|
7
|
+
date: 2005-09-07 00:00:00 -04:00
|
8
8
|
summary: "RSCM - Ruby Source Control Management"
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -38,7 +38,7 @@ files:
|
|
38
38
|
- lib/rscm/annotations.rb
|
39
39
|
- lib/rscm/base.rb
|
40
40
|
- lib/rscm/better.rb
|
41
|
-
- lib/rscm/
|
41
|
+
- lib/rscm/difftool.rb
|
42
42
|
- lib/rscm/line_editor.rb
|
43
43
|
- lib/rscm/logging.rb
|
44
44
|
- lib/rscm/mockit.rb
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- test/rscm/annotations_test.rb
|
69
69
|
- test/rscm/apply_label_scm_tests.rb
|
70
70
|
- test/rscm/base_test.rb
|
71
|
+
- test/rscm/difftool_test.rb
|
71
72
|
- test/rscm/file_after_edit
|
72
73
|
- test/rscm/file_ext.rb
|
73
74
|
- test/rscm/file_to_edit
|
data/lib/rscm/difftool_test.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'rscm/tempdir'
|
3
|
-
require 'rscm/path_converter'
|
4
|
-
|
5
|
-
module Test
|
6
|
-
module Unit
|
7
|
-
class TestCase
|
8
|
-
# assertion method that reports differences as diff.
|
9
|
-
# useful when comparing big strings
|
10
|
-
def assert_equal_with_diff(expected, actual)
|
11
|
-
diff(expected, actual) do |diff_io|
|
12
|
-
diff_string = diff_io.read
|
13
|
-
assert_equal("", diff_string, diff_string)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def diff(expected, actual, &block)
|
18
|
-
dir = RSCM.new_temp_dir("diff")
|
19
|
-
|
20
|
-
expected_file = "#{dir}/expected"
|
21
|
-
actual_file = "#{dir}/actual"
|
22
|
-
File.open(expected_file, "w") {|io| io.write(expected)}
|
23
|
-
File.open(actual_file, "w") {|io| io.write(actual)}
|
24
|
-
|
25
|
-
difftool = WINDOWS ? File.dirname(__FILE__) + "/../../bin/diff.exe" : "diff"
|
26
|
-
IO.popen("#{difftool} #{RSCM::PathConverter.filepath_to_nativepath(expected_file, false)} #{RSCM::PathConverter.filepath_to_nativepath(actual_file, false)}") do |io|
|
27
|
-
yield io
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
module RSCM
|
35
|
-
class DifftoolTest < Test::Unit::TestCase
|
36
|
-
def test_diffing_fails_with_diff_when_different
|
37
|
-
assert_raises(Test::Unit::AssertionFailedError) {
|
38
|
-
assert_equal_with_diff("This is a\nmessage with\nsome text", "This is a\nmessage without\nsome text")
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_diffing_passes_with_diff_when_equal
|
43
|
-
assert_equal_with_diff("This is a\nmessage with\nsome text", "This is a\nmessage with\nsome text")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|