ext 0.1.2 → 0.1.3
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/README +28 -16
- data/Rakefile +54 -5
- data/lib/externals/configuration/configuration.rb +11 -4
- data/lib/externals/ext.rb +42 -13
- data/lib/externals/project.rb +17 -0
- data/lib/externals/scms/git_project.rb +29 -5
- data/lib/externals/scms/svn_project.rb +29 -3
- data/test/test_checkout_with_subprojects_git.rb +45 -15
- data/test/test_checkout_with_subprojects_svn.rb +52 -10
- data/test/test_freeze_to_revision.rb +4 -5
- metadata +2 -2
data/README
CHANGED
@@ -21,6 +21,7 @@ forms apply the action to all sub projects.
|
|
21
21
|
|
22
22
|
The commands and usage are as follows (from 'ext help'):
|
23
23
|
There's a tutorial available at http://nopugs.com/ext-tutorial
|
24
|
+
There's a tutorial available at http://nopugs.com/ext-tutorial
|
24
25
|
|
25
26
|
ext [OPTIONS] <command> [repository] [-b <branch>] [path]
|
26
27
|
-g, --git same as '--scm git' Uses git to checkout/export the main project
|
@@ -28,6 +29,7 @@ ext [OPTIONS] <command> [repository] [-b <branch>] [path]
|
|
28
29
|
-t, --type TYPE The type of project the main project is. For example, 'rails'.
|
29
30
|
--scm SCM The SCM used to manage the main project. For example, '--scm svn'.
|
30
31
|
-b, --branch BRANCH The branch you want the subproject to checkout when doing 'ext install'
|
32
|
+
-f, --force_removal When doing an uninstall of a subproject, remove it's files and subfolders, too.
|
31
33
|
-w, --workdir DIR The working directory to execute commands from. Use this if for some reason you
|
32
34
|
cannot execute ext from the main project's directory (or if it's just inconvenient, such as in a script
|
33
35
|
or in a Capistrano task)
|
@@ -37,27 +39,17 @@ ext [OPTIONS] <command> [repository] [-b <branch>] [path]
|
|
37
39
|
|
38
40
|
|
39
41
|
Commands that apply to the main project or the .externals file:
|
40
|
-
|
42
|
+
freeze, help, init, install, touch_emptydirs, uninstall, update_ignore, upgrade_externals_file
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
main project. This is automatically performed by install,
|
45
|
-
and so you probably only will run this if you are manually
|
46
|
-
maintaining .externals
|
47
|
-
|
48
|
-
install Usage: ext install <repository> [-b <branch>] [path]
|
49
|
-
Registers <repository> in .externals under the appropriate
|
50
|
-
SCM. Checks out the project, and also adds it to the ignore
|
51
|
-
feature offered by the SCM of the main project. If the SCM
|
52
|
-
type is not obvious from the repository URL, use the --scm,
|
53
|
-
--git, or --svn flags.
|
54
|
-
|
55
|
-
freeze ext freeze project [REVISION]
|
44
|
+
freeze Usage: ext freeze project [REVISION]
|
45
|
+
|
56
46
|
Locks a subproject into a specific revision/branch. If no
|
57
47
|
revision is supplied, the current revision/branch of the
|
58
48
|
project will be used. You can specify the project by name
|
59
49
|
or path.
|
60
50
|
|
51
|
+
help You probably just ran this command just now.
|
52
|
+
|
61
53
|
init Creates a .externals file containing only [main]
|
62
54
|
It will try to determine the SCM used by the main project,
|
63
55
|
as well as the project type. You don't have to specify
|
@@ -65,12 +57,29 @@ init Creates a .externals file containing only [main]
|
|
65
57
|
isn't supported. It just means that when using 'install'
|
66
58
|
that you'll want to specify the path.
|
67
59
|
|
60
|
+
install Usage: ext install <repository> [-b <branch>] [path]
|
61
|
+
Registers <repository> in .externals under the appropriate
|
62
|
+
SCM. Checks out the project, and also adds it to the ignore
|
63
|
+
feature offered by the SCM of the main project. If the SCM
|
64
|
+
type is not obvious from the repository URL, use the --scm,
|
65
|
+
--git, or --svn flags.
|
66
|
+
|
68
67
|
touch_emptydirs Recurses through all directories from the
|
69
68
|
top and adds a .emptydir file to any empty directories it
|
70
69
|
comes across. Useful for dealing with SCMs that refuse to
|
71
70
|
track empty directories (such as git, for example)
|
72
71
|
|
73
|
-
|
72
|
+
uninstall Usage: ext uninstall [-f|--force_removal] <project>
|
73
|
+
Removes a subproject from being tracked by ext. If you
|
74
|
+
want the files associated with this subproject deleted as well
|
75
|
+
(if, for example, you wish to reinstall it from a different
|
76
|
+
repository) then you can use the -f option to remove the files.
|
77
|
+
|
78
|
+
update_ignore Adds all paths to subprojects that are
|
79
|
+
registered in .externals to the ignore feature of the
|
80
|
+
main project. This is automatically performed by install,
|
81
|
+
and so you probably only will run this if you are manually
|
82
|
+
maintaining .externals
|
74
83
|
|
75
84
|
upgrade_externals_fileConverts the old format that stored
|
76
85
|
as [main][svn][git] to [<path1>][<path2>]...
|
@@ -107,8 +116,11 @@ co, ex, st, up
|
|
107
116
|
|
108
117
|
co Like checkout, but skips the main project and
|
109
118
|
only checks out subprojects.
|
119
|
+
|
110
120
|
ex Like export, but skips the main project.
|
121
|
+
|
111
122
|
st Like status, but skips the main project.
|
123
|
+
|
112
124
|
up Like update, but skips the main project.
|
113
125
|
|
114
126
|
The externals project is copyright 2008 by Miles Georgi, nopugs.com, azimux.com
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@ require 'rake'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
require 'rake/gempackagetask'
|
5
|
+
require 'find'
|
5
6
|
|
6
7
|
root_dir = File.dirname(__FILE__)
|
7
8
|
|
@@ -10,7 +11,7 @@ If you plan on running the tests, you only need
|
|
10
11
|
to run this once."
|
11
12
|
task :prep_test do
|
12
13
|
Dir.chdir File.join(root_dir, 'test') do
|
13
|
-
|
14
|
+
|
14
15
|
puts `rm -rf cleanreps`
|
15
16
|
Dir.mkdir('cleanreps')
|
16
17
|
Dir.chdir('cleanreps') do
|
@@ -21,11 +22,59 @@ task :prep_test do
|
|
21
22
|
puts `svnadmin load #{p} < #{p}.svn`
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
+
puts `git clone --bare git://github.com/azimux/engines.git engines.git`
|
26
|
+
|
27
|
+
%w(acts_as_list).each do |p|
|
25
28
|
puts `git clone --bare git://github.com/rails/#{p}.git #{p}.git`
|
26
29
|
end
|
27
|
-
|
28
|
-
|
30
|
+
|
31
|
+
if File.exists? 'C:\\tmp\\rails'
|
32
|
+
puts `cp -a C:\\tmp\\rails full_rails`
|
33
|
+
elsif File.exists? '/tmp/rails'
|
34
|
+
puts `cp -a /tmp/rails full_rails`
|
35
|
+
else
|
36
|
+
puts `git clone git://github.com/rails/rails.git full_rails`
|
37
|
+
end
|
38
|
+
puts `cp -a full_rails fake_rails`
|
39
|
+
|
40
|
+
#let's make the repo smaller by removing all but 1 file from each
|
41
|
+
#directory to save time
|
42
|
+
Dir.chdir 'fake_rails' do
|
43
|
+
puts `rm -rf .git`
|
44
|
+
raise "something wrong with rm" if File.exists? '.git'
|
45
|
+
end
|
46
|
+
|
47
|
+
dirs = []
|
48
|
+
Find.find('fake_rails') do |f|
|
49
|
+
dirs << f if File.directory?(f)
|
50
|
+
end
|
51
|
+
|
52
|
+
dirs.each do |dir|
|
53
|
+
files = Dir.entries(dir)
|
54
|
+
|
55
|
+
Dir.chdir(dir) do
|
56
|
+
files = files.select {|e|e != ".gitignore" && File.file?(e)}.sort
|
57
|
+
files.shift #let's keep the first file in the list.
|
58
|
+
files.each do |file|
|
59
|
+
File.delete(file)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
raise "why is rails already here?" if File.exists? 'rails.git'
|
65
|
+
|
66
|
+
Dir.mkdir('rails.git')
|
67
|
+
|
68
|
+
Dir.chdir('rails.git') do
|
69
|
+
puts `git init --bare`
|
70
|
+
end
|
71
|
+
|
72
|
+
Dir.chdir 'fake_rails' do
|
73
|
+
puts `git init`
|
74
|
+
puts `git add .`
|
75
|
+
puts `git commit -m "rails with all but 1 file per directory deleted"`
|
76
|
+
puts `git push ../rails.git master`
|
77
|
+
end
|
29
78
|
end
|
30
79
|
end
|
31
80
|
end
|
@@ -38,7 +87,7 @@ end
|
|
38
87
|
|
39
88
|
gem_specification = Gem::Specification.new do |specification|
|
40
89
|
specification.name = 'ext'
|
41
|
-
specification.version = '0.1.
|
90
|
+
specification.version = '0.1.3'
|
42
91
|
specification.platform = Gem::Platform::RUBY
|
43
92
|
specification.rubyforge_project = 'ext'
|
44
93
|
|
@@ -21,7 +21,7 @@ module Externals
|
|
21
21
|
|
22
22
|
SETTING_REGEX = /^\s*([\.\w_-]+)\s*=\s*([^#\n]*)(?:#[^\n]*)?$/
|
23
23
|
SET_SETTING_REGEX = /^(\s*(?:[\.\w_-]+)\s*=\s*)(?:[^#\n]*)(#[^\n]*)?$/
|
24
|
-
|
24
|
+
|
25
25
|
def attributes
|
26
26
|
retval = {}
|
27
27
|
rows.each do |row|
|
@@ -60,7 +60,7 @@ module Externals
|
|
60
60
|
end
|
61
61
|
value
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def rm_setting key
|
65
65
|
key = key.to_s
|
66
66
|
found = nil
|
@@ -135,7 +135,7 @@ module Externals
|
|
135
135
|
title = title.to_s
|
136
136
|
sections.detect {|section| section.title == title}
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
def []= title, hash
|
140
140
|
add_empty_section title
|
141
141
|
section = self[title]
|
@@ -144,6 +144,13 @@ module Externals
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
def remove_section sec
|
148
|
+
sec = sections.detect{|section| section.title == sec}
|
149
|
+
|
150
|
+
raise "No section found in config file for #{sec}" unless sec
|
151
|
+
sections.delete(sec)
|
152
|
+
end
|
153
|
+
|
147
154
|
def add_empty_section title
|
148
155
|
raise "Section already exists" if self[title]
|
149
156
|
sections << Section.new("[#{title.to_s}]", "")
|
@@ -207,7 +214,7 @@ module Externals
|
|
207
214
|
f.write to_s
|
208
215
|
end
|
209
216
|
end
|
210
|
-
|
217
|
+
|
211
218
|
def to_s
|
212
219
|
sections.map(&:to_s).join("\n\n")
|
213
220
|
end
|
data/lib/externals/ext.rb
CHANGED
@@ -38,35 +38,41 @@ module Externals
|
|
38
38
|
[:up, "Like update, but skips the main project."]
|
39
39
|
]
|
40
40
|
MAIN_COMMANDS_HASH = [
|
41
|
-
[:update_ignore, "Adds all paths to subprojects that are
|
42
|
-
registered in .externals to the ignore feature of the
|
43
|
-
main project. This is automatically performed by install,
|
44
|
-
and so you probably only will run this if you are manually
|
45
|
-
maintaining .externals"],
|
46
|
-
[:install, "ext install <repository> [-b <branch>] [path]",
|
47
|
-
"Registers <repository> in .externals under the appropriate
|
48
|
-
SCM. Checks out the project, and also adds it to the ignore
|
49
|
-
feature offered by the SCM of the main project. If the SCM
|
50
|
-
type is not obvious from the repository URL, use the --scm,
|
51
|
-
--git, or --svn flags."],
|
52
41
|
[:freeze, "ext freeze project [REVISION]", %{
|
53
42
|
Locks a subproject into a specific revision/branch. If no
|
54
43
|
revision is supplied, the current revision/branch of the
|
55
44
|
project will be used. You can specify the project by name
|
56
45
|
or path.}],
|
46
|
+
[:help, "You probably just ran this command just now."],
|
57
47
|
[:init, "Creates a .externals file containing only [main]
|
58
48
|
It will try to determine the SCM used by the main project,
|
59
49
|
as well as the project type. You don't have to specify
|
60
50
|
a project type if you don't want to or if your project type
|
61
51
|
isn't supported. It just means that when using 'install'
|
62
52
|
that you'll want to specify the path."],
|
53
|
+
[:install, "ext install <repository> [-b <branch>] [path]",
|
54
|
+
"Registers <repository> in .externals under the appropriate
|
55
|
+
SCM. Checks out the project, and also adds it to the ignore
|
56
|
+
feature offered by the SCM of the main project. If the SCM
|
57
|
+
type is not obvious from the repository URL, use the --scm,
|
58
|
+
--git, or --svn flags."],
|
63
59
|
[:touch_emptydirs, "Recurses through all directories from the
|
64
60
|
top and adds a .emptydir file to any empty directories it
|
65
61
|
comes across. Useful for dealing with SCMs that refuse to
|
66
62
|
track empty directories (such as git, for example)"],
|
67
|
-
[:
|
63
|
+
[:uninstall, "ext uninstall [-f|--force_removal] <project>",
|
64
|
+
"Removes a subproject from being tracked by ext. If you
|
65
|
+
want the files associated with this subproject deleted as well
|
66
|
+
(if, for example, you wish to reinstall it from a different
|
67
|
+
repository) then you can use the -f option to remove the files."],
|
68
|
+
[:update_ignore, "Adds all paths to subprojects that are
|
69
|
+
registered in .externals to the ignore feature of the
|
70
|
+
main project. This is automatically performed by install,
|
71
|
+
and so you probably only will run this if you are manually
|
72
|
+
maintaining .externals"],
|
68
73
|
[:upgrade_externals_file, "Converts the old format that stored
|
69
74
|
as [main][svn][git] to [<path1>][<path2>]..."],
|
75
|
+
|
70
76
|
]
|
71
77
|
|
72
78
|
|
@@ -133,6 +139,8 @@ module Externals
|
|
133
139
|
String) {|scm| sub_options[:scm] = main_options[:scm] = scm}
|
134
140
|
opts.on("--branch BRANCH", "-b BRANCH", "The branch you want the subproject to checkout when doing 'ext install'",
|
135
141
|
String) {|branch| sub_options[:branch] = main_options[:branch] = branch}
|
142
|
+
opts.on("--force_removal", "-f", "When doing an uninstall of a subproject, remove it's files and subfolders, too.",
|
143
|
+
String) {|branch| sub_options[:force_removal] = true}
|
136
144
|
opts.on("--workdir DIR", "-w DIR", "The working directory to execute commands from. Use this if for some reason you
|
137
145
|
cannot execute ext from the main project's directory (or if it's just inconvenient, such as in a script
|
138
146
|
or in a Capistrano task)",
|
@@ -286,7 +294,7 @@ module Externals
|
|
286
294
|
configuration
|
287
295
|
end
|
288
296
|
|
289
|
-
def initialize options
|
297
|
+
def initialize options = {}
|
290
298
|
super()
|
291
299
|
|
292
300
|
if options[:upgrade_externals_file]
|
@@ -458,6 +466,27 @@ that you are installing. Use an option to specify it
|
|
458
466
|
update_ignore args, orig_options
|
459
467
|
end
|
460
468
|
|
469
|
+
def uninstall args, options
|
470
|
+
#init args, options unless File.exists? '.externals'
|
471
|
+
raise "Hmm... there's no .externals file in this directory." if !File.exists? '.externals'
|
472
|
+
|
473
|
+
project = subproject_by_name_or_path(args[0])
|
474
|
+
|
475
|
+
raise "No such project named #{args[0]}" unless project
|
476
|
+
|
477
|
+
main_project.drop_from_ignore project.path
|
478
|
+
|
479
|
+
|
480
|
+
configuration.remove_section(project.path)
|
481
|
+
configuration.write '.externals'
|
482
|
+
|
483
|
+
if options[:force_removal]
|
484
|
+
Dir.chdir File.dirname(project.path) do
|
485
|
+
`rm -rf #{File.basename(project.path)}`
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
461
490
|
def update_ignore args, options
|
462
491
|
#path = args[0]
|
463
492
|
|
data/lib/externals/project.rb
CHANGED
@@ -110,7 +110,24 @@ module Externals
|
|
110
110
|
line =~ PROJECT_LINE_REGEX
|
111
111
|
end
|
112
112
|
|
113
|
+
#test helper method
|
114
|
+
def assert_e_dne_i_ni assert, exists, doesnt = [], ignored = exists, notignored = []
|
115
|
+
ignored.each do |proj|
|
116
|
+
assert.call(ignore_text("vendor/plugins/#{proj}") =~ /#{proj}$/)
|
117
|
+
end
|
118
|
+
|
119
|
+
notignored.each do |proj|
|
120
|
+
assert.call(ignore_text("vendor/plugins/#{proj}") !~ /#{proj}$/)
|
121
|
+
end
|
113
122
|
|
123
|
+
exists.each do |proj|
|
124
|
+
assert.call File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
125
|
+
end
|
126
|
+
|
127
|
+
doesnt.each do |proj|
|
128
|
+
assert.call !File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
129
|
+
end
|
130
|
+
end
|
114
131
|
|
115
132
|
protected
|
116
133
|
def trim_quotes value
|
@@ -99,11 +99,11 @@ module Externals
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def ignore_contains? path
|
102
|
-
text = ignore_text
|
102
|
+
text = ignore_text(path)
|
103
103
|
text.split(/\n/).detect {|r| r.strip == path.strip}
|
104
104
|
end
|
105
105
|
|
106
|
-
def ignore_text
|
106
|
+
def ignore_text(path)
|
107
107
|
return '' unless File.exists? '.gitignore'
|
108
108
|
retval = ''
|
109
109
|
open('.gitignore') do |f|
|
@@ -112,16 +112,40 @@ module Externals
|
|
112
112
|
retval
|
113
113
|
end
|
114
114
|
|
115
|
+
def ignore_rows(path)
|
116
|
+
rows = ignore_text(path) || ''
|
117
|
+
|
118
|
+
rows = rows.split(/\n/)
|
119
|
+
|
120
|
+
rows.delete_if {|row| row =~ /^\s*$/}
|
121
|
+
|
122
|
+
rows
|
123
|
+
end
|
124
|
+
|
115
125
|
def append_ignore path
|
116
|
-
rows =
|
126
|
+
rows = ignore_rows(path)
|
127
|
+
|
117
128
|
return if rows.index path.strip
|
118
129
|
|
119
|
-
rows = rows.split(/\n/)
|
120
130
|
rows << path.strip
|
121
131
|
|
122
|
-
|
132
|
+
open('.gitignore', 'w') do |f|
|
133
|
+
f.write "#{rows.compact.join("\n")}\n"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def drop_from_ignore path
|
138
|
+
ir = ignore_rows(path)
|
139
|
+
rows = ir.select {|row| row.strip != path.strip}
|
123
140
|
|
141
|
+
if rows.size == ir.size
|
142
|
+
raise "row not found matching #{path} in .gitignore"
|
143
|
+
end
|
124
144
|
|
145
|
+
if ir.size - rows.size != 1
|
146
|
+
raise "More than one row found matching #{path} in .gitignore"
|
147
|
+
end
|
148
|
+
|
125
149
|
open('.gitignore', 'w') do |f|
|
126
150
|
f.write "#{rows.compact.join("\n")}\n"
|
127
151
|
end
|
@@ -99,23 +99,49 @@ module Externals
|
|
99
99
|
parent = File.dirname(path)
|
100
100
|
child = File.basename(path)
|
101
101
|
|
102
|
-
rows =
|
102
|
+
rows = ignore_rows(path)
|
103
103
|
|
104
104
|
return if rows.detect {|row| row.strip == child.strip}
|
105
105
|
|
106
106
|
rows << child.strip
|
107
107
|
|
108
|
-
|
108
|
+
Dir.chdir(parent) do
|
109
|
+
puts `svn propset svn:ignore "#{rows.compact.join("\n")}\n" .`
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def drop_from_ignore path
|
114
|
+
parent = File.dirname(path)
|
115
|
+
child = File.basename(path).strip
|
116
|
+
|
117
|
+
ir = ignore_rows(path)
|
118
|
+
rows = ir.select {|row| row.strip != child}
|
109
119
|
|
120
|
+
if rows.size == ir.size
|
121
|
+
raise "row not found matching #{path} in svn propget svn:ignore"
|
122
|
+
end
|
123
|
+
|
124
|
+
if ir.size - rows.size != 1
|
125
|
+
raise "More than one row found matching #{path} in svn propget svn:ignore"
|
126
|
+
end
|
127
|
+
|
110
128
|
Dir.chdir(parent) do
|
111
129
|
puts `svn propset svn:ignore "#{rows.compact.join("\n")}\n" .`
|
112
130
|
end
|
113
131
|
end
|
114
132
|
|
133
|
+
def ignore_rows(path)
|
134
|
+
rows = ignore_text(path).split(/\n/)
|
135
|
+
|
136
|
+
rows.delete_if {|row| row =~ /^\s*$/}
|
137
|
+
|
138
|
+
rows
|
139
|
+
end
|
140
|
+
|
115
141
|
def ignore_text(path)
|
116
142
|
ignore_text = ''
|
117
143
|
Dir.chdir File.dirname(path) do
|
118
|
-
|
144
|
+
ignore_text = `svn propget svn:ignore`
|
119
145
|
end
|
120
146
|
ignore_text
|
121
147
|
end
|
@@ -5,8 +5,8 @@ require 'externals/ext'
|
|
5
5
|
module Externals
|
6
6
|
class TestCheckoutWithSubprojectsGit < TestCase
|
7
7
|
include ExtTestCase
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
|
10
10
|
def setup
|
11
11
|
destroy_rails_application
|
12
12
|
create_rails_application
|
@@ -52,34 +52,64 @@ module Externals
|
|
52
52
|
end
|
53
53
|
`rm -rf workdir`
|
54
54
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
#XXX
|
55
|
+
Dir.chdir File.join(root_dir, 'test') do
|
56
|
+
`rm -rf workdir`
|
57
|
+
end
|
59
58
|
end
|
60
59
|
|
61
|
-
|
62
60
|
def test_checkout_with_subproject
|
63
61
|
Dir.chdir File.join(root_dir, 'test') do
|
64
62
|
Dir.chdir 'workdir' do
|
65
63
|
`mkdir checkout`
|
66
64
|
Dir.chdir 'checkout' do
|
67
65
|
source = File.join(root_dir, 'test', 'workdir', 'rails_app')
|
68
|
-
puts "About to checkout #{
|
66
|
+
puts "About to checkout #{source}"
|
69
67
|
Ext.run "checkout", "--git", source
|
70
68
|
|
71
69
|
Dir.chdir 'rails_app' do
|
72
70
|
assert File.exists?('.git')
|
73
71
|
|
74
72
|
assert File.exists?('.gitignore')
|
73
|
+
mp = Ext.new.main_project
|
74
|
+
|
75
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)},%w(foreign_key_migrations redhillonrails_core acts_as_list)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_uninstall
|
83
|
+
Dir.chdir File.join(root_dir, 'test') do
|
84
|
+
Dir.chdir 'workdir' do
|
85
|
+
`mkdir checkout`
|
86
|
+
Dir.chdir 'checkout' do
|
87
|
+
source = File.join(root_dir, 'test', 'workdir', 'rails_app')
|
88
|
+
puts "About to checkout #{source}"
|
89
|
+
Ext.run "checkout", "--git", source
|
90
|
+
|
91
|
+
Dir.chdir 'rails_app' do
|
92
|
+
mp = Ext.new.main_project
|
93
|
+
|
94
|
+
projs = %w(foreign_key_migrations redhillonrails_core acts_as_list)
|
95
|
+
projs_i = projs.dup
|
96
|
+
projs_ni = []
|
97
|
+
|
98
|
+
#let's uninstall acts_as_list
|
99
|
+
Ext.run "uninstall", "acts_as_list"
|
100
|
+
|
101
|
+
projs_ni << projs_i.delete('acts_as_list')
|
102
|
+
|
103
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, [], projs_i, projs_ni
|
104
|
+
|
105
|
+
Ext.run "uninstall", "-f", "foreign_key_migrations"
|
106
|
+
|
107
|
+
projs_ni << projs_i.delete('foreign_key_migrations')
|
108
|
+
|
109
|
+
projs_dne = []
|
110
|
+
projs_dne << projs.delete('foreign_key_migrations')
|
75
111
|
|
76
|
-
|
77
|
-
assert(File.read('.gitignore') =~ /^vendor[\/\\]plugins[\/\\]#{proj}$/)
|
78
|
-
end
|
79
|
-
|
80
|
-
%w(foreign_key_migrations redhillonrails_core acts_as_list).each do |proj|
|
81
|
-
assert File.exists?(File.join('vendor', 'plugins',proj, 'lib'))
|
82
|
-
end
|
112
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, projs_dne, projs_i, projs_ni
|
83
113
|
end
|
84
114
|
end
|
85
115
|
end
|
@@ -5,7 +5,7 @@ require 'externals/ext'
|
|
5
5
|
module Externals
|
6
6
|
class TestCheckoutWithSubprojectsSvn < TestCase
|
7
7
|
include ExtTestCase
|
8
|
-
|
8
|
+
|
9
9
|
def setup
|
10
10
|
destroy_rails_application
|
11
11
|
create_rails_application
|
@@ -75,10 +75,9 @@ module Externals
|
|
75
75
|
end
|
76
76
|
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
#XXX
|
78
|
+
Dir.chdir File.join(root_dir, 'test') do
|
79
|
+
`rm -rf workdir`
|
80
|
+
end
|
82
81
|
end
|
83
82
|
|
84
83
|
|
@@ -109,16 +108,14 @@ module Externals
|
|
109
108
|
puts(ignore_text = `svn propget svn:ignore vendor`)
|
110
109
|
assert(ignore_text =~ /^rails$/)
|
111
110
|
|
112
|
-
Dir.chdir File.join('vendor', 'rails') do
|
113
|
-
assert `git show 92f944818eece9fe4bc62ffb39accdb71ebc32be` =~ /azimux/
|
114
|
-
end
|
115
|
-
|
116
111
|
%w(foreign_key_migrations redhillonrails_core acts_as_list engines).each do |proj|
|
117
112
|
assert File.exists?(File.join('vendor', 'plugins', proj, 'lib'))
|
118
113
|
end
|
119
114
|
|
120
115
|
assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
|
121
116
|
|
117
|
+
assert File.exists?(File.join('vendor', 'rails', '.git'))
|
118
|
+
|
122
119
|
assert File.exists?(File.join('modules', 'modules.txt'))
|
123
120
|
|
124
121
|
assert File.read(File.join('modules', 'modules.txt')) =~ /line1 of/
|
@@ -141,7 +138,7 @@ module Externals
|
|
141
138
|
source = repository_dir('svn')
|
142
139
|
|
143
140
|
if windows?
|
144
|
-
source
|
141
|
+
source.gsub!(/\\/, "/")
|
145
142
|
end
|
146
143
|
source = "file:///#{source}"
|
147
144
|
|
@@ -184,5 +181,50 @@ module Externals
|
|
184
181
|
end
|
185
182
|
end
|
186
183
|
end
|
184
|
+
|
185
|
+
def test_uninstall
|
186
|
+
Dir.chdir File.join(root_dir, 'test') do
|
187
|
+
Dir.chdir 'workdir' do
|
188
|
+
`mkdir checkout`
|
189
|
+
Dir.chdir 'checkout' do
|
190
|
+
#source = File.join(root_dir, 'test', 'workdir', 'rails_app')
|
191
|
+
source = repository_dir('svn')
|
192
|
+
|
193
|
+
if windows?
|
194
|
+
source = source.gsub(/\\/, "/")
|
195
|
+
#source.gsub!(/^[A-Z]:[\/\\]/, "")
|
196
|
+
end
|
197
|
+
source = "file:///#{source}"
|
198
|
+
|
199
|
+
puts "About to checkout #{source}"
|
200
|
+
Ext.run "checkout", "--svn", source, "rails_app"
|
201
|
+
|
202
|
+
Dir.chdir 'rails_app' do
|
203
|
+
mp = Ext.new.main_project
|
204
|
+
|
205
|
+
projs = %w(foreign_key_migrations redhillonrails_core acts_as_list)
|
206
|
+
projs_i = projs.dup
|
207
|
+
projs_ni = []
|
208
|
+
|
209
|
+
#let's uninstall acts_as_list
|
210
|
+
Ext.run "uninstall", "acts_as_list"
|
211
|
+
|
212
|
+
projs_ni << projs_i.delete('acts_as_list')
|
213
|
+
|
214
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, [], projs_i, projs_ni
|
215
|
+
|
216
|
+
Ext.run "uninstall", "-f", "foreign_key_migrations"
|
217
|
+
|
218
|
+
projs_ni << projs_i.delete('foreign_key_migrations')
|
219
|
+
|
220
|
+
projs_dne = []
|
221
|
+
projs_dne << projs.delete('foreign_key_migrations')
|
222
|
+
|
223
|
+
mp.assert_e_dne_i_ni proc{|a|assert(a)}, projs, projs_dne, projs_i, projs_ni
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
187
229
|
end
|
188
230
|
end
|
@@ -5,7 +5,7 @@ require 'externals/ext'
|
|
5
5
|
module Externals
|
6
6
|
class TestFreezeToRevision < TestCase
|
7
7
|
include ExtTestCase
|
8
|
-
|
8
|
+
|
9
9
|
def setup
|
10
10
|
destroy_rails_application
|
11
11
|
create_rails_application
|
@@ -54,10 +54,9 @@ module Externals
|
|
54
54
|
end
|
55
55
|
`rm -rf workdir`
|
56
56
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
#XXX
|
57
|
+
Dir.chdir File.join(root_dir, 'test') do
|
58
|
+
`rm -rf workdir`
|
59
|
+
end
|
61
60
|
end
|
62
61
|
|
63
62
|
|
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.3
|
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: 2009-02-25 00:00:00 -08:00
|
13
13
|
default_executable: ext
|
14
14
|
dependencies: []
|
15
15
|
|