ext 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/Rakefile +4 -2
- data/bin/ext +2 -1
- data/lib/externals/configuration/configuration.rb +0 -22
- data/lib/externals/ext.rb +12 -4
- data/lib/externals/project_types/rails.rb +4 -4
- data/lib/externals/scms/git_project.rb +6 -6
- data/lib/externals/scms/svn_project.rb +6 -6
- data/test/test_checkout_with_subprojects_svn.rb +66 -0
- data/test/test_version.rb +31 -0
- metadata +16 -14
data/CHANGELOG
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
1/3/2010 Version 1.6 released
|
2
|
+
- Fixes a problem that can occur if ext is symlinked (thanks to Olmo Maldonado)
|
3
|
+
- Added --version command line option
|
4
|
+
|
5
|
+
12/20/2009
|
6
|
+
- Fix for a bug when a subproject frozen to a revision is missing during
|
7
|
+
an update (thanks to Lane Roathe)
|
data/Rakefile
CHANGED
@@ -6,6 +6,8 @@ require 'find'
|
|
6
6
|
|
7
7
|
root_dir = File.dirname(__FILE__)
|
8
8
|
|
9
|
+
require File.join(root_dir, 'lib', 'externals', 'ext')
|
10
|
+
|
9
11
|
desc "Creates the starting repositories needed to run the tests.
|
10
12
|
If you plan on running the tests, you only need
|
11
13
|
to run this once."
|
@@ -87,7 +89,7 @@ end
|
|
87
89
|
|
88
90
|
gem_specification = Gem::Specification.new do |specification|
|
89
91
|
specification.name = 'ext'
|
90
|
-
specification.version =
|
92
|
+
specification.version = Externals::VERSION
|
91
93
|
specification.platform = Gem::Platform::RUBY
|
92
94
|
specification.rubyforge_project = 'ext'
|
93
95
|
|
@@ -134,7 +136,7 @@ the main project.}
|
|
134
136
|
specification.executables = ['ext']
|
135
137
|
specification.default_executable = "ext"
|
136
138
|
|
137
|
-
specification.files = ['Rakefile', 'README', 'MIT_LICENSE.txt'] +
|
139
|
+
specification.files = ['Rakefile', 'README', 'MIT_LICENSE.txt', 'CHANGELOG'] +
|
138
140
|
FileList['lib/**/*.rb']
|
139
141
|
#specification.require_path = 'lib'
|
140
142
|
end
|
data/bin/ext
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
3
|
+
$:.unshift(File.join(File.dirname(THIS_FILE), '..', 'lib'))
|
3
4
|
require 'externals/ext'
|
4
5
|
|
5
6
|
Externals::Ext.run(*ARGV)
|
@@ -90,24 +90,6 @@ module Externals
|
|
90
90
|
set_setting(key, value)
|
91
91
|
end
|
92
92
|
|
93
|
-
|
94
|
-
# def projects
|
95
|
-
# return @projects if @projects
|
96
|
-
#
|
97
|
-
# @projects = []
|
98
|
-
#
|
99
|
-
# if main?
|
100
|
-
# @projects = [Ext.project_class(self['scm']).new(".", :is_main)]
|
101
|
-
# else
|
102
|
-
# rows.each do |row|
|
103
|
-
# if Project.project_line?(row)
|
104
|
-
# @projects << Ext.project_class(title).new(row)
|
105
|
-
# end
|
106
|
-
# end
|
107
|
-
# @projects
|
108
|
-
# end
|
109
|
-
# end
|
110
|
-
|
111
93
|
def add_row(row)
|
112
94
|
rows << row
|
113
95
|
|
@@ -115,10 +97,6 @@ module Externals
|
|
115
97
|
#clear_caches
|
116
98
|
end
|
117
99
|
|
118
|
-
# def clear_caches
|
119
|
-
# @projects = nil
|
120
|
-
# end
|
121
|
-
|
122
100
|
def to_s
|
123
101
|
"[#{title}]\n#{rows.join("\n")}"
|
124
102
|
end
|
data/lib/externals/ext.rb
CHANGED
@@ -10,7 +10,7 @@ module Externals
|
|
10
10
|
#exit status
|
11
11
|
OBSOLETE_EXTERNALS_FILE = 15
|
12
12
|
|
13
|
-
|
13
|
+
VERSION = '0.1.6'
|
14
14
|
PROJECT_TYPES_DIRECTORY = File.join(File.dirname(__FILE__), '..', 'externals','project_types')
|
15
15
|
|
16
16
|
# Full commands operate on the main project as well as the externals
|
@@ -72,7 +72,7 @@ module Externals
|
|
72
72
|
maintaining .externals"],
|
73
73
|
[:upgrade_externals_file, "Converts the old format that stored
|
74
74
|
as [main][svn][git] to [<path1>][<path2>]..."],
|
75
|
-
|
75
|
+
[:version, "Displays the version number of externals and exits."],
|
76
76
|
]
|
77
77
|
|
78
78
|
|
@@ -150,10 +150,13 @@ module Externals
|
|
150
150
|
}
|
151
151
|
opts.on("--help", "does the same as 'ext help' If you use this with a command
|
152
152
|
it will ignore the command and run help instead.") {main_options[:help] = true}
|
153
|
+
opts.on("--version", "Displays the version number of externals and then exits.
|
154
|
+
Same as 'ext version'") {
|
155
|
+
main_options[:version] = true
|
156
|
+
}
|
153
157
|
end
|
154
158
|
|
155
159
|
def self.run *arguments
|
156
|
-
|
157
160
|
main_options = {}
|
158
161
|
sub_options = {}
|
159
162
|
|
@@ -169,6 +172,7 @@ module Externals
|
|
169
172
|
command &&= command.to_sym
|
170
173
|
|
171
174
|
command = :help if main_options[:help]
|
175
|
+
command = :version if main_options[:version]
|
172
176
|
|
173
177
|
if !command || command.to_s == ''
|
174
178
|
puts "hey... you didn't tell me what you want to do."
|
@@ -186,7 +190,7 @@ module Externals
|
|
186
190
|
Dir.chdir(main_options[:workdir] || ".") do
|
187
191
|
if command == :upgrade_externals_file
|
188
192
|
main_options[:upgrade_externals_file] = true
|
189
|
-
elsif command != :help
|
193
|
+
elsif command != :help && command != :version
|
190
194
|
if externals_file_obsolete?
|
191
195
|
puts "your .externals file Appears to be in an obsolete format"
|
192
196
|
puts "Please run 'ext upgrade_externals_file' to migrate it to the new format"
|
@@ -715,6 +719,10 @@ Please use the --type option to tell ext which to use."
|
|
715
719
|
config.write('.externals')
|
716
720
|
end
|
717
721
|
|
722
|
+
def version(args, options)
|
723
|
+
puts Externals::VERSION
|
724
|
+
end
|
725
|
+
|
718
726
|
def self.project_type_detector name
|
719
727
|
Externals.module_eval("#{name.classify}Detector", __FILE__, __LINE__)
|
720
728
|
end
|
@@ -4,7 +4,7 @@ module Externals
|
|
4
4
|
#obj.send(:extend, Externals::RailsProjectType::Project)
|
5
5
|
Externals::OldProject.send(:include, Externals::RailsProjectType::Project)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
class DefaultPathCalculator
|
9
9
|
def default_path name
|
10
10
|
if name
|
@@ -14,7 +14,7 @@ module Externals
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
module Project
|
19
19
|
def default_path
|
20
20
|
if name
|
@@ -25,8 +25,8 @@ module Externals
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
|
-
|
28
|
+
|
29
|
+
|
30
30
|
class RailsDetector
|
31
31
|
def self.detected?
|
32
32
|
boot_path = File.join('config','boot.rb')
|
@@ -59,17 +59,17 @@ module Externals
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def up *args
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
if File.exists? path
|
63
|
+
if revision
|
64
|
+
change_to_branch_revision
|
65
|
+
else
|
66
66
|
puts "updating #{path}:"
|
67
67
|
Dir.chdir path do
|
68
68
|
puts `git pull`
|
69
69
|
end
|
70
|
-
else
|
71
|
-
co(*args)
|
72
70
|
end
|
71
|
+
else
|
72
|
+
co(*args)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -40,17 +40,17 @@ module Externals
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def up *args
|
43
|
-
if
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
if File.exists? path
|
44
|
+
if revision
|
45
|
+
change_to_revision
|
46
|
+
else
|
47
47
|
puts "updating #{path}:"
|
48
48
|
Dir.chdir path do
|
49
49
|
puts `svn up .`
|
50
50
|
end
|
51
|
-
else
|
52
|
-
co(*args)
|
53
51
|
end
|
52
|
+
else
|
53
|
+
co(*args)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -180,6 +180,72 @@ module Externals
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
+
def test_update_with_missing_subproject_by_revision_git
|
184
|
+
subproject = "ssl_requirement"
|
185
|
+
revision = "aa2dded823f8a9b378c22ba0159971508918928a"
|
186
|
+
|
187
|
+
Dir.chdir File.join(root_dir, 'test') do
|
188
|
+
Dir.chdir 'workdir' do
|
189
|
+
`mkdir update`
|
190
|
+
Dir.chdir 'update' do
|
191
|
+
source = repository_dir('svn')
|
192
|
+
|
193
|
+
if windows?
|
194
|
+
source = source.gsub(/\\/, "/")
|
195
|
+
end
|
196
|
+
source = "file:///#{source}"
|
197
|
+
|
198
|
+
|
199
|
+
puts "About to checkout #{source}"
|
200
|
+
Ext.run "checkout", "--svn", source, 'rails_app'
|
201
|
+
|
202
|
+
Dir.chdir 'rails_app' do
|
203
|
+
pretests = proc do
|
204
|
+
assert File.exists?('.svn')
|
205
|
+
assert !File.exists?(File.join('vendor', 'plugins', subproject, 'lib'))
|
206
|
+
assert File.read(".externals") =~ /rails/
|
207
|
+
assert File.read(".externals") !~ /#{subproject}/
|
208
|
+
end
|
209
|
+
|
210
|
+
pretests.call
|
211
|
+
|
212
|
+
#add a project
|
213
|
+
Dir.chdir File.join(root_dir, 'test') do
|
214
|
+
Dir.chdir File.join('workdir', "rails_app") do
|
215
|
+
#install a new project
|
216
|
+
Ext.run "install", File.join(root_dir, 'test', 'cleanreps', "#{subproject}.git")
|
217
|
+
Dir.chdir File.join("vendor",'plugins', subproject) do
|
218
|
+
assert `git show HEAD` !~ /^\s*commit\s*#{revision}\s*$/i
|
219
|
+
end
|
220
|
+
#freeze it to a revision
|
221
|
+
Ext.run "freeze", subproject, revision
|
222
|
+
Dir.chdir File.join("vendor",'plugins', subproject) do
|
223
|
+
assert `git show HEAD` =~ /^\s*commit\s*#{revision}\s*$/i
|
224
|
+
end
|
225
|
+
|
226
|
+
SvnProject.add_all
|
227
|
+
|
228
|
+
puts `svn commit -m "added another subproject (#{subproject}) frozen to #{revision}"`
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
pretests.call
|
233
|
+
|
234
|
+
#update the project and make sure ssl_requirement was added and checked out at the right revision
|
235
|
+
Ext.run "update"
|
236
|
+
assert File.read(".externals") =~ /ssl_requirement/
|
237
|
+
|
238
|
+
assert File.exists?(File.join('vendor', 'plugins', subproject, 'lib'))
|
239
|
+
|
240
|
+
Dir.chdir File.join("vendor",'plugins', subproject) do
|
241
|
+
assert `git show HEAD` =~ /^\s*commit\s*#{revision}\s*$/i
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
183
249
|
def test_update_with_missing_subproject_svn
|
184
250
|
Dir.chdir File.join(root_dir, 'test') do
|
185
251
|
Dir.chdir 'workdir' do
|
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
+
require 'externals/test_case'
|
3
|
+
require 'externals/ext'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
module Externals
|
7
|
+
class TestVersion < TestCase
|
8
|
+
include ExtTestCase
|
9
|
+
|
10
|
+
def test_version
|
11
|
+
version_regex = /(?:[^\.\d]|^)(\d+\.\d+\.\d+)(?:[^\.\d]|$)/
|
12
|
+
|
13
|
+
assert Externals::VERSION =~ version_regex
|
14
|
+
|
15
|
+
["version", "--version"].each do |options|
|
16
|
+
out = StringIO.new
|
17
|
+
old_stdout = $stdout
|
18
|
+
|
19
|
+
begin
|
20
|
+
$stdout = out
|
21
|
+
Ext.run options
|
22
|
+
ensure
|
23
|
+
$stdout = old_stdout
|
24
|
+
end
|
25
|
+
|
26
|
+
assert(out.string =~ version_regex)
|
27
|
+
assert_equal $1, Externals::VERSION.strip
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-03 00:00:00 -08:00
|
13
13
|
default_executable: ext
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -52,20 +52,21 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- README
|
54
54
|
- MIT_LICENSE.txt
|
55
|
+
- CHANGELOG
|
55
56
|
- lib/extensions/string.rb
|
56
57
|
- lib/extensions/symbol.rb
|
57
|
-
- lib/externals/
|
58
|
-
- lib/externals/configuration/configuration.rb
|
59
|
-
- lib/externals/configuration/old_configuration.rb
|
60
|
-
- lib/externals/ext.rb
|
58
|
+
- lib/externals/project_types/rails.rb
|
61
59
|
- lib/externals/old_project.rb
|
60
|
+
- lib/externals/command.rb
|
62
61
|
- lib/externals/old_scms/old_git_project.rb
|
63
62
|
- lib/externals/old_scms/old_svn_project.rb
|
64
63
|
- lib/externals/project.rb
|
65
|
-
- lib/externals/
|
64
|
+
- lib/externals/configuration/configuration.rb
|
65
|
+
- lib/externals/configuration/old_configuration.rb
|
66
|
+
- lib/externals/test_case.rb
|
66
67
|
- lib/externals/scms/git_project.rb
|
67
68
|
- lib/externals/scms/svn_project.rb
|
68
|
-
- lib/externals/
|
69
|
+
- lib/externals/ext.rb
|
69
70
|
has_rdoc: true
|
70
71
|
homepage: http://nopugs.com/ext-tutorial
|
71
72
|
licenses: []
|
@@ -90,17 +91,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
91
|
requirements: []
|
91
92
|
|
92
93
|
rubyforge_project: ext
|
93
|
-
rubygems_version: 1.3.
|
94
|
+
rubygems_version: 1.3.5
|
94
95
|
signing_key:
|
95
96
|
specification_version: 3
|
96
97
|
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.
|
97
98
|
test_files:
|
99
|
+
- test/test_rails_detection.rb
|
100
|
+
- test/test_string_extensions.rb
|
101
|
+
- test/test_version.rb
|
102
|
+
- test/test_init_git.rb
|
103
|
+
- test/test_upgrade_externals_file.rb
|
98
104
|
- test/test_checkout_git.rb
|
99
|
-
- test/test_checkout_with_subprojects_git.rb
|
100
105
|
- test/test_checkout_with_subprojects_svn.rb
|
101
106
|
- test/test_freeze_to_revision.rb
|
102
|
-
- test/
|
103
|
-
- test/test_rails_detection.rb
|
104
|
-
- test/test_string_extensions.rb
|
107
|
+
- test/test_checkout_with_subprojects_git.rb
|
105
108
|
- test/test_touch_emptydirs.rb
|
106
|
-
- test/test_upgrade_externals_file.rb
|