ext 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT_LICENSE.txt +1 -1
- data/Rakefile +3 -3
- data/lib/externals/scms/git_project.rb +8 -4
- data/lib/externals/scms/svn_project.rb +9 -5
- data/test/test_checkout_with_subprojects_svn.rb +100 -0
- metadata +35 -6
data/MIT_LICENSE.txt
CHANGED
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ task :prep_test do
|
|
15
15
|
puts `rm -rf cleanreps`
|
16
16
|
Dir.mkdir('cleanreps')
|
17
17
|
Dir.chdir('cleanreps') do
|
18
|
-
%w(redhillonrails_core foreign_key_migrations).each do |p|
|
18
|
+
%w(redhillonrails_core foreign_key_migrations empty_plugin).each do |p|
|
19
19
|
puts `cp ../setup/#{p}.svn.gz .`
|
20
20
|
puts `gzip -d #{p}.svn.gz`
|
21
21
|
puts `svnadmin create #{p}`
|
@@ -24,7 +24,7 @@ task :prep_test do
|
|
24
24
|
|
25
25
|
puts `git clone --bare git://github.com/azimux/engines.git engines.git`
|
26
26
|
|
27
|
-
%w(acts_as_list).each do |p|
|
27
|
+
%w(acts_as_list ssl_requirement).each do |p|
|
28
28
|
puts `git clone --bare git://github.com/rails/#{p}.git #{p}.git`
|
29
29
|
end
|
30
30
|
|
@@ -87,7 +87,7 @@ end
|
|
87
87
|
|
88
88
|
gem_specification = Gem::Specification.new do |specification|
|
89
89
|
specification.name = 'ext'
|
90
|
-
specification.version = '0.1.
|
90
|
+
specification.version = '0.1.4'
|
91
91
|
specification.platform = Gem::Platform::RUBY
|
92
92
|
specification.rubyforge_project = 'ext'
|
93
93
|
|
@@ -62,9 +62,13 @@ module Externals
|
|
62
62
|
if revision
|
63
63
|
change_to_branch_revision
|
64
64
|
else
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
if File.exists? path
|
66
|
+
puts "updating #{path}:"
|
67
|
+
Dir.chdir path do
|
68
|
+
puts `git pull`
|
69
|
+
end
|
70
|
+
else
|
71
|
+
co(*args)
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
@@ -145,7 +149,7 @@ module Externals
|
|
145
149
|
if ir.size - rows.size != 1
|
146
150
|
raise "More than one row found matching #{path} in .gitignore"
|
147
151
|
end
|
148
|
-
|
152
|
+
|
149
153
|
open('.gitignore', 'w') do |f|
|
150
154
|
f.write "#{rows.compact.join("\n")}\n"
|
151
155
|
end
|
@@ -43,9 +43,13 @@ module Externals
|
|
43
43
|
if revision
|
44
44
|
change_to_revision
|
45
45
|
else
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
if File.exists? path
|
47
|
+
puts "updating #{path}:"
|
48
|
+
Dir.chdir path do
|
49
|
+
puts `svn up .`
|
50
|
+
end
|
51
|
+
else
|
52
|
+
co(*args)
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
@@ -124,7 +128,7 @@ module Externals
|
|
124
128
|
if ir.size - rows.size != 1
|
125
129
|
raise "More than one row found matching #{path} in svn propget svn:ignore"
|
126
130
|
end
|
127
|
-
|
131
|
+
|
128
132
|
Dir.chdir(parent) do
|
129
133
|
puts `svn propset svn:ignore "#{rows.compact.join("\n")}\n" .`
|
130
134
|
end
|
@@ -134,7 +138,7 @@ module Externals
|
|
134
138
|
rows = ignore_text(path).split(/\n/)
|
135
139
|
|
136
140
|
rows.delete_if {|row| row =~ /^\s*$/}
|
137
|
-
|
141
|
+
|
138
142
|
rows
|
139
143
|
end
|
140
144
|
|
@@ -130,6 +130,106 @@ module Externals
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
+
def test_update_with_missing_subproject_git
|
134
|
+
Dir.chdir File.join(root_dir, 'test') do
|
135
|
+
Dir.chdir 'workdir' do
|
136
|
+
`mkdir update`
|
137
|
+
Dir.chdir 'update' do
|
138
|
+
source = repository_dir('svn')
|
139
|
+
|
140
|
+
if windows?
|
141
|
+
source = source.gsub(/\\/, "/")
|
142
|
+
end
|
143
|
+
source = "file:///#{source}"
|
144
|
+
|
145
|
+
|
146
|
+
puts "About to checkout #{source}"
|
147
|
+
Ext.run "checkout", "--svn", source, 'rails_app'
|
148
|
+
|
149
|
+
Dir.chdir 'rails_app' do
|
150
|
+
pretests = proc do
|
151
|
+
assert File.exists?('.svn')
|
152
|
+
assert !File.exists?(File.join('vendor', 'plugins', 'ssl_requirement', 'lib'))
|
153
|
+
assert File.read(".externals") =~ /rails/
|
154
|
+
assert File.read(".externals") !~ /ssl_requirement/
|
155
|
+
end
|
156
|
+
|
157
|
+
pretests.call
|
158
|
+
|
159
|
+
#add a project
|
160
|
+
Dir.chdir File.join(root_dir, 'test') do
|
161
|
+
Dir.chdir File.join('workdir', "rails_app") do
|
162
|
+
#install a new project
|
163
|
+
Ext.run "install", File.join(root_dir, 'test', 'cleanreps', 'ssl_requirement.git')
|
164
|
+
|
165
|
+
SvnProject.add_all
|
166
|
+
|
167
|
+
puts `svn commit -m "added another subproject (ssl_requirement)"`
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
pretests.call
|
172
|
+
|
173
|
+
#update the project and make sure ssl_requirement was added and checked out
|
174
|
+
Ext.run "update"
|
175
|
+
assert File.read(".externals") =~ /ssl_requirement/
|
176
|
+
assert File.exists?(File.join('vendor', 'plugins', 'ssl_requirement', 'lib'))
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_update_with_missing_subproject_svn
|
184
|
+
Dir.chdir File.join(root_dir, 'test') do
|
185
|
+
Dir.chdir 'workdir' do
|
186
|
+
`mkdir update`
|
187
|
+
Dir.chdir 'update' do
|
188
|
+
source = repository_dir('svn')
|
189
|
+
|
190
|
+
if windows?
|
191
|
+
source = source.gsub(/\\/, "/")
|
192
|
+
end
|
193
|
+
source = "file:///#{source}"
|
194
|
+
|
195
|
+
|
196
|
+
puts "About to checkout #{source}"
|
197
|
+
Ext.run "checkout", "--svn", source, 'rails_app'
|
198
|
+
|
199
|
+
Dir.chdir 'rails_app' do
|
200
|
+
pretests = proc do
|
201
|
+
assert File.exists?('.svn')
|
202
|
+
assert !File.exists?(File.join('vendor', 'plugins', 'empty_plugin', 'lib'))
|
203
|
+
assert File.read(".externals") =~ /rails/
|
204
|
+
assert File.read(".externals") !~ /empty_plugin/
|
205
|
+
end
|
206
|
+
|
207
|
+
pretests.call
|
208
|
+
|
209
|
+
#add a project
|
210
|
+
Dir.chdir File.join(root_dir, 'test') do
|
211
|
+
Dir.chdir File.join('workdir', "rails_app") do
|
212
|
+
#install a new project
|
213
|
+
Ext.run "install", "--svn", "file:///#{File.join(root_dir, 'test', 'cleanreps', 'empty_plugin')}"
|
214
|
+
|
215
|
+
SvnProject.add_all
|
216
|
+
|
217
|
+
puts `svn commit -m "added another subproject (empty_plugin)"`
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
pretests.call
|
222
|
+
|
223
|
+
#update the project and make sure ssl_requirement was added and checked out
|
224
|
+
Ext.run "update"
|
225
|
+
assert File.read(".externals") =~ /empty_plugin/
|
226
|
+
assert File.exists?(File.join('vendor', 'plugins', 'empty_plugin', 'lib'))
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
133
233
|
def test_export_with_subproject
|
134
234
|
Dir.chdir File.join(root_dir, 'test') do
|
135
235
|
Dir.chdir 'workdir' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -9,11 +9,38 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02
|
12
|
+
date: 2009-10-02 00:00:00 -07:00
|
13
13
|
default_executable: ext
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: |-
|
17
|
+
Provides an SCM agnostic way to manage subprojects with a workflow similar
|
18
|
+
to the scm:externals feature of subversion. It's particularly useful for rails
|
19
|
+
projects that have some plugins managed by svn and some managed by git.
|
20
|
+
|
21
|
+
For example, "ext install git://github.com/rails/rails.git" from within a rails
|
22
|
+
application directory will realize that this belongs in the vendor/rails folder.
|
23
|
+
It will also realize that this URL is a git repository and clone it into that
|
24
|
+
folder.
|
25
|
+
|
26
|
+
It will also add the vendor/rails folder to the ignore feature for the SCM of
|
27
|
+
the main project. Let's say that the main project is being managed by
|
28
|
+
subversion. In that case it adds "rails" to the svn:ignore property of the
|
29
|
+
vendor folder. It also adds the URL to the .externals file so that when this
|
30
|
+
project is checked out via "ext checkout" it knows where to fetch the
|
31
|
+
subprojects.
|
32
|
+
|
33
|
+
There are several other useful commands, such as init, touch_emptydirs, add_all,
|
34
|
+
export, status. There's a tutorial at http://nopugs.com/ext-tutorial
|
35
|
+
|
36
|
+
The reason I made this project is that I was frustrated by two things:
|
37
|
+
|
38
|
+
1. In my opinion, the workflow for svn:externals is far superior to
|
39
|
+
git-submodule.
|
40
|
+
|
41
|
+
2. Even if git-submodule was as useful as svn:externals, I would still like a
|
42
|
+
uniform way to fetch all of the subprojects regardless of the SCM used to manage
|
43
|
+
the main project.
|
17
44
|
email: azimux@gmail.com
|
18
45
|
executables:
|
19
46
|
- ext
|
@@ -39,8 +66,10 @@ files:
|
|
39
66
|
- lib/externals/scms/git_project.rb
|
40
67
|
- lib/externals/scms/svn_project.rb
|
41
68
|
- lib/externals/test_case.rb
|
42
|
-
has_rdoc:
|
69
|
+
has_rdoc: true
|
43
70
|
homepage: http://nopugs.com/ext-tutorial
|
71
|
+
licenses: []
|
72
|
+
|
44
73
|
post_install_message:
|
45
74
|
rdoc_options: []
|
46
75
|
|
@@ -61,9 +90,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
90
|
requirements: []
|
62
91
|
|
63
92
|
rubyforge_project: ext
|
64
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.3.4
|
65
94
|
signing_key:
|
66
|
-
specification_version:
|
95
|
+
specification_version: 3
|
67
96
|
summary: Provides an SCM agnostic way to manage subprojects with a workflow similar to the svn:externals feature of subversion. It's particularly useful for rails projects that have some plugins managed by svn and some managed by git.
|
68
97
|
test_files:
|
69
98
|
- test/test_checkout_git.rb
|