ext 1.1.3 → 2.0.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +44 -15
- data/LICENSE-MPL-2.0.txt +373 -0
- data/LICENSE.txt +9 -0
- data/README +5 -13
- data/lib/externals/command.rb +6 -5
- data/lib/externals/configuration/configuration.rb +26 -21
- data/lib/externals/ext.rb +147 -175
- data/lib/externals/extensions/file_utils.rb +11 -11
- data/lib/externals/extensions/string.rb +7 -10
- data/lib/externals/project.rb +27 -41
- data/lib/externals/scms/git_project.rb +64 -53
- data/lib/externals/scms/svn_project.rb +55 -27
- data/version.rb +4 -0
- metadata +23 -82
- data/MIT_LICENSE.txt +0 -22
- data/Rakefile +0 -77
- data/lib/externals/extensions/symbol.rb +0 -7
- data/lib/externals/project_types/rails.rb +0 -35
- 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 +0 -32
- data/test/test_checkout_with_subprojects_git.rb +0 -169
- data/test/test_checkout_with_subprojects_svn.rb +0 -384
- data/test/test_file_utils_extensions.rb +0 -29
- data/test/test_freeze_to_revision.rb +0 -176
- data/test/test_git_project_extract_name.rb +0 -20
- data/test/test_help.rb +0 -27
- data/test/test_init_git.rb +0 -62
- data/test/test_out_of_date_git_subproject.rb +0 -83
- data/test/test_projects.rb +0 -148
- data/test/test_rails_detection.rb +0 -23
- data/test/test_string_extensions.rb +0 -51
- data/test/test_svn_branches.rb +0 -353
- data/test/test_touch_emptydirs.rb +0 -59
- data/test/test_version.rb +0 -33
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
|
2
|
-
require 'ext_test_case'
|
|
3
|
-
require 'externals/ext'
|
|
4
|
-
require 'rails_app_git_branches'
|
|
5
|
-
|
|
6
|
-
module Externals
|
|
7
|
-
module Test
|
|
8
|
-
class TestCheckoutWithSubprojectsGit < ::Test::Unit::TestCase
|
|
9
|
-
include ExtTestCase
|
|
10
|
-
|
|
11
|
-
def test_checkout_with_subproject
|
|
12
|
-
repository = RailsAppGitBranches.new
|
|
13
|
-
repository.prepare
|
|
14
|
-
|
|
15
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "branches", "git")
|
|
16
|
-
mkdir_p workdir
|
|
17
|
-
|
|
18
|
-
if File.exist?(File.join(workdir,"rails_app"))
|
|
19
|
-
rm_rf File.join(workdir, "rails_app")
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
Dir.chdir workdir do
|
|
23
|
-
source = repository.clean_dir
|
|
24
|
-
puts "About to checkout #{source}"
|
|
25
|
-
Ext.run "checkout", "--git", source
|
|
26
|
-
|
|
27
|
-
Dir.chdir 'rails_app' do
|
|
28
|
-
assert File.exist?('.git')
|
|
29
|
-
|
|
30
|
-
assert File.exist?('.gitignore')
|
|
31
|
-
|
|
32
|
-
ext = Ext.new
|
|
33
|
-
main_project = ext.main_project
|
|
34
|
-
engines = ext.subproject("engines")
|
|
35
|
-
|
|
36
|
-
main_project.assert_e_dne_i_ni proc{|a|assert(a)},%w(foreign_key_migrations redhillonrails_core acts_as_list)
|
|
37
|
-
|
|
38
|
-
# let's test switching branches via altering .externals and running "ext up"
|
|
39
|
-
assert_equal "master", main_project.current_branch
|
|
40
|
-
assert_equal "edge", engines.current_branch
|
|
41
|
-
assert_equal "edge", ext.configuration["vendor/plugins/engines"]["branch"]
|
|
42
|
-
|
|
43
|
-
assert File.exist?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
|
44
|
-
|
|
45
|
-
`git checkout --track -b new_branch origin/new_branch`
|
|
46
|
-
raise unless $? == 0
|
|
47
|
-
|
|
48
|
-
assert_equal "new_branch", main_project.current_branch
|
|
49
|
-
assert_equal "edge", engines.current_branch
|
|
50
|
-
|
|
51
|
-
assert_equal "new_branch", main_project.current_branch
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
ext = Ext.new
|
|
55
|
-
assert_equal "branch1", ext.configuration["vendor/plugins/engines"]["branch"]
|
|
56
|
-
|
|
57
|
-
assert !main_project.ignore_contains?("vendor/rails")
|
|
58
|
-
|
|
59
|
-
rm_rf "vendor/rails"
|
|
60
|
-
raise if File.exist?(File.join("vendor", "rails"))
|
|
61
|
-
|
|
62
|
-
`git checkout master`
|
|
63
|
-
raise unless $? == 0
|
|
64
|
-
|
|
65
|
-
assert_equal "master", main_project.current_branch
|
|
66
|
-
assert_equal "edge", engines.current_branch
|
|
67
|
-
|
|
68
|
-
Ext.run "up"
|
|
69
|
-
assert_equal "master", main_project.current_branch
|
|
70
|
-
assert_equal "edge", engines.current_branch
|
|
71
|
-
assert File.exist?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
|
72
|
-
|
|
73
|
-
`git checkout new_branch`
|
|
74
|
-
assert_equal "new_branch", main_project.current_branch
|
|
75
|
-
assert_equal "edge", engines.current_branch
|
|
76
|
-
|
|
77
|
-
Ext.run "up"
|
|
78
|
-
assert_equal "new_branch", main_project.current_branch
|
|
79
|
-
assert_equal "branch1", engines.current_branch
|
|
80
|
-
|
|
81
|
-
`git checkout master`
|
|
82
|
-
Ext.run "up"
|
|
83
|
-
assert_equal "master", main_project.current_branch
|
|
84
|
-
assert_equal "edge", engines.current_branch
|
|
85
|
-
|
|
86
|
-
assert main_project.ignore_contains?("vendor/rails")
|
|
87
|
-
|
|
88
|
-
#let's test the switch command!
|
|
89
|
-
Ext.run "switch", "new_branch"
|
|
90
|
-
assert_equal "new_branch", main_project.current_branch
|
|
91
|
-
assert_equal "branch1", engines.current_branch
|
|
92
|
-
|
|
93
|
-
assert !main_project.ignore_contains?("vendor/rails")
|
|
94
|
-
assert File.exist?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
|
95
|
-
rm_rf "vendor/rails"
|
|
96
|
-
|
|
97
|
-
Ext.run "switch", "master"
|
|
98
|
-
assert_equal "master", main_project.current_branch
|
|
99
|
-
assert_equal "edge", engines.current_branch
|
|
100
|
-
|
|
101
|
-
assert File.exist?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
|
102
|
-
|
|
103
|
-
assert main_project.ignore_contains?("vendor/rails")
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
#now let's check it out again to test "ext checkout -b new_branch"
|
|
107
|
-
rm_rf "rails_app"
|
|
108
|
-
if File.exist?("rails_app")
|
|
109
|
-
raise
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
Ext.run "checkout", "--git", "-b", "new_branch", source
|
|
113
|
-
|
|
114
|
-
Dir.chdir 'rails_app' do
|
|
115
|
-
ext = Ext.new
|
|
116
|
-
main_project = ext.main_project
|
|
117
|
-
engines = ext.subproject("engines")
|
|
118
|
-
|
|
119
|
-
assert_equal "new_branch", main_project.current_branch
|
|
120
|
-
assert_equal "branch1", engines.current_branch
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def test_uninstall
|
|
126
|
-
repository = RailsAppGitBranches.new
|
|
127
|
-
repository.prepare
|
|
128
|
-
|
|
129
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "branches", "uninstall", "git")
|
|
130
|
-
mkdir_p workdir
|
|
131
|
-
|
|
132
|
-
if File.exist?(File.join(workdir,"rails_app"))
|
|
133
|
-
rm_rf File.join(workdir, "rails_app")
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
Dir.chdir workdir do
|
|
137
|
-
source = repository.clean_dir
|
|
138
|
-
puts "About to checkout #{source}"
|
|
139
|
-
Ext.run "checkout", "--git", source
|
|
140
|
-
|
|
141
|
-
Dir.chdir 'rails_app' do
|
|
142
|
-
mp = Ext.new.main_project
|
|
143
|
-
|
|
144
|
-
projs = %w(foreign_key_migrations redhillonrails_core acts_as_list)
|
|
145
|
-
projs_i = projs.dup
|
|
146
|
-
projs_ni = []
|
|
147
|
-
|
|
148
|
-
#let's uninstall acts_as_list
|
|
149
|
-
Ext.run "uninstall", "acts_as_list"
|
|
150
|
-
|
|
151
|
-
projs_ni << projs_i.delete('acts_as_list')
|
|
152
|
-
|
|
153
|
-
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, [], projs_i, projs_ni
|
|
154
|
-
|
|
155
|
-
Ext.run "uninstall", "-f", "foreign_key_migrations"
|
|
156
|
-
|
|
157
|
-
projs_ni << projs_i.delete('foreign_key_migrations')
|
|
158
|
-
|
|
159
|
-
projs_dne = []
|
|
160
|
-
projs_dne << projs.delete('foreign_key_migrations')
|
|
161
|
-
|
|
162
|
-
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, projs_dne, projs_i, projs_ni
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
end
|
|
169
|
-
end
|
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
|
2
|
-
$:.unshift File.join(File.dirname(__FILE__), 'support') if $0 == __FILE__
|
|
3
|
-
|
|
4
|
-
require 'ext_test_case'
|
|
5
|
-
require 'externals/ext'
|
|
6
|
-
require 'rails_app_svn_repository'
|
|
7
|
-
|
|
8
|
-
module Externals
|
|
9
|
-
module Test
|
|
10
|
-
class TestCheckoutWithSubprojectsSvn < ::Test::Unit::TestCase
|
|
11
|
-
include ExtTestCase
|
|
12
|
-
|
|
13
|
-
def test_checkout_with_subproject
|
|
14
|
-
repository = RailsAppSvnRepository.new
|
|
15
|
-
repository.prepare
|
|
16
|
-
|
|
17
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "checkout")
|
|
18
|
-
rm_rf_ie workdir
|
|
19
|
-
mkdir_p workdir
|
|
20
|
-
Dir.chdir workdir do
|
|
21
|
-
source = repository.clean_url
|
|
22
|
-
|
|
23
|
-
puts "About to checkout #{source}"
|
|
24
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
25
|
-
|
|
26
|
-
Dir.chdir 'rails_app' do
|
|
27
|
-
assert File.exist?('.svn')
|
|
28
|
-
|
|
29
|
-
%w(redhillonrails_core acts_as_list).each do |proj|
|
|
30
|
-
puts(ignore_text = `svn propget svn:ignore vendor/plugins`)
|
|
31
|
-
assert(ignore_text =~ /^#{proj}$/)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
puts(ignore_text = `svn propget svn:ignore vendor`)
|
|
35
|
-
assert(ignore_text =~ /^rails$/)
|
|
36
|
-
|
|
37
|
-
%w(redhillonrails_core acts_as_list some_subproject_with_edge).each do |proj|
|
|
38
|
-
assert File.exist?(File.join('vendor', 'plugins', proj, 'lib'))
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
assert File.exist?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
|
42
|
-
|
|
43
|
-
assert File.exist?(File.join('vendor', 'rails', '.git'))
|
|
44
|
-
|
|
45
|
-
Dir.chdir File.join('vendor', 'rails') do
|
|
46
|
-
heads = File.readlines("heads").map(&:strip)
|
|
47
|
-
assert_equal 3, heads.size
|
|
48
|
-
heads.each do |head|
|
|
49
|
-
assert head =~ /^[0-9a-f]{40}$/
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
assert `git show #{heads[0]}` =~
|
|
53
|
-
/^\s*commit\s+#{heads[0]}\s*$/
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
assert File.exist?(File.join('modules', 'modules.txt'))
|
|
57
|
-
|
|
58
|
-
assert File.read(File.join('modules', 'modules.txt')) =~ /line1 of/
|
|
59
|
-
|
|
60
|
-
Dir.chdir File.join('vendor', 'plugins', 'some_subproject_with_edge') do
|
|
61
|
-
assert(`git branch -a` =~ /^\*\s*edge\s*$/)
|
|
62
|
-
assert(`git branch -a` !~ /^\*\s*master\s*$/)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def test_update_with_missing_subproject_git
|
|
69
|
-
repository = RailsAppSvnRepository.new
|
|
70
|
-
repository.prepare
|
|
71
|
-
|
|
72
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "checkout")
|
|
73
|
-
rm_rf_ie workdir
|
|
74
|
-
mkdir_p workdir
|
|
75
|
-
Dir.chdir workdir do
|
|
76
|
-
source = repository.clean_url
|
|
77
|
-
|
|
78
|
-
puts "About to checkout #{source}"
|
|
79
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
80
|
-
|
|
81
|
-
Dir.chdir 'rails_app' do
|
|
82
|
-
pretests = proc do
|
|
83
|
-
assert File.exist?('.svn')
|
|
84
|
-
assert !File.exist?(File.join('vendor', 'plugins', 'ssl_requirement', 'lib'))
|
|
85
|
-
assert File.read(".externals") =~ /rails/
|
|
86
|
-
assert File.read(".externals") !~ /ssl_requirement/
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
pretests.call
|
|
90
|
-
|
|
91
|
-
#add a project
|
|
92
|
-
workdir2 = File.join("workdir2")
|
|
93
|
-
rm_rf_ie workdir2
|
|
94
|
-
mkdir_p workdir2
|
|
95
|
-
|
|
96
|
-
Dir.chdir workdir2 do
|
|
97
|
-
puts "About to checkout #{source}"
|
|
98
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
99
|
-
|
|
100
|
-
Dir.chdir "rails_app" do
|
|
101
|
-
#install a new project
|
|
102
|
-
subproject = GitRepositoryFromBundle.new("ssl_requirement")
|
|
103
|
-
Ext.run "install", subproject.clean_dir
|
|
104
|
-
|
|
105
|
-
SvnProject.add_all
|
|
106
|
-
|
|
107
|
-
repository.mark_dirty
|
|
108
|
-
puts `svn commit -m "added another subproject (ssl_requirement)"`
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
pretests.call
|
|
113
|
-
|
|
114
|
-
#update the project and make sure ssl_requirement was added and checked out
|
|
115
|
-
Ext.run "update"
|
|
116
|
-
assert File.read(".externals") =~ /ssl_requirement/
|
|
117
|
-
assert File.exist?(File.join('vendor', 'plugins', 'ssl_requirement', 'lib'))
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def test_update_with_missing_subproject_by_revision_git
|
|
123
|
-
repository = RailsAppSvnRepository.new
|
|
124
|
-
repository.prepare
|
|
125
|
-
subproject = GitRepositoryFromBundle.new("ssl_requirement")
|
|
126
|
-
subproject.prepare
|
|
127
|
-
revision = "aa2dded823f8a9b378c22ba0159971508918928a"
|
|
128
|
-
subproject_name = subproject.name.gsub(".git", "")
|
|
129
|
-
|
|
130
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "checkout")
|
|
131
|
-
rm_rf_ie workdir
|
|
132
|
-
mkdir_p workdir
|
|
133
|
-
Dir.chdir workdir do
|
|
134
|
-
source = repository.clean_url
|
|
135
|
-
|
|
136
|
-
puts "About to checkout #{source}"
|
|
137
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
138
|
-
|
|
139
|
-
Dir.chdir 'rails_app' do
|
|
140
|
-
|
|
141
|
-
pretests = proc do
|
|
142
|
-
assert File.exist?('.svn')
|
|
143
|
-
assert !File.exist?(File.join('vendor', 'plugins', subproject_name, 'lib'))
|
|
144
|
-
assert File.read(".externals") =~ /rails/
|
|
145
|
-
assert File.read(".externals") !~ /#{subproject}/
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
pretests.call
|
|
149
|
-
|
|
150
|
-
#add a project
|
|
151
|
-
workdir2 = "workdir2"
|
|
152
|
-
rm_rf_ie workdir2
|
|
153
|
-
mkdir_p workdir2
|
|
154
|
-
|
|
155
|
-
Dir.chdir workdir2 do
|
|
156
|
-
|
|
157
|
-
#install a new project
|
|
158
|
-
puts "About to checkout #{source}"
|
|
159
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
160
|
-
|
|
161
|
-
Dir.chdir "rails_app" do
|
|
162
|
-
Ext.run "install", subproject.clean_dir
|
|
163
|
-
|
|
164
|
-
Dir.chdir File.join("vendor", 'plugins', subproject_name) do
|
|
165
|
-
assert `git show HEAD` !~ /^\s*commit\s*#{revision}\s*$/i
|
|
166
|
-
end
|
|
167
|
-
#freeze it to a revision
|
|
168
|
-
Ext.run "freeze", subproject_name, revision
|
|
169
|
-
Dir.chdir File.join("vendor", 'plugins', subproject_name) do
|
|
170
|
-
regex = /^\s*commit\s*#{revision}\s*$/i
|
|
171
|
-
output = `git show HEAD`
|
|
172
|
-
result = output =~ regex
|
|
173
|
-
unless result
|
|
174
|
-
puts "Expecting output to match #{regex} but it was: #{output}"
|
|
175
|
-
end
|
|
176
|
-
assert result
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
SvnProject.add_all
|
|
180
|
-
|
|
181
|
-
repository.mark_dirty
|
|
182
|
-
puts `svn commit -m "added another subproject (#{subproject}) frozen to #{revision}"`
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
pretests.call
|
|
187
|
-
|
|
188
|
-
#update the project and make sure ssl_requirement was added and checked out at the right revision
|
|
189
|
-
Ext.run "update"
|
|
190
|
-
assert File.read(".externals") =~ /ssl_requirement/
|
|
191
|
-
|
|
192
|
-
assert File.exist?(File.join('vendor', 'plugins', subproject_name, 'lib'))
|
|
193
|
-
|
|
194
|
-
Dir.chdir File.join("vendor",'plugins', subproject_name) do
|
|
195
|
-
assert `git show HEAD` =~ /^\s*commit\s*#{revision}\s*$/i
|
|
196
|
-
end
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def test_update_with_missing_subproject_svn
|
|
202
|
-
repository = RailsAppSvnRepository.new
|
|
203
|
-
repository.prepare
|
|
204
|
-
subproject = SvnRepositoryFromDump.new("empty_plugin")
|
|
205
|
-
subproject.prepare
|
|
206
|
-
|
|
207
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "checkout")
|
|
208
|
-
rm_rf_ie workdir
|
|
209
|
-
mkdir_p workdir
|
|
210
|
-
Dir.chdir workdir do
|
|
211
|
-
source = repository.clean_url
|
|
212
|
-
|
|
213
|
-
puts "About to checkout #{source}"
|
|
214
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
215
|
-
|
|
216
|
-
Dir.chdir 'rails_app' do
|
|
217
|
-
pretests = proc do
|
|
218
|
-
assert File.exist?('.svn')
|
|
219
|
-
assert !File.exist?(File.join('vendor', 'plugins', subproject.name, 'lib'))
|
|
220
|
-
assert File.read(".externals") =~ /rails/
|
|
221
|
-
assert File.read(".externals") !~ /empty_plugin/
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
pretests.call
|
|
225
|
-
|
|
226
|
-
#add a project
|
|
227
|
-
workdir2 = File.join "workdir2", "svn"
|
|
228
|
-
rm_rf_ie workdir2
|
|
229
|
-
mkdir_p workdir2
|
|
230
|
-
|
|
231
|
-
Dir.chdir workdir2 do
|
|
232
|
-
puts "About to checkout #{source}"
|
|
233
|
-
Ext.run "checkout", "--svn", source, 'rails_app'
|
|
234
|
-
|
|
235
|
-
Dir.chdir 'rails_app' do
|
|
236
|
-
#install a new project
|
|
237
|
-
Ext.run "install", "--svn", subproject.clean_url
|
|
238
|
-
|
|
239
|
-
SvnProject.add_all
|
|
240
|
-
|
|
241
|
-
repository.mark_dirty
|
|
242
|
-
puts `svn commit -m "added another subproject (#{subproject.name})"`
|
|
243
|
-
end
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
pretests.call
|
|
247
|
-
|
|
248
|
-
#update the project and make sure ssl_requirement was added and checked out
|
|
249
|
-
Ext.run "update"
|
|
250
|
-
assert File.read(".externals") =~ /empty_plugin/
|
|
251
|
-
assert File.exist?(File.join('vendor', 'plugins', subproject.name, 'lib'))
|
|
252
|
-
end
|
|
253
|
-
end
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
def test_export_with_subproject
|
|
257
|
-
repository = RailsAppSvnRepository.new
|
|
258
|
-
repository.prepare
|
|
259
|
-
|
|
260
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "export")
|
|
261
|
-
rm_rf_ie workdir
|
|
262
|
-
mkdir_p workdir
|
|
263
|
-
Dir.chdir workdir do
|
|
264
|
-
source = repository.clean_url
|
|
265
|
-
|
|
266
|
-
puts "About to export #{source}"
|
|
267
|
-
Ext.run "export", "--svn", source, 'rails_app'
|
|
268
|
-
|
|
269
|
-
Dir.chdir 'rails_app' do
|
|
270
|
-
assert !File.exist?('.svn')
|
|
271
|
-
|
|
272
|
-
Dir.chdir File.join('vendor', 'rails') do
|
|
273
|
-
heads = File.readlines("heads").map(&:strip)
|
|
274
|
-
assert_equal 3, heads.size
|
|
275
|
-
heads.each do |head|
|
|
276
|
-
assert head =~ /^[0-9a-f]{40}$/
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
assert `git show #{heads[0]}` !~
|
|
280
|
-
/^\s*commit\s+#{heads[0]}\s*$/
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
%w(redhillonrails_core acts_as_list).each do |proj|
|
|
284
|
-
puts "filethere? #{proj}: #{File.exist?(File.join('vendor', 'plugins', proj, 'lib'))}"
|
|
285
|
-
if !File.exist?(File.join('vendor', 'plugins', proj, 'lib'))
|
|
286
|
-
puts "here"
|
|
287
|
-
end
|
|
288
|
-
assert File.exist?(File.join('vendor', 'plugins', proj, 'lib'))
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
%w(redhillonrails_core).each do |proj|
|
|
292
|
-
assert !File.exist?(File.join('vendor', 'plugins',proj, '.svn'))
|
|
293
|
-
end
|
|
294
|
-
|
|
295
|
-
assert File.exist?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
|
296
|
-
|
|
297
|
-
# Check that engines subproject has content expected for edge branch
|
|
298
|
-
ext = Ext.new
|
|
299
|
-
|
|
300
|
-
assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["branch"], "edge")
|
|
301
|
-
assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["revision"], nil)
|
|
302
|
-
|
|
303
|
-
Dir.chdir File.join("vendor", "plugins", "some_subproject_with_edge") do
|
|
304
|
-
assert(File.read(File.join("lib", "somelib.rb")) =~ /living on the edge/)
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
end
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
def test_export_with_subproject_by_revision
|
|
311
|
-
# figure out the revision to set it to.
|
|
312
|
-
sub_project_revision = nil
|
|
313
|
-
sub_repository = SomeSubprojectWithEdge.new
|
|
314
|
-
sub_repository.prepare
|
|
315
|
-
|
|
316
|
-
workdir = File.join(root_dir, 'test', "tmp", "workdir", "export")
|
|
317
|
-
rm_rf_ie workdir
|
|
318
|
-
mkdir_p workdir
|
|
319
|
-
|
|
320
|
-
Dir.chdir workdir do
|
|
321
|
-
`git clone #{sub_repository.clean_dir}`
|
|
322
|
-
raise unless $? == 0
|
|
323
|
-
|
|
324
|
-
Dir.chdir sub_repository.name do
|
|
325
|
-
git_show = `git show origin/master`
|
|
326
|
-
raise unless $? == 0
|
|
327
|
-
|
|
328
|
-
sub_project_revision = /^commit:?\s*([a-f\d]+)$/.match(git_show)[1]
|
|
329
|
-
assert(sub_project_revision =~ /^[a-f\d]+$/)
|
|
330
|
-
end
|
|
331
|
-
end
|
|
332
|
-
|
|
333
|
-
# Change the project to use a revision instead of a branch
|
|
334
|
-
repository = RailsAppSvnRepository.new
|
|
335
|
-
repository.prepare
|
|
336
|
-
repository.mark_dirty
|
|
337
|
-
|
|
338
|
-
rm_rf_ie workdir
|
|
339
|
-
mkdir_p workdir
|
|
340
|
-
|
|
341
|
-
Dir.chdir workdir do
|
|
342
|
-
Ext.run "checkout", "--svn", repository.clean_url
|
|
343
|
-
|
|
344
|
-
Dir.chdir repository.name do
|
|
345
|
-
assert(sub_project_revision)
|
|
346
|
-
Ext.run "freeze", "some_subproject_with_edge", sub_project_revision
|
|
347
|
-
ext = Ext.new
|
|
348
|
-
ext.configuration["vendor/plugins/some_subproject_with_edge"].rm_setting("branch")
|
|
349
|
-
ext.configuration.write
|
|
350
|
-
|
|
351
|
-
SvnProject.add_all
|
|
352
|
-
`svn commit -m "changed some_subproject_with_edge to use a revision instead"`
|
|
353
|
-
raise unless $? == 0
|
|
354
|
-
end
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
rm_rf_ie workdir
|
|
358
|
-
mkdir_p workdir
|
|
359
|
-
Dir.chdir workdir do
|
|
360
|
-
source = repository.clean_url
|
|
361
|
-
|
|
362
|
-
puts "About to export #{source}"
|
|
363
|
-
Ext.run "export", "--svn", source, 'rails_app'
|
|
364
|
-
|
|
365
|
-
Dir.chdir 'rails_app' do
|
|
366
|
-
assert !File.exist?('.svn')
|
|
367
|
-
|
|
368
|
-
# Check that engines subproject has content expected for sub_project_revision
|
|
369
|
-
ext = Ext.new
|
|
370
|
-
|
|
371
|
-
assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["branch"], nil)
|
|
372
|
-
assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["revision"], sub_project_revision)
|
|
373
|
-
|
|
374
|
-
Dir.chdir File.join("vendor", "plugins", "some_subproject_with_edge") do
|
|
375
|
-
assert(File.read(File.join("lib", "somelib.rb")) !~ /living on the edge/)
|
|
376
|
-
assert(File.read(File.join("lib", "somelib.rb")) =~ /'double lulz!'/)
|
|
377
|
-
end
|
|
378
|
-
end
|
|
379
|
-
end
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
end
|
|
383
|
-
end
|
|
384
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),'..','lib') if $0 == __FILE__
|
|
2
|
-
|
|
3
|
-
require 'ext_test_case'
|
|
4
|
-
require 'externals/ext'
|
|
5
|
-
|
|
6
|
-
module Externals
|
|
7
|
-
module Test
|
|
8
|
-
class TestFileUtilsExtensions < ::Test::Unit::TestCase
|
|
9
|
-
include ExtTestCase
|
|
10
|
-
|
|
11
|
-
def test_dir_empty
|
|
12
|
-
workdir = File.join root_dir, "test", "tmp", "extensions", "file_utils"
|
|
13
|
-
rm_rf_ie workdir
|
|
14
|
-
|
|
15
|
-
!dir_empty? workdir
|
|
16
|
-
|
|
17
|
-
mkdir_p workdir
|
|
18
|
-
|
|
19
|
-
assert dir_empty?(workdir)
|
|
20
|
-
somefile = File.join(workdir, "somefile")
|
|
21
|
-
touch somefile
|
|
22
|
-
assert !dir_empty?(workdir)
|
|
23
|
-
|
|
24
|
-
rm_rf somefile
|
|
25
|
-
assert dir_empty? workdir
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|