esr-rim 1.4.0 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG +33 -0
- data/Rakefile +56 -56
- data/lib/rim/command/sync.rb +89 -89
- data/lib/rim/command_helper.rb +144 -143
- data/lib/rim/dirty_check.rb +9 -2
- data/lib/rim/file_helper.rb +0 -2
- data/lib/rim/git.rb +9 -1
- data/lib/rim/info_helper.rb +5 -1
- data/lib/rim/info_module_helper.rb +5 -0
- data/lib/rim/manifest/helper.rb +82 -82
- data/lib/rim/manifest/json_reader.rb +41 -41
- data/lib/rim/manifest/manifest.json +7 -7
- data/lib/rim/module_helper.rb +57 -57
- data/lib/rim/module_info.rb +43 -43
- data/lib/rim/processor.rb +152 -152
- data/lib/rim/rim.rb +94 -94
- data/lib/rim/rim_info.rb +2 -0
- data/lib/rim/sync_helper.rb +150 -150
- data/lib/rim/sync_module_helper.rb +107 -107
- data/lib/rim/upload_helper.rb +69 -69
- data/lib/rim/upload_module_helper.rb +163 -162
- data/lib/rim/version.rb +1 -2
- data/test/command_helper_test.rb +83 -83
- data/test/file_helper_test.rb +132 -132
- data/test/manifest_helper_test.rb +29 -29
- data/test/manifest_test_dir/manifest.rim +9 -9
- data/test/processor_test.rb +32 -32
- data/test/sync_helper_test.rb +296 -296
- data/test/sync_module_helper_test.rb +126 -126
- data/test/upload_helper_test.rb +403 -403
- data/test/upload_module_helper_test.rb +92 -92
- metadata +10 -17
- data/test/dirty_check/dir1/file2 +0 -1
- data/test/dirty_check/file1 +0 -1
- data/test/dirty_check/ign_file1 +0 -1
- data/test/rim_info/mod1/dir1/file2 +0 -1
- data/test/rim_info/mod1/file1 +0 -1
- data/test/rim_info/unrelated_file +0 -1
data/lib/rim/version.rb
CHANGED
data/test/command_helper_test.rb
CHANGED
@@ -1,83 +1,83 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
$:.unshift File.join(File.dirname(__FILE__))
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'rim/command_helper'
|
6
|
-
require 'test_helper'
|
7
|
-
require 'fileutils'
|
8
|
-
require 'json'
|
9
|
-
|
10
|
-
class CommandHelperTest < Minitest::Test
|
11
|
-
include FileUtils
|
12
|
-
include TestHelper
|
13
|
-
|
14
|
-
class TestCommand < RIM::CommandHelper
|
15
|
-
|
16
|
-
attr_reader :module_infos
|
17
|
-
|
18
|
-
def initialize(*args)
|
19
|
-
super
|
20
|
-
@module_infos = []
|
21
|
-
end
|
22
|
-
|
23
|
-
def add_module_info(module_info)
|
24
|
-
@module_infos << module_info
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def setup
|
30
|
-
@test_dir = empty_test_dir("command_helper_test")
|
31
|
-
@ws_dir = File.join(@test_dir, "ws")
|
32
|
-
@logger = Logger.new($stdout)
|
33
|
-
@logger.level = Logger::ERROR unless ARGV.include? "debug"
|
34
|
-
RIM::GitSession.logger = @logger
|
35
|
-
end
|
36
|
-
|
37
|
-
def teardown
|
38
|
-
remove_test_dirs
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_create_module_info
|
42
|
-
cut = RIM::CommandHelper.new(@ws_dir, @logger)
|
43
|
-
mi = cut.create_module_info('ssh://gerrit/bsw/test', File.join(@ws_dir, 'sub/test'), 'master', ['CMakeLists.txt', 'OtherPattern*'], 'subdir')
|
44
|
-
assert(mi.remote_url == 'ssh://gerrit/bsw/test')
|
45
|
-
assert(mi.remote_branch_format == 'refs/for/%s')
|
46
|
-
assert(mi.local_path == 'sub/test')
|
47
|
-
assert(mi.target_revision == 'master')
|
48
|
-
assert(mi.ignores == ['CMakeLists.txt', 'OtherPattern*'])
|
49
|
-
assert(mi.subdir == 'subdir')
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_modules_from_manifest
|
53
|
-
manifest = {
|
54
|
-
'modules' => [
|
55
|
-
{ 'remote_path' => 'ssh://gerrit/bsw/test', 'local_path' => File.join(@ws_dir, 'sub/test'), 'target_revision' => 'master', 'ignores' => ['CMakeLists.txt', 'OtherPattern*'], 'subdir' => 'test/subdir'},
|
56
|
-
{ 'remote_path' => '../file/test', 'local_path' => File.join(@ws_dir, 'sub/file_test'), 'target_revision' => 'branch' }
|
57
|
-
]
|
58
|
-
}
|
59
|
-
|
60
|
-
manifest_file = File.join(@test_dir, 'manifest.json')
|
61
|
-
File.open(manifest_file, 'w') do |file|
|
62
|
-
file << manifest.to_json
|
63
|
-
end
|
64
|
-
cut = TestCommand.new(@ws_dir, @logger)
|
65
|
-
cut.modules_from_manifest(manifest_file)
|
66
|
-
assert(cut.module_infos.size == 2)
|
67
|
-
mi = cut.module_infos[0]
|
68
|
-
assert(mi.remote_url == 'ssh://gerrit/bsw/test')
|
69
|
-
assert(mi.remote_branch_format == 'refs/for/%s')
|
70
|
-
assert(mi.local_path == 'sub/test')
|
71
|
-
assert(mi.target_revision == 'master')
|
72
|
-
assert(mi.ignores == ['CMakeLists.txt', 'OtherPattern*'])
|
73
|
-
assert(mi.subdir == 'test/subdir')
|
74
|
-
mi = cut.module_infos[1]
|
75
|
-
assert(mi.remote_url == '../file/test')
|
76
|
-
assert(mi.remote_branch_format == 'refs/for/%s')
|
77
|
-
assert(mi.local_path == 'sub/file_test')
|
78
|
-
assert(mi.target_revision == 'branch')
|
79
|
-
assert(mi.ignores == [])
|
80
|
-
assert(mi.subdir.nil?)
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'rim/command_helper'
|
6
|
+
require 'test_helper'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
class CommandHelperTest < Minitest::Test
|
11
|
+
include FileUtils
|
12
|
+
include TestHelper
|
13
|
+
|
14
|
+
class TestCommand < RIM::CommandHelper
|
15
|
+
|
16
|
+
attr_reader :module_infos
|
17
|
+
|
18
|
+
def initialize(*args)
|
19
|
+
super
|
20
|
+
@module_infos = []
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_module_info(module_info)
|
24
|
+
@module_infos << module_info
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup
|
30
|
+
@test_dir = empty_test_dir("command_helper_test")
|
31
|
+
@ws_dir = File.join(@test_dir, "ws")
|
32
|
+
@logger = Logger.new($stdout)
|
33
|
+
@logger.level = Logger::ERROR unless ARGV.include? "debug"
|
34
|
+
RIM::GitSession.logger = @logger
|
35
|
+
end
|
36
|
+
|
37
|
+
def teardown
|
38
|
+
remove_test_dirs
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_create_module_info
|
42
|
+
cut = RIM::CommandHelper.new(@ws_dir, @logger)
|
43
|
+
mi = cut.create_module_info('ssh://gerrit/bsw/test', File.join(@ws_dir, 'sub/test'), 'master', ['CMakeLists.txt', 'OtherPattern*'], 'subdir')
|
44
|
+
assert(mi.remote_url == 'ssh://gerrit/bsw/test')
|
45
|
+
assert(mi.remote_branch_format == 'refs/for/%s')
|
46
|
+
assert(mi.local_path == 'sub/test')
|
47
|
+
assert(mi.target_revision == 'master')
|
48
|
+
assert(mi.ignores == ['CMakeLists.txt', 'OtherPattern*'])
|
49
|
+
assert(mi.subdir == 'subdir')
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_modules_from_manifest
|
53
|
+
manifest = {
|
54
|
+
'modules' => [
|
55
|
+
{ 'remote_path' => 'ssh://gerrit/bsw/test', 'local_path' => File.join(@ws_dir, 'sub/test'), 'target_revision' => 'master', 'ignores' => ['CMakeLists.txt', 'OtherPattern*'], 'subdir' => 'test/subdir'},
|
56
|
+
{ 'remote_path' => '../file/test', 'local_path' => File.join(@ws_dir, 'sub/file_test'), 'target_revision' => 'branch' }
|
57
|
+
]
|
58
|
+
}
|
59
|
+
|
60
|
+
manifest_file = File.join(@test_dir, 'manifest.json')
|
61
|
+
File.open(manifest_file, 'w') do |file|
|
62
|
+
file << manifest.to_json
|
63
|
+
end
|
64
|
+
cut = TestCommand.new(@ws_dir, @logger)
|
65
|
+
cut.modules_from_manifest(manifest_file)
|
66
|
+
assert(cut.module_infos.size == 2)
|
67
|
+
mi = cut.module_infos[0]
|
68
|
+
assert(mi.remote_url == 'ssh://gerrit/bsw/test')
|
69
|
+
assert(mi.remote_branch_format == 'refs/for/%s')
|
70
|
+
assert(mi.local_path == 'sub/test')
|
71
|
+
assert(mi.target_revision == 'master')
|
72
|
+
assert(mi.ignores == ['CMakeLists.txt', 'OtherPattern*'])
|
73
|
+
assert(mi.subdir == 'test/subdir')
|
74
|
+
mi = cut.module_infos[1]
|
75
|
+
assert(mi.remote_url == '../file/test')
|
76
|
+
assert(mi.remote_branch_format == 'refs/for/%s')
|
77
|
+
assert(mi.local_path == 'sub/file_test')
|
78
|
+
assert(mi.target_revision == 'branch')
|
79
|
+
assert(mi.ignores == [])
|
80
|
+
assert(mi.subdir.nil?)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
data/test/file_helper_test.rb
CHANGED
@@ -1,132 +1,132 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
$:.unshift File.join(File.dirname(__FILE__))
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'rim/file_helper'
|
6
|
-
require 'fileutils'
|
7
|
-
require 'test_helper'
|
8
|
-
|
9
|
-
class FileHelperTest < Minitest::Test
|
10
|
-
include FileUtils
|
11
|
-
include TestHelper
|
12
|
-
|
13
|
-
def setup
|
14
|
-
@test_dir = empty_test_dir("file_helper_test")
|
15
|
-
end
|
16
|
-
|
17
|
-
def teardown
|
18
|
-
remove_test_dirs
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_find_matching_relative_files
|
22
|
-
create_test_file(".", "aaa")
|
23
|
-
create_test_file(".", "abc")
|
24
|
-
create_test_file(".", "bbb")
|
25
|
-
create_test_file("f1", "aaa")
|
26
|
-
create_test_file("f1", "ccc")
|
27
|
-
create_test_file("f2", "ccc")
|
28
|
-
create_test_file("f2", "ddd")
|
29
|
-
files = RIM::FileHelper.find_matching_files(@test_dir, false)
|
30
|
-
assert files[0] == "aaa"
|
31
|
-
assert files[1] == "abc"
|
32
|
-
assert files[2] == "bbb"
|
33
|
-
assert files[3] == "f1"
|
34
|
-
assert files[4] == "f1/aaa"
|
35
|
-
assert files[5] == "f1/ccc"
|
36
|
-
assert files[6] == "f2"
|
37
|
-
assert files[7] == "f2/ccc"
|
38
|
-
assert files[8] == "f2/ddd"
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_find_matching_absolute_files
|
42
|
-
create_test_file(".", "aaa")
|
43
|
-
create_test_file(".", "abc")
|
44
|
-
create_test_file(".", "bbb")
|
45
|
-
create_test_file("f1", "aaa")
|
46
|
-
create_test_file("f1", "ccc")
|
47
|
-
create_test_file("f2", "ccc")
|
48
|
-
create_test_file("f2", "ddd")
|
49
|
-
files = RIM::FileHelper.find_matching_files(@test_dir, true)
|
50
|
-
assert files[0] == File.join(@test_dir, "aaa")
|
51
|
-
assert files[1] == File.join(@test_dir, "abc")
|
52
|
-
assert files[2] == File.join(@test_dir, "bbb")
|
53
|
-
assert files[3] == File.join(@test_dir, "f1")
|
54
|
-
assert files[4] == File.join(@test_dir, "f1/aaa")
|
55
|
-
assert files[5] == File.join(@test_dir, "f1/ccc")
|
56
|
-
assert files[6] == File.join(@test_dir, "f2")
|
57
|
-
assert files[7] == File.join(@test_dir, "f2/ccc")
|
58
|
-
assert files[8] == File.join(@test_dir, "f2/ddd")
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_find_matching_relative_files_with_patterns
|
62
|
-
create_test_file(".", "aaa")
|
63
|
-
create_test_file(".", "abc")
|
64
|
-
create_test_file(".", "bbb")
|
65
|
-
create_test_file("f1", "aaa")
|
66
|
-
create_test_file("f1", "ccc")
|
67
|
-
create_test_file("f2", "ccc")
|
68
|
-
create_test_file("f2", "ddd")
|
69
|
-
files = RIM::FileHelper.find_matching_files(@test_dir, false, ["**/a*", "f2/ccc"])
|
70
|
-
assert files[0] == "aaa"
|
71
|
-
assert files[1] == "abc"
|
72
|
-
assert files[2] == "f1/aaa"
|
73
|
-
assert files[3] == "f2/ccc"
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_find_matching_absolute_files_with_patterns
|
77
|
-
create_test_file(".", "aaa")
|
78
|
-
create_test_file(".", "abc")
|
79
|
-
create_test_file(".", "bbb")
|
80
|
-
create_test_file("f1", "aaa")
|
81
|
-
create_test_file("f1", "ccc")
|
82
|
-
create_test_file("f2", "ccc")
|
83
|
-
create_test_file("f2", "ddd")
|
84
|
-
files = RIM::FileHelper.find_matching_files(@test_dir, true, ["**/a*", "f2/ccc"])
|
85
|
-
assert files[0] == File.join(@test_dir, "aaa")
|
86
|
-
assert files[1] == File.join(@test_dir, "abc")
|
87
|
-
assert files[2] == File.join(@test_dir, "f1/aaa")
|
88
|
-
assert files[3] == File.join(@test_dir, "f2/ccc")
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_remove_empty_dirs
|
92
|
-
create_test_file(".", "a")
|
93
|
-
create_test_file("f1", "ab")
|
94
|
-
create_test_file("f1/f1")
|
95
|
-
create_test_file("f1/f1/f1")
|
96
|
-
create_test_file("f1/f1/f2")
|
97
|
-
RIM::FileHelper.remove_empty_dirs(@test_dir)
|
98
|
-
files = RIM::FileHelper.find_matching_files(@test_dir, false)
|
99
|
-
assert files[0] = "a"
|
100
|
-
assert files[1] = "f1"
|
101
|
-
assert files[2] = "f1/ab"
|
102
|
-
assert !files[3]
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_remove_empty_dirs_with_avoid
|
106
|
-
create_test_file(".", "a")
|
107
|
-
create_test_file("f1", "ab")
|
108
|
-
create_test_file("f1/f1")
|
109
|
-
create_test_file("f1/f1/f1")
|
110
|
-
create_test_file("f1/f1/f2")
|
111
|
-
RIM::FileHelper.remove_empty_dirs(@test_dir, File.join(@test_dir, "f1/f1"))
|
112
|
-
files = RIM::FileHelper.find_matching_files(@test_dir, false)
|
113
|
-
assert files[0] = "a"
|
114
|
-
assert files[1] = "f1"
|
115
|
-
assert files[2] = "f1/ab"
|
116
|
-
assert files[2] = "f1/f1"
|
117
|
-
assert !files[4]
|
118
|
-
end
|
119
|
-
|
120
|
-
private
|
121
|
-
|
122
|
-
def create_test_file(dir, name = nil)
|
123
|
-
abs_dir = File.join(@test_dir, dir)
|
124
|
-
FileUtils.mkdir_p(abs_dir)
|
125
|
-
if name
|
126
|
-
File.open(File.join(abs_dir, name), "w") do |f|
|
127
|
-
f.write("Content of #{name}\n")
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'rim/file_helper'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'test_helper'
|
8
|
+
|
9
|
+
class FileHelperTest < Minitest::Test
|
10
|
+
include FileUtils
|
11
|
+
include TestHelper
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@test_dir = empty_test_dir("file_helper_test")
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
remove_test_dirs
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_find_matching_relative_files
|
22
|
+
create_test_file(".", "aaa")
|
23
|
+
create_test_file(".", "abc")
|
24
|
+
create_test_file(".", "bbb")
|
25
|
+
create_test_file("f1", "aaa")
|
26
|
+
create_test_file("f1", "ccc")
|
27
|
+
create_test_file("f2", "ccc")
|
28
|
+
create_test_file("f2", "ddd")
|
29
|
+
files = RIM::FileHelper.find_matching_files(@test_dir, false)
|
30
|
+
assert files[0] == "aaa"
|
31
|
+
assert files[1] == "abc"
|
32
|
+
assert files[2] == "bbb"
|
33
|
+
assert files[3] == "f1"
|
34
|
+
assert files[4] == "f1/aaa"
|
35
|
+
assert files[5] == "f1/ccc"
|
36
|
+
assert files[6] == "f2"
|
37
|
+
assert files[7] == "f2/ccc"
|
38
|
+
assert files[8] == "f2/ddd"
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_find_matching_absolute_files
|
42
|
+
create_test_file(".", "aaa")
|
43
|
+
create_test_file(".", "abc")
|
44
|
+
create_test_file(".", "bbb")
|
45
|
+
create_test_file("f1", "aaa")
|
46
|
+
create_test_file("f1", "ccc")
|
47
|
+
create_test_file("f2", "ccc")
|
48
|
+
create_test_file("f2", "ddd")
|
49
|
+
files = RIM::FileHelper.find_matching_files(@test_dir, true)
|
50
|
+
assert files[0] == File.join(@test_dir, "aaa")
|
51
|
+
assert files[1] == File.join(@test_dir, "abc")
|
52
|
+
assert files[2] == File.join(@test_dir, "bbb")
|
53
|
+
assert files[3] == File.join(@test_dir, "f1")
|
54
|
+
assert files[4] == File.join(@test_dir, "f1/aaa")
|
55
|
+
assert files[5] == File.join(@test_dir, "f1/ccc")
|
56
|
+
assert files[6] == File.join(@test_dir, "f2")
|
57
|
+
assert files[7] == File.join(@test_dir, "f2/ccc")
|
58
|
+
assert files[8] == File.join(@test_dir, "f2/ddd")
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_find_matching_relative_files_with_patterns
|
62
|
+
create_test_file(".", "aaa")
|
63
|
+
create_test_file(".", "abc")
|
64
|
+
create_test_file(".", "bbb")
|
65
|
+
create_test_file("f1", "aaa")
|
66
|
+
create_test_file("f1", "ccc")
|
67
|
+
create_test_file("f2", "ccc")
|
68
|
+
create_test_file("f2", "ddd")
|
69
|
+
files = RIM::FileHelper.find_matching_files(@test_dir, false, ["**/a*", "f2/ccc"])
|
70
|
+
assert files[0] == "aaa"
|
71
|
+
assert files[1] == "abc"
|
72
|
+
assert files[2] == "f1/aaa"
|
73
|
+
assert files[3] == "f2/ccc"
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_find_matching_absolute_files_with_patterns
|
77
|
+
create_test_file(".", "aaa")
|
78
|
+
create_test_file(".", "abc")
|
79
|
+
create_test_file(".", "bbb")
|
80
|
+
create_test_file("f1", "aaa")
|
81
|
+
create_test_file("f1", "ccc")
|
82
|
+
create_test_file("f2", "ccc")
|
83
|
+
create_test_file("f2", "ddd")
|
84
|
+
files = RIM::FileHelper.find_matching_files(@test_dir, true, ["**/a*", "f2/ccc"])
|
85
|
+
assert files[0] == File.join(@test_dir, "aaa")
|
86
|
+
assert files[1] == File.join(@test_dir, "abc")
|
87
|
+
assert files[2] == File.join(@test_dir, "f1/aaa")
|
88
|
+
assert files[3] == File.join(@test_dir, "f2/ccc")
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_remove_empty_dirs
|
92
|
+
create_test_file(".", "a")
|
93
|
+
create_test_file("f1", "ab")
|
94
|
+
create_test_file("f1/f1")
|
95
|
+
create_test_file("f1/f1/f1")
|
96
|
+
create_test_file("f1/f1/f2")
|
97
|
+
RIM::FileHelper.remove_empty_dirs(@test_dir)
|
98
|
+
files = RIM::FileHelper.find_matching_files(@test_dir, false)
|
99
|
+
assert files[0] = "a"
|
100
|
+
assert files[1] = "f1"
|
101
|
+
assert files[2] = "f1/ab"
|
102
|
+
assert !files[3]
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_remove_empty_dirs_with_avoid
|
106
|
+
create_test_file(".", "a")
|
107
|
+
create_test_file("f1", "ab")
|
108
|
+
create_test_file("f1/f1")
|
109
|
+
create_test_file("f1/f1/f1")
|
110
|
+
create_test_file("f1/f1/f2")
|
111
|
+
RIM::FileHelper.remove_empty_dirs(@test_dir, File.join(@test_dir, "f1/f1"))
|
112
|
+
files = RIM::FileHelper.find_matching_files(@test_dir, false)
|
113
|
+
assert files[0] = "a"
|
114
|
+
assert files[1] = "f1"
|
115
|
+
assert files[2] = "f1/ab"
|
116
|
+
assert files[2] = "f1/f1"
|
117
|
+
assert !files[4]
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
def create_test_file(dir, name = nil)
|
123
|
+
abs_dir = File.join(@test_dir, dir)
|
124
|
+
FileUtils.mkdir_p(abs_dir)
|
125
|
+
if name
|
126
|
+
File.open(File.join(abs_dir, name), "w") do |f|
|
127
|
+
f.write("Content of #{name}\n")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
@@ -1,29 +1,29 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
|
3
|
-
require "minitest/autorun"
|
4
|
-
require "rim/manifest/helper"
|
5
|
-
require "fileutils"
|
6
|
-
|
7
|
-
class ManifestHelperTest < Minitest::Test
|
8
|
-
include FileUtils
|
9
|
-
include RIM::Manifest::Helpers
|
10
|
-
|
11
|
-
def setup
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_find_local_config
|
15
|
-
|
16
|
-
cd File.dirname(__FILE__)+"/manifest_test_dir" do
|
17
|
-
m = default_manifest
|
18
|
-
assert m != nil
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_find_config_from_subdir
|
23
|
-
|
24
|
-
cd File.dirname(__FILE__)+"/manifest_test_dir/subdir" do
|
25
|
-
m = default_manifest
|
26
|
-
assert m != nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
+
|
3
|
+
require "minitest/autorun"
|
4
|
+
require "rim/manifest/helper"
|
5
|
+
require "fileutils"
|
6
|
+
|
7
|
+
class ManifestHelperTest < Minitest::Test
|
8
|
+
include FileUtils
|
9
|
+
include RIM::Manifest::Helpers
|
10
|
+
|
11
|
+
def setup
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_find_local_config
|
15
|
+
|
16
|
+
cd File.dirname(__FILE__)+"/manifest_test_dir" do
|
17
|
+
m = default_manifest
|
18
|
+
assert m != nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_find_config_from_subdir
|
23
|
+
|
24
|
+
cd File.dirname(__FILE__)+"/manifest_test_dir/subdir" do
|
25
|
+
m = default_manifest
|
26
|
+
assert m != nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|