ext 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +7 -0
- data/README +2 -0
- data/Rakefile +1 -74
- data/bin/ext +0 -0
- data/lib/externals/ext.rb +25 -9
- data/lib/externals/extensions/file_utils.rb +40 -0
- data/lib/externals/extensions/string.rb +1 -1
- data/lib/externals/project.rb +3 -0
- data/lib/externals/scms/git_project.rb +3 -4
- data/lib/externals/scms/svn_project.rb +10 -12
- data/lib/externals/test/basic_git_repository.rb +41 -0
- data/lib/externals/test/engines.rb +11 -0
- data/lib/externals/test/engines_with_branch1.rb +36 -0
- data/lib/externals/test/fake_rails_repository.rb +112 -0
- data/lib/externals/test/git_repository_from_internet.rb +19 -0
- data/lib/externals/test/modules_svn_branches_repository.rb +72 -0
- data/lib/externals/test/modules_svn_repository.rb +41 -0
- data/lib/externals/test/rails_app_git_branches.rb +100 -0
- data/lib/externals/test/rails_app_git_repository.rb +55 -0
- data/lib/externals/test/rails_app_svn_branches.rb +132 -0
- data/lib/externals/test/rails_app_svn_repository.rb +106 -0
- data/lib/externals/test/rails_app_unmanaged.rb +25 -0
- data/lib/externals/test/repository.rb +188 -0
- data/lib/externals/test/svn_repository_from_dump.rb +27 -0
- data/lib/externals/test/svn_repository_helper.rb +10 -0
- data/lib/externals/test_case.rb +16 -307
- data/test/setup/empty_plugin.svn.gz +0 -0
- data/test/setup/foreign_key_migrations.svn.gz +0 -0
- data/test/setup/redhillonrails_core.svn.gz +0 -0
- data/test/test_checkout_git.rb +16 -25
- data/test/test_checkout_with_subprojects_git.rb +109 -193
- data/test/test_checkout_with_subprojects_svn.rb +239 -294
- data/test/test_file_utils_extensions.rb +29 -0
- data/test/test_freeze_to_revision.rb +46 -85
- data/test/test_git_project_extract_name.rb +10 -8
- data/test/test_init_git.rb +19 -29
- data/test/test_projects.rb +87 -93
- data/test/test_rails_detection.rb +12 -17
- data/test/test_string_extensions.rb +32 -30
- data/test/test_svn_branches.rb +227 -383
- data/test/test_touch_emptydirs.rb +39 -34
- data/test/test_version.rb +18 -16
- metadata +47 -23
@@ -2,26 +2,21 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') if $0 == __FILE__
|
|
2
2
|
|
3
3
|
require 'externals/test_case'
|
4
4
|
require 'externals/ext'
|
5
|
+
require 'externals/test/rails_app_unmanaged'
|
5
6
|
|
6
7
|
module Externals
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def teardown
|
16
|
-
destroy_rails_application
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_detection
|
20
|
-
detector = Ext.project_type_detector('rails')
|
8
|
+
module Test
|
9
|
+
class TestRailsDetection < TestCase
|
10
|
+
include ExtTestCase
|
11
|
+
|
12
|
+
def test_detection
|
13
|
+
repository = RailsAppUnmanaged.new
|
14
|
+
detector = Ext.project_type_detector('rails')
|
21
15
|
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
assert !detector.detected?
|
17
|
+
Dir.chdir(repository.clean_dir) do
|
18
|
+
assert detector.detected?
|
19
|
+
end
|
25
20
|
end
|
26
21
|
end
|
27
22
|
end
|
@@ -4,46 +4,48 @@ require 'externals/test_case'
|
|
4
4
|
require 'externals/ext'
|
5
5
|
|
6
6
|
module Externals
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
module Test
|
8
|
+
class TestStringExtensions < TestCase
|
9
|
+
include ExtTestCase
|
10
|
+
|
11
|
+
def test_classify
|
12
|
+
assert_equal "yourmom".classify, "Yourmom"
|
13
|
+
assert_equal "your_mom".classify, "YourMom"
|
14
|
+
assert_equal "lol_your_mom".classify, "LolYourMom"
|
15
|
+
assert_equal "".classify, ""
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
def test_lines_by_width
|
19
|
+
assert_equal [
|
20
|
+
"this",
|
21
|
+
"is a",
|
22
|
+
"test"
|
22
23
|
],
|
23
24
|
"this is a test".lines_by_width(4)
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
assert_equal [
|
27
|
+
"this",
|
28
|
+
"is",
|
29
|
+
"a",
|
30
|
+
"test"
|
30
31
|
],
|
31
32
|
"this is a test".lines_by_width(2)
|
32
33
|
|
33
|
-
|
34
|
+
assert_equal ["this is a test"], "this is a test".lines_by_width
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
assert_equal [
|
37
|
+
"The working directory to execute",
|
38
|
+
"commands from. Use this if for",
|
39
|
+
"some reason you cannot execute",
|
40
|
+
"ext from the main project's",
|
41
|
+
"directory (or if it's just",
|
42
|
+
"inconvenient, such as in a",
|
43
|
+
"script or in a Capistrano task)"
|
44
|
+
],
|
45
|
+
"The working directory to execute commands from. Use this if for some reason you
|
45
46
|
cannot execute ext from the main project's directory (or if it's just inconvenient, such as in a script
|
46
47
|
or in a Capistrano task)".lines_by_width
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
data/test/test_svn_branches.rb
CHANGED
@@ -1,501 +1,345 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
2
|
require 'externals/test_case'
|
3
3
|
require 'externals/ext'
|
4
|
+
require 'externals/test/rails_app_svn_branches'
|
4
5
|
|
5
6
|
module Externals
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
module Test
|
8
|
+
class TestSvnBranches < TestCase
|
9
|
+
include ExtTestCase
|
10
|
+
|
11
|
+
def test_checkout_with_subproject
|
12
|
+
mode = "checkout"
|
13
|
+
repository = RailsAppSvnBranches.new
|
14
|
+
repository.prepare
|
15
|
+
|
16
|
+
assert File.exists?(File.join(repository.clean_dir, "db"))
|
17
|
+
|
18
|
+
workdir = File.join(root_dir, 'test', "tmp", "workdir", mode, "svn", "branches")
|
19
|
+
mkdir_p workdir
|
20
|
+
|
21
|
+
if File.exists?(File.join(workdir, "rails_app"))
|
22
|
+
rm_r File.join(workdir, "rails_app")
|
20
23
|
end
|
21
|
-
`rm -rf workdir`
|
22
|
-
end
|
23
|
-
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
Dir.chdir workdir do
|
26
|
+
source = repository.clean_url
|
27
|
+
if windows?
|
28
|
+
source = source.gsub(/\\/, "/")
|
29
|
+
end
|
27
30
|
|
28
|
-
|
31
|
+
puts "About to #{mode} #{source}"
|
32
|
+
Ext.run mode, "--svn", source, "-b", "current", 'rails_app'
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
initialize_with_svn_branches_repository
|
33
|
-
initialize_with_svn_branches_modules_repository
|
34
|
-
end
|
34
|
+
Dir.chdir 'rails_app' do
|
35
|
+
assert File.exists?('.svn')
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
source = with_svn_branches_repository_url
|
42
|
-
if windows?
|
43
|
-
source = source.gsub(/\\/, "/")
|
37
|
+
%w(redhillonrails_core acts_as_list).each do |proj|
|
38
|
+
ignore_text = `svn propget svn:ignore vendor/plugins`
|
39
|
+
puts "ignore_text is:"
|
40
|
+
puts ignore_text
|
41
|
+
assert(ignore_text =~ /^#{proj}$/)
|
44
42
|
end
|
45
43
|
|
46
|
-
|
47
|
-
|
44
|
+
ignore_text = `svn propget svn:ignore vendor`
|
45
|
+
assert(ignore_text =~ /^rails$/)
|
48
46
|
|
49
|
-
|
50
|
-
assert File.exists?(
|
47
|
+
%w(redhillonrails_core acts_as_list engines).each do |proj|
|
48
|
+
assert File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
49
|
+
end
|
51
50
|
|
52
|
-
|
53
|
-
ignore_text = `svn propget svn:ignore vendor/plugins`
|
54
|
-
puts "ignore_text is:"
|
55
|
-
puts ignore_text
|
56
|
-
assert(ignore_text =~ /^#{proj}$/)
|
57
|
-
end
|
51
|
+
assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
58
52
|
|
59
|
-
|
60
|
-
assert(ignore_text =~ /^rails$/)
|
53
|
+
assert File.exists?(File.join('vendor', 'rails', '.git'))
|
61
54
|
|
62
|
-
|
63
|
-
assert File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
64
|
-
end
|
55
|
+
assert File.exists?(File.join('modules', 'modules.txt'))
|
65
56
|
|
66
|
-
|
57
|
+
assert File.read(File.join('modules', 'modules.txt')) =~ /line1 of/
|
67
58
|
|
68
|
-
|
59
|
+
ext = Ext.new
|
60
|
+
main_project = ext.main_project
|
61
|
+
engines = ext.subproject("engines")
|
62
|
+
modules = ext.subproject("modules")
|
69
63
|
|
70
|
-
|
64
|
+
assert_equal "current", main_project.current_branch
|
71
65
|
|
72
|
-
|
66
|
+
assert_equal "edge", engines.current_branch
|
67
|
+
assert_equal "edge", ext.configuration["vendor/plugins/engines"]["branch"]
|
73
68
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
assert_equal "current", modules.current_branch
|
70
|
+
assert_equal "current", ext.configuration["modules"]["branch"]
|
71
|
+
gi
|
72
|
+
assert !File.exists?(File.join(%w(vendor plugins ssl_requirement)))
|
73
|
+
assert !File.exists?(File.join(%w(vendor plugins empty_plugin)))
|
78
74
|
|
79
|
-
|
75
|
+
`svn switch #{[source, "branches", "new_branch"].join("/")}`
|
76
|
+
unless $? == 0
|
77
|
+
raise
|
78
|
+
end
|
80
79
|
|
81
|
-
|
82
|
-
|
80
|
+
assert !File.exists?(File.join(%w(vendor plugins ssl_requirement)))
|
81
|
+
assert !File.exists?(File.join(%w(vendor plugins empty_plugin)))
|
83
82
|
|
84
|
-
|
85
|
-
assert_equal "current", ext.configuration["modules"]["branch"]
|
83
|
+
assert !main_project.ignore_contains?("vendor/rails")
|
86
84
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
85
|
+
ext = Ext.new
|
86
|
+
main_project = ext.main_project
|
87
|
+
engines = ext.subproject("engines")
|
88
|
+
modules = ext.subproject("modules")
|
91
89
|
|
92
|
-
|
90
|
+
assert_equal "branches/new_branch", main_project.current_branch
|
93
91
|
|
94
|
-
|
95
|
-
|
96
|
-
engines = ext.subproject("engines")
|
97
|
-
modules = ext.subproject("modules")
|
92
|
+
assert_equal "edge", engines.current_branch
|
93
|
+
assert_equal "branch1", ext.configuration["vendor/plugins/engines"]["branch"]
|
98
94
|
|
99
|
-
|
95
|
+
assert_equal "current", modules.current_branch
|
96
|
+
assert_equal "branches/branch2", ext.configuration["modules"]["branch"]
|
100
97
|
|
101
|
-
|
102
|
-
assert_equal "branch1", ext.configuration["vendor/plugins/engines"]["branch"]
|
98
|
+
Ext.run "up"
|
103
99
|
|
104
|
-
|
105
|
-
|
100
|
+
assert File.exists?(File.join(%w(vendor plugins ssl_requirement)))
|
101
|
+
assert File.exists?(File.join(%w(vendor plugins empty_plugin)))
|
106
102
|
|
107
|
-
|
103
|
+
Dir.chdir File.join("vendor",'plugins', "ssl_requirement") do
|
104
|
+
assert `git show HEAD` =~ /^\s*commit\s*#{
|
105
|
+
repository.dependents[:ssl_requirement].attributes[:revision]
|
106
|
+
}\s*$/i
|
107
|
+
end
|
108
108
|
|
109
|
-
|
109
|
+
assert_equal "branches/new_branch", main_project.current_branch
|
110
110
|
|
111
|
-
|
112
|
-
|
111
|
+
assert_equal "branch1", engines.current_branch
|
112
|
+
assert_equal "branch1", ext.configuration["vendor/plugins/engines"]["branch"]
|
113
113
|
|
114
|
-
|
115
|
-
|
114
|
+
assert_equal "branches/branch2", modules.current_branch
|
115
|
+
assert_equal "branches/branch2", ext.configuration["modules"]["branch"]
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
assert File.read(File.join('modules', 'modules.txt')) =~
|
118
|
+
/line 2 of modules.txt ... this is branch2!/
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
120
|
+
`svn switch #{[source, "current"].join("/")}`
|
121
|
+
ext = Ext.new
|
122
|
+
main_project = ext.main_project
|
123
|
+
engines = ext.subproject("engines")
|
124
|
+
modules = ext.subproject("modules")
|
125
125
|
|
126
|
-
|
126
|
+
assert_equal "current", main_project.current_branch
|
127
127
|
|
128
|
-
|
129
|
-
|
128
|
+
assert_equal "branch1", engines.current_branch
|
129
|
+
assert_equal "edge", ext.configuration["vendor/plugins/engines"]["branch"]
|
130
130
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
assert_equal "branches/branch2", modules.current_branch
|
132
|
+
assert_equal "current", ext.configuration["modules"]["branch"]
|
133
|
+
assert File.read(File.join('modules', 'modules.txt')) =~
|
134
|
+
/line 2 of modules.txt ... this is branch2!/
|
135
135
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
136
|
+
Ext.run "up"
|
137
|
+
ext = Ext.new
|
138
|
+
main_project = ext.main_project
|
139
|
+
engines = ext.subproject("engines")
|
140
|
+
modules = ext.subproject("modules")
|
141
141
|
|
142
|
-
|
142
|
+
assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
143
143
|
|
144
|
-
|
144
|
+
assert File.exists?(File.join('vendor', 'rails', '.git'))
|
145
145
|
|
146
|
-
|
146
|
+
assert_equal "current", main_project.current_branch
|
147
147
|
|
148
|
-
|
149
|
-
|
148
|
+
assert_equal "edge", engines.current_branch
|
149
|
+
assert_equal "edge", ext.configuration["vendor/plugins/engines"]["branch"]
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
151
|
+
assert_equal "current", modules.current_branch
|
152
|
+
assert_equal "current", ext.configuration["modules"]["branch"]
|
153
|
+
assert File.read(File.join('modules', 'modules.txt')) !~
|
154
|
+
/line 2 of modules.txt ... this is branch2!/
|
155
|
+
assert File.read(File.join('modules', 'modules.txt')) =~ /line1 of/
|
156
156
|
|
157
|
-
|
157
|
+
assert main_project.ignore_contains?("vendor/rails")
|
158
158
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
# let's test the switch command.
|
160
|
+
capture = StringIO.new
|
161
|
+
begin
|
162
|
+
$stdout = capture
|
163
163
|
|
164
|
-
|
164
|
+
Ext.run "switch", "branches/new_branch"
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
166
|
+
ext = Ext.new
|
167
|
+
main_project = ext.main_project
|
168
|
+
engines = ext.subproject("engines")
|
169
|
+
modules = ext.subproject("modules")
|
170
170
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
171
|
+
ensure
|
172
|
+
$stdout = STDOUT
|
173
|
+
end
|
174
|
+
capture = capture.string
|
175
175
|
|
176
|
-
|
176
|
+
assert_equal "branches/new_branch", main_project.current_branch
|
177
177
|
|
178
|
-
|
179
|
-
|
178
|
+
assert_equal "branch1", engines.current_branch
|
179
|
+
assert_equal "branch1", ext.configuration["vendor/plugins/engines"]["branch"]
|
180
180
|
|
181
|
-
|
182
|
-
|
181
|
+
assert_equal "branches/branch2", modules.current_branch
|
182
|
+
assert_equal "branches/branch2", ext.configuration["modules"]["branch"]
|
183
183
|
|
184
|
-
|
185
|
-
|
186
|
-
|
184
|
+
assert capture =~ /WARNING:/
|
185
|
+
assert capture =~ /rm\s+-rf?\s+vendor.rails/
|
186
|
+
assert capture.scan(/rm/).size == 1
|
187
187
|
|
188
|
-
|
188
|
+
assert !main_project.ignore_contains?("vendor/rails")
|
189
189
|
|
190
|
-
|
190
|
+
[
|
191
|
+
%w(vendor rails),
|
192
|
+
%w(vendor plugins ssl_requirement),
|
193
|
+
%w(vendor plugins empty_plugin)
|
194
|
+
].each do |dir|
|
195
|
+
rm_r File.join(*dir)
|
191
196
|
unless $? == 0
|
192
197
|
raise
|
193
198
|
end
|
199
|
+
end
|
194
200
|
|
195
|
-
|
196
|
-
|
201
|
+
assert File.read(File.join('modules', 'modules.txt')) =~
|
202
|
+
/line 2 of modules.txt ... this is branch2!/
|
197
203
|
|
198
|
-
|
199
|
-
|
200
|
-
|
204
|
+
capture = StringIO.new
|
205
|
+
begin
|
206
|
+
$stdout = capture
|
201
207
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
208
|
+
Ext.run "switch", "current"
|
209
|
+
ext = Ext.new
|
210
|
+
main_project = ext.main_project
|
211
|
+
engines = ext.subproject("engines")
|
212
|
+
modules = ext.subproject("modules")
|
207
213
|
|
208
|
-
|
209
|
-
|
210
|
-
|
214
|
+
ensure
|
215
|
+
$stdout = STDOUT
|
216
|
+
end
|
211
217
|
|
212
|
-
|
218
|
+
capture = capture.string
|
213
219
|
|
214
|
-
|
220
|
+
assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
215
221
|
|
216
|
-
|
222
|
+
assert File.exists?(File.join('vendor', 'rails', '.git'))
|
217
223
|
|
218
224
|
|
219
|
-
|
225
|
+
assert_equal "current", main_project.current_branch
|
220
226
|
|
221
|
-
|
222
|
-
|
227
|
+
assert_equal "edge", engines.current_branch
|
228
|
+
assert_equal "edge", ext.configuration["vendor/plugins/engines"]["branch"]
|
223
229
|
|
224
|
-
|
225
|
-
|
230
|
+
assert_equal "current", modules.current_branch
|
231
|
+
assert_equal "current", ext.configuration["modules"]["branch"]
|
226
232
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
233
|
+
assert capture !~ /WARNING:/
|
234
|
+
assert capture !~ /rm\s+-rf?\s+vendor.rails/
|
235
|
+
assert main_project.ignore_contains?("vendor/rails")
|
236
|
+
assert capture.scan(/rm/).size == 0
|
231
237
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
end
|
238
|
+
assert File.read(File.join('modules', 'modules.txt')) !~
|
239
|
+
/line 2 of modules.txt ... this is branch2!/
|
240
|
+
assert File.read(File.join('modules', 'modules.txt')) =~ /line1 of/
|
236
241
|
end
|
237
242
|
end
|
238
243
|
end
|
239
|
-
end
|
240
|
-
|
241
|
-
def test_update_with_missing_subproject_git
|
242
|
-
Dir.chdir File.join(root_dir, 'test') do
|
243
|
-
Dir.chdir 'workdir' do
|
244
|
-
`mkdir update`
|
245
|
-
Dir.chdir 'update' do
|
246
|
-
source = with_svn_branches_repository_url
|
247
|
-
if windows?
|
248
|
-
source = source.gsub(/\\/, "/")
|
249
|
-
end
|
250
|
-
|
251
|
-
|
252
|
-
puts "About to checkout #{source}"
|
253
|
-
Ext.run "checkout", "--svn", "-b", "current", source, 'rails_app'
|
254
|
-
|
255
|
-
Dir.chdir 'rails_app' do
|
256
|
-
pretests = proc do
|
257
|
-
assert File.exists?('.svn')
|
258
|
-
assert !File.exists?(File.join('vendor', 'plugins', 'ssl_requirement', 'lib'))
|
259
|
-
assert File.read(".externals") =~ /rails/
|
260
|
-
assert File.read(".externals") !~ /ssl_requirement/
|
261
|
-
end
|
262
|
-
|
263
|
-
pretests.call
|
264
|
-
|
265
|
-
#add a project
|
266
|
-
Dir.chdir File.join(root_dir, 'test') do
|
267
|
-
`mkdir rails_app`
|
268
|
-
Dir.chdir 'workdir' do
|
269
|
-
Ext.run "checkout", "--svn", "-b", "current", source, 'rails_app'
|
270
244
|
|
271
|
-
|
272
|
-
|
273
|
-
Ext.run "install", File.join(root_dir, 'test', 'cleanreps', 'ssl_requirement.git')
|
245
|
+
def test_export_with_subproject
|
246
|
+
mode = "export"
|
274
247
|
|
275
|
-
|
248
|
+
repository = RailsAppSvnBranches.new
|
249
|
+
repository.prepare
|
276
250
|
|
277
|
-
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
251
|
+
assert File.exists?(File.join(repository.clean_dir, "db"))
|
281
252
|
|
282
|
-
|
253
|
+
workdir = File.join(root_dir, 'test', "tmp", "workdir", mode, "svn", "branch_test")
|
254
|
+
mkdir_p workdir
|
283
255
|
|
284
|
-
|
285
|
-
|
286
|
-
assert File.read(".externals") =~ /ssl_requirement/
|
287
|
-
assert File.exists?(File.join('vendor', 'plugins', 'ssl_requirement', 'lib'))
|
288
|
-
end
|
289
|
-
end
|
256
|
+
if File.exists?(File.join(workdir,"rails_app"))
|
257
|
+
rm_r File.join(workdir, "rails_app")
|
290
258
|
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_update_with_missing_subproject_by_revision_git
|
295
|
-
subproject = "ssl_requirement"
|
296
|
-
revision = "aa2dded823f8a9b378c22ba0159971508918928a"
|
297
|
-
|
298
|
-
Dir.chdir File.join(root_dir, 'test') do
|
299
|
-
Dir.chdir 'workdir' do
|
300
|
-
`mkdir update`
|
301
|
-
Dir.chdir 'update' do
|
302
|
-
source = with_svn_branches_repository_url
|
303
|
-
|
304
|
-
puts "About to checkout #{source}"
|
305
|
-
Ext.run "checkout", "--svn", source, "-b", "current", 'rails_app'
|
306
|
-
|
307
|
-
Dir.chdir 'rails_app' do
|
308
|
-
pretests = proc do
|
309
|
-
assert File.exists?('.svn')
|
310
|
-
assert !File.exists?(File.join('vendor', 'plugins', subproject, 'lib'))
|
311
|
-
assert File.read(".externals") =~ /rails/
|
312
|
-
assert File.read(".externals") !~ /#{subproject}/
|
313
|
-
end
|
314
|
-
|
315
|
-
pretests.call
|
316
|
-
|
317
|
-
#add a project
|
318
|
-
Dir.chdir File.join(root_dir, 'test') do
|
319
|
-
Dir.chdir File.join('workdir') do
|
320
|
-
Ext.run "checkout", "--svn", source, "-b", "current", 'rails_app'
|
321
|
-
|
322
|
-
Dir.chdir File.join("rails_app") do
|
323
|
-
#install a new project
|
324
|
-
Ext.run "install", File.join(root_dir, 'test', 'cleanreps', "#{subproject}.git")
|
325
|
-
Dir.chdir File.join("vendor",'plugins', subproject) do
|
326
|
-
assert `git show HEAD` !~ /^\s*commit\s*#{revision}\s*$/i
|
327
|
-
end
|
328
|
-
#freeze it to a revision
|
329
|
-
Ext.run "freeze", subproject, revision
|
330
|
-
Dir.chdir File.join("vendor",'plugins', subproject) do
|
331
|
-
regex = /^\s*commit\s*#{revision}\s*$/i
|
332
|
-
output = `git show HEAD`
|
333
|
-
result = output =~ regex
|
334
|
-
unless result
|
335
|
-
puts "Expecting output to match #{regex} but it was: #{output}"
|
336
|
-
end
|
337
|
-
assert result
|
338
|
-
end
|
339
|
-
|
340
|
-
SvnProject.add_all
|
341
|
-
|
342
|
-
puts `svn commit -m "added another subproject (#{subproject}) frozen to #{revision}"`
|
343
|
-
end
|
344
|
-
|
345
|
-
`rm -rf rails_app`
|
346
|
-
end
|
347
|
-
end
|
348
259
|
|
349
|
-
|
260
|
+
Dir.chdir workdir do
|
261
|
+
source = repository.clean_url
|
262
|
+
if windows?
|
263
|
+
source = source.gsub(/\\/, "/")
|
264
|
+
end
|
350
265
|
|
351
|
-
|
352
|
-
|
353
|
-
assert File.read(".externals") =~ /ssl_requirement/
|
266
|
+
puts "About to #{mode} #{source}"
|
267
|
+
Ext.run mode, "--svn", source, "-b", "current", 'rails_app'
|
354
268
|
|
355
|
-
|
269
|
+
Dir.chdir 'rails_app' do
|
270
|
+
assert !File.exists?('.svn')
|
356
271
|
|
357
|
-
|
358
|
-
|
359
|
-
end
|
272
|
+
%w(redhillonrails_core).each do |proj|
|
273
|
+
assert !File.exists?(File.join('vendor', 'plugins',proj, '.svn'))
|
360
274
|
end
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
def test_update_with_missing_subproject_svn
|
367
|
-
Dir.chdir File.join(root_dir, 'test') do
|
368
|
-
Dir.chdir 'workdir' do
|
369
|
-
`mkdir update`
|
370
|
-
Dir.chdir 'update' do
|
371
|
-
source = with_svn_branches_repository_url
|
372
|
-
|
373
|
-
puts "About to checkout #{source}"
|
374
|
-
Ext.run "checkout", "--svn", "-b", "current", source, 'rails_app'
|
375
|
-
|
376
|
-
Dir.chdir 'rails_app' do
|
377
|
-
pretests = proc do
|
378
|
-
assert File.exists?('.svn')
|
379
|
-
assert !File.exists?(File.join('vendor', 'plugins', 'empty_plugin', 'lib'))
|
380
|
-
assert File.read(".externals") =~ /rails/
|
381
|
-
assert File.read(".externals") !~ /empty_plugin/
|
382
|
-
end
|
383
275
|
|
384
|
-
|
276
|
+
%w(redhillonrails_core acts_as_list engines).each do |proj|
|
277
|
+
assert File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
278
|
+
end
|
385
279
|
|
386
|
-
|
387
|
-
Dir.chdir File.join(root_dir, 'test') do
|
388
|
-
`mkdir rails_app`
|
389
|
-
Dir.chdir 'workdir' do
|
390
|
-
Ext.run "checkout", "--svn", "-b", "current", source, 'rails_app'
|
280
|
+
assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
391
281
|
|
392
|
-
|
393
|
-
#install a new project
|
394
|
-
Ext.run "install", "--svn",
|
395
|
-
"file:///#{File.join(root_dir, 'test', 'cleanreps', 'empty_plugin')}"
|
282
|
+
assert File.exists?(File.join('vendor', 'rails', '.git'))
|
396
283
|
|
397
|
-
|
284
|
+
assert File.exists?(File.join('modules', 'modules.txt'))
|
398
285
|
|
399
|
-
|
400
|
-
end
|
401
|
-
end
|
402
|
-
end
|
286
|
+
assert File.read(File.join('modules', 'modules.txt')) =~ /line1 of/
|
403
287
|
|
404
|
-
|
288
|
+
ext = Ext.new
|
289
|
+
assert_equal "edge", ext.configuration["vendor/plugins/engines"]["branch"]
|
290
|
+
assert_equal "current", ext.configuration["modules"]["branch"]
|
405
291
|
|
406
|
-
|
407
|
-
|
408
|
-
assert File.read(".externals") =~ /empty_plugin/
|
409
|
-
assert File.exists?(File.join('vendor', 'plugins', 'empty_plugin', 'lib'))
|
410
|
-
end
|
292
|
+
assert !File.exists?(File.join(%w(vendor plugins ssl_requirement)))
|
293
|
+
assert !File.exists?(File.join(%w(vendor plugins empty_plugin)))
|
411
294
|
end
|
412
295
|
end
|
413
296
|
end
|
414
|
-
end
|
415
|
-
|
416
|
-
def test_export_with_subproject
|
417
|
-
Dir.chdir File.join(root_dir, 'test') do
|
418
|
-
Dir.chdir 'workdir' do
|
419
|
-
`mkdir export`
|
420
|
-
Dir.chdir 'export' do
|
421
|
-
source = with_svn_branches_repository_url
|
422
|
-
|
423
|
-
puts "About to export #{source}"
|
424
|
-
Ext.run "export", "--svn", "-b", "current", source, 'rails_app'
|
425
297
|
|
426
|
-
|
427
|
-
|
298
|
+
def test_uninstall
|
299
|
+
repository = RailsAppSvnBranches.new
|
300
|
+
repository.prepare
|
428
301
|
|
429
|
-
|
430
|
-
puts(ignore_text = `svn propget svn:ignore vendor/plugins`)
|
431
|
-
assert(ignore_text =~ /^#{proj}$/)
|
432
|
-
end
|
433
|
-
|
434
|
-
puts(ignore_text = `svn propget svn:ignore vendor`)
|
435
|
-
assert(ignore_text =~ /^rails$/)
|
302
|
+
assert File.exists?(File.join(repository.clean_dir, "db"))
|
436
303
|
|
437
|
-
|
438
|
-
|
439
|
-
#repositories on the local machine.
|
440
|
-
#assert `git show 92f944818eece9fe4bc62ffb39accdb71ebc32be` !~ /azimux/
|
441
|
-
end
|
304
|
+
workdir = File.join(root_dir, 'test', "tmp", "workdir","uninstall","svn","branches")
|
305
|
+
mkdir_p workdir
|
442
306
|
|
443
|
-
|
444
|
-
|
445
|
-
if !File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
446
|
-
puts "here"
|
447
|
-
end
|
448
|
-
assert File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
449
|
-
end
|
450
|
-
|
451
|
-
%w(foreign_key_migrations redhillonrails_core).each do |proj|
|
452
|
-
assert !File.exists?(File.join('vendor', 'plugins',proj, '.svn'))
|
453
|
-
end
|
454
|
-
|
455
|
-
assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
456
|
-
end
|
457
|
-
end
|
307
|
+
if File.exists?(File.join(workdir,"rails_app"))
|
308
|
+
rm_r File.join(workdir, "rails_app")
|
458
309
|
end
|
459
|
-
end
|
460
|
-
end
|
461
310
|
|
462
|
-
|
463
|
-
|
464
|
-
Dir.chdir 'workdir' do
|
465
|
-
`mkdir checkout`
|
466
|
-
Dir.chdir 'checkout' do
|
467
|
-
source = with_svn_branches_repository_url
|
311
|
+
Dir.chdir workdir do
|
312
|
+
source = repository.clean_url
|
468
313
|
|
469
|
-
|
470
|
-
|
314
|
+
puts "About to checkout #{source}"
|
315
|
+
Ext.run "checkout", "--svn", "-b", "current", source, "rails_app"
|
471
316
|
|
472
|
-
|
473
|
-
|
317
|
+
Dir.chdir 'rails_app' do
|
318
|
+
mp = Ext.new.main_project
|
474
319
|
|
475
|
-
|
476
|
-
|
477
|
-
|
320
|
+
projs = %w(redhillonrails_core acts_as_list)
|
321
|
+
projs_i = projs.dup
|
322
|
+
projs_ni = []
|
478
323
|
|
479
|
-
|
480
|
-
|
324
|
+
#let's uninstall acts_as_list
|
325
|
+
Ext.run "uninstall", "acts_as_list"
|
481
326
|
|
482
|
-
|
327
|
+
projs_ni << projs_i.delete('acts_as_list')
|
483
328
|
|
484
|
-
|
329
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, [], projs_i, projs_ni
|
485
330
|
|
486
|
-
|
331
|
+
Ext.run "uninstall", "-f", "redhillonrails_core"
|
487
332
|
|
488
|
-
|
333
|
+
projs_ni << projs_i.delete('redhillonrails_core')
|
489
334
|
|
490
|
-
|
491
|
-
|
335
|
+
projs_dne = []
|
336
|
+
projs_dne << projs.delete('redhillonrails_core')
|
492
337
|
|
493
|
-
|
494
|
-
end
|
338
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, projs_dne, projs_i, projs_ni
|
495
339
|
end
|
496
340
|
end
|
497
341
|
end
|
498
|
-
end
|
499
342
|
|
343
|
+
end
|
500
344
|
end
|
501
345
|
end
|