ext 1.0.7 → 1.1.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.
- data/CHANGELOG +3 -0
- data/README +12 -12
- data/Rakefile +1 -1
- data/lib/externals/ext.rb +35 -43
- data/test/test_checkout_git.rb +3 -3
- data/test/test_checkout_with_subprojects_git.rb +3 -3
- data/test/test_checkout_with_subprojects_svn.rb +3 -3
- data/test/test_file_utils_extensions.rb +2 -2
- data/test/test_freeze_to_revision.rb +37 -5
- data/test/test_git_project_extract_name.rb +2 -2
- data/test/test_init_git.rb +3 -3
- data/test/test_out_of_date_git_subproject.rb +3 -3
- data/test/test_projects.rb +2 -2
- data/test/test_rails_detection.rb +3 -3
- data/test/test_string_extensions.rb +2 -2
- data/test/test_svn_branches.rb +3 -3
- data/test/test_touch_emptydirs.rb +2 -2
- data/test/test_version.rb +2 -2
- metadata +4 -22
- data/lib/externals/test/basic_git_repository.rb +0 -57
- data/lib/externals/test/engines.rb +0 -11
- data/lib/externals/test/engines_with_branch1.rb +0 -36
- data/lib/externals/test/fake_rails_repository.rb +0 -112
- data/lib/externals/test/git_repository.rb +0 -15
- data/lib/externals/test/git_repository_from_internet.rb +0 -20
- data/lib/externals/test/modules_svn_branches_repository.rb +0 -72
- data/lib/externals/test/modules_svn_repository.rb +0 -41
- data/lib/externals/test/rails_app_git_branches.rb +0 -109
- data/lib/externals/test/rails_app_git_repository.rb +0 -66
- data/lib/externals/test/rails_app_svn_branches.rb +0 -132
- data/lib/externals/test/rails_app_svn_repository.rb +0 -106
- data/lib/externals/test/rails_app_unmanaged.rb +0 -25
- data/lib/externals/test/repository.rb +0 -186
- data/lib/externals/test/simple_git_with_sub.rb +0 -72
- data/lib/externals/test/svn_repository_from_dump.rb +0 -27
- data/lib/externals/test/svn_repository_helper.rb +0 -10
- data/lib/externals/test_case.rb +0 -54
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -18,14 +18,15 @@ The externals executable is called ext. Commands come in a long form and a
|
|
18
18
|
short form. The longer form applies the action to the main project. The short
|
19
19
|
forms apply the action to all sub projects.
|
20
20
|
|
21
|
-
The commands and usage are as follows (from 'ext help'):
|
22
21
|
There's a tutorial available at http://nopugs.com/ext-tutorial
|
23
22
|
|
23
|
+
The commands and usage are as follows (from 'ext help'):
|
24
|
+
|
24
25
|
ext [OPTIONS] <command> [repository] [-b <branch>] [path]
|
25
|
-
-g, --git same as '--scm git' Uses git to checkout/export the
|
26
|
-
main project
|
27
26
|
--svn, --subversion same as '--scm svn' Uses subversion to
|
28
27
|
checkout/export the main project
|
28
|
+
-g, --git same as '--scm git' Uses git to checkout/export the
|
29
|
+
main project
|
29
30
|
-t, --type TYPE The type of project the main project is. For example,
|
30
31
|
'rails'.
|
31
32
|
-s, --scm SCM The SCM used to manage the main project. For example,
|
@@ -50,16 +51,15 @@ ext [OPTIONS] <command> [repository] [-b <branch>] [path]
|
|
50
51
|
|
51
52
|
|
52
53
|
Commands that apply to the main project or the .externals file:
|
53
|
-
freeze, help, init, install, switch, touch_emptydirs, uninstall, update_ignore, version
|
54
|
-
|
55
|
-
freeze Usage: ext freeze project [REVISION]
|
54
|
+
freeze, help, init, install, switch, touch_emptydirs, unfreeze, uninstall, update_ignore, version
|
56
55
|
|
56
|
+
freeze Usage: ext freeze <subproject> [REVISION]
|
57
57
|
Locks a subproject into a specific revision/branch. If no
|
58
58
|
revision is supplied, the current revision/branch of the
|
59
|
-
project will be used. You can specify the
|
59
|
+
project will be used. You can specify the subproject by name
|
60
60
|
or path.
|
61
61
|
|
62
|
-
help
|
62
|
+
help It helps. Hopefully.
|
63
63
|
|
64
64
|
init Creates a .externals file containing only [main]
|
65
65
|
It will try to determine the SCM used by the main project,
|
@@ -85,6 +85,10 @@ touch_emptydirs Recurses through all directories from the
|
|
85
85
|
comes across. Useful for dealing with SCMs that refuse to
|
86
86
|
track empty directories (such as git, for example)
|
87
87
|
|
88
|
+
unfreeze Usage: ext unfreeze <subproject>
|
89
|
+
Unfreezes a previously frozen subproject. You can specify
|
90
|
+
the subproject by name or path.
|
91
|
+
|
88
92
|
uninstall Usage: ext uninstall [-f|--force_removal] <project>
|
89
93
|
Removes a subproject from being tracked by ext. If you
|
90
94
|
want the files associated with this subproject deleted as well
|
@@ -105,22 +109,18 @@ Commands that apply to the main project and all subprojects:
|
|
105
109
|
checkout, export, status, update
|
106
110
|
|
107
111
|
checkout Usage: ext checkout <repository>
|
108
|
-
|
109
112
|
Checks out <repository>, and checks out any subprojects
|
110
113
|
registered in <repository>'s .externals file.
|
111
114
|
|
112
115
|
export Usage: ext export <repository>
|
113
|
-
|
114
116
|
Like checkout except this command fetches as little
|
115
117
|
history as possible.
|
116
118
|
|
117
119
|
status Usage: ext status
|
118
|
-
|
119
120
|
Prints out the status of the main project, followed by
|
120
121
|
the status of each subproject.
|
121
122
|
|
122
123
|
update Usage: ext update
|
123
|
-
|
124
124
|
Brings the main project, and all subprojects, up to the
|
125
125
|
latest version.
|
126
126
|
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ $LOAD_PATH << File.join(root_dir, 'lib')
|
|
11
11
|
require File.join(root_dir, 'lib', 'externals', 'ext')
|
12
12
|
|
13
13
|
Rake::TestTask.new('test') do |task|
|
14
|
-
task.libs = [File.expand_path('lib'),File.expand_path('test')]
|
14
|
+
task.libs = [File.expand_path('lib'),File.expand_path('test/support')]
|
15
15
|
task.pattern = './test/test_*.rb'
|
16
16
|
#task.warning = true
|
17
17
|
end
|
data/lib/externals/ext.rb
CHANGED
@@ -9,24 +9,24 @@ Dir.entries(File.join(File.dirname(__FILE__), 'extensions')).each do |extension|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Externals
|
12
|
-
VERSION = '1.0
|
12
|
+
VERSION = '1.1.0'
|
13
13
|
PROJECT_TYPES_DIRECTORY = File.join(File.dirname(__FILE__), '..', 'externals','project_types')
|
14
14
|
|
15
15
|
# Full commands operate on the main project as well as the externals
|
16
16
|
# short commands only operate on the externals
|
17
17
|
# Main commands only operate on the main project
|
18
18
|
FULL_COMMANDS_HASH = [
|
19
|
-
[:checkout, "ext checkout <repository>",
|
20
|
-
Checks out <repository>, and checks out any subprojects
|
19
|
+
[:checkout, "ext checkout <repository>",
|
20
|
+
%{Checks out <repository>, and checks out any subprojects
|
21
21
|
registered in <repository>'s .externals file.}],
|
22
|
-
[:export, "ext export <repository>",
|
23
|
-
Like checkout except this command fetches as little
|
22
|
+
[:export, "ext export <repository>",
|
23
|
+
%{Like checkout except this command fetches as little
|
24
24
|
history as possible.}],
|
25
|
-
[:status, "ext status",
|
26
|
-
Prints out the status of the main project, followed by
|
25
|
+
[:status, "ext status",
|
26
|
+
%{Prints out the status of the main project, followed by
|
27
27
|
the status of each subproject.}],
|
28
|
-
[:update, "ext update",
|
29
|
-
Brings the main project, and all subprojects, up to the
|
28
|
+
[:update, "ext update",
|
29
|
+
%{Brings the main project, and all subprojects, up to the
|
30
30
|
latest version.}]
|
31
31
|
]
|
32
32
|
SHORT_COMMANDS_HASH = [
|
@@ -37,10 +37,10 @@ module Externals
|
|
37
37
|
[:up, "Like update, but skips the main project."]
|
38
38
|
]
|
39
39
|
MAIN_COMMANDS_HASH = [
|
40
|
-
[:freeze, "ext freeze
|
41
|
-
Locks a subproject into a specific revision/branch. If no
|
40
|
+
[:freeze, "ext freeze <subproject> [REVISION]",
|
41
|
+
%{Locks a subproject into a specific revision/branch. If no
|
42
42
|
revision is supplied, the current revision/branch of the
|
43
|
-
project will be used. You can specify the
|
43
|
+
project will be used. You can specify the subproject by name
|
44
44
|
or path.}],
|
45
45
|
[:help, "You probably just ran this command just now."],
|
46
46
|
[:init, "Creates a .externals file containing only [main]
|
@@ -63,6 +63,9 @@ module Externals
|
|
63
63
|
top and adds a .emptydir file to any empty directories it
|
64
64
|
comes across. Useful for dealing with SCMs that refuse to
|
65
65
|
track empty directories (such as git, for example)"],
|
66
|
+
[:unfreeze, "ext unfreeze <subproject>",
|
67
|
+
%{Unfreezes a previously frozen subproject. You can specify
|
68
|
+
the subproject by name or path.}],
|
66
69
|
[:uninstall, "ext uninstall [-f|--force_removal] <project>",
|
67
70
|
"Removes a subproject from being tracked by ext. If you
|
68
71
|
want the files associated with this subproject deleted as well
|
@@ -110,8 +113,6 @@ module Externals
|
|
110
113
|
end
|
111
114
|
end
|
112
115
|
|
113
|
-
#puts "Project types available: #{project_types.join(' ')}"
|
114
|
-
|
115
116
|
def self.project_type_files
|
116
117
|
project_types.map do |project_type|
|
117
118
|
"#{File.join(PROJECT_TYPES_DIRECTORY, project_type)}.rb"
|
@@ -312,7 +313,6 @@ module Externals
|
|
312
313
|
scm = configuration['.']
|
313
314
|
scm = scm['scm'] if scm
|
314
315
|
scm ||= options[:scm]
|
315
|
-
#scm ||= infer_scm(repository)
|
316
316
|
|
317
317
|
type = configuration['.']
|
318
318
|
type = type['type'] if type
|
@@ -342,18 +342,6 @@ Please use
|
|
342
342
|
Externals.module_eval("#{scm.to_s.cap_first}Project", __FILE__, __LINE__)
|
343
343
|
end
|
344
344
|
|
345
|
-
def self.project_classes
|
346
|
-
retval = []
|
347
|
-
registered_scms.each do |scm|
|
348
|
-
retval << project_class(scm)
|
349
|
-
end
|
350
|
-
|
351
|
-
retval
|
352
|
-
end
|
353
|
-
def self.project_class(scm)
|
354
|
-
Externals.module_eval("#{scm.to_s.cap_first}Project", __FILE__, __LINE__)
|
355
|
-
end
|
356
|
-
|
357
345
|
def self.project_classes
|
358
346
|
retval = []
|
359
347
|
registered_scms.each do |scm|
|
@@ -409,6 +397,25 @@ Please use
|
|
409
397
|
subproject_by_name_or_path(args[0]).up
|
410
398
|
end
|
411
399
|
|
400
|
+
def unfreeze args, options
|
401
|
+
project = subproject_by_name_or_path(args[0])
|
402
|
+
|
403
|
+
raise "No such project named #{args[0]}" unless project
|
404
|
+
|
405
|
+
section = configuration[project.path]
|
406
|
+
|
407
|
+
unless section[:revision]
|
408
|
+
puts "Uhh... #{project.name} wasn't frozen, so I can't unfreeze it."
|
409
|
+
exit
|
410
|
+
end
|
411
|
+
|
412
|
+
section.rm_setting :revision
|
413
|
+
configuration.write '.externals'
|
414
|
+
reload_configuration
|
415
|
+
|
416
|
+
subproject_by_name_or_path(args[0]).up
|
417
|
+
end
|
418
|
+
|
412
419
|
def install args, options
|
413
420
|
if !File.exists? '.externals'
|
414
421
|
STDERR.puts "This project does not appear to be managed by externals. Try 'ext init' first"
|
@@ -454,7 +461,6 @@ that you are installing. Use an option to specify it
|
|
454
461
|
end
|
455
462
|
|
456
463
|
def uninstall args, options
|
457
|
-
#init args, options unless File.exists? '.externals'
|
458
464
|
raise "Hmm... there's no .externals file in this directory." if !File.exists? '.externals'
|
459
465
|
|
460
466
|
project = subproject_by_name_or_path(args[0])
|
@@ -476,9 +482,6 @@ that you are installing. Use an option to specify it
|
|
476
482
|
end
|
477
483
|
|
478
484
|
def update_ignore args, options
|
479
|
-
#path = args[0]
|
480
|
-
|
481
|
-
|
482
485
|
scm = configuration['.']
|
483
486
|
scm = scm['scm'] if scm
|
484
487
|
|
@@ -494,9 +497,7 @@ that you are installing. Use an option to specify it
|
|
494
497
|
raise "only makes sense for main project" unless project.main_project?
|
495
498
|
|
496
499
|
subprojects.each do |subproject|
|
497
|
-
#puts "about to add #{subproject.path} to ignore"
|
498
500
|
project.update_ignore subproject.path
|
499
|
-
#puts "finished adding #{subproject.path}"
|
500
501
|
end
|
501
502
|
end
|
502
503
|
|
@@ -533,11 +534,7 @@ that you are installing. Use an option to specify it
|
|
533
534
|
|
534
535
|
def status args, options
|
535
536
|
options ||= {}
|
536
|
-
#repository = "."
|
537
|
-
#path = "."
|
538
|
-
#main_project = nil
|
539
537
|
scm = options[:scm]
|
540
|
-
#scm ||= infer_scm(repository)
|
541
538
|
|
542
539
|
if !scm
|
543
540
|
scm ||= configuration['.']
|
@@ -565,7 +562,6 @@ by creating the .externals file manually"
|
|
565
562
|
(such as --git or --svn)"
|
566
563
|
end
|
567
564
|
|
568
|
-
#main_project = self.class.project_class(scm).new("#{repository} #{path}", :is_main)
|
569
565
|
project = main_project
|
570
566
|
project.scm ||= scm
|
571
567
|
project.st
|
@@ -639,9 +635,7 @@ commands below if you actually wish to delete them."
|
|
639
635
|
|
640
636
|
def update args, options
|
641
637
|
options ||= {}
|
642
|
-
#repository = args[0]
|
643
638
|
scm = options[:scm]
|
644
|
-
#scm ||= infer_scm(repository)
|
645
639
|
|
646
640
|
if !scm
|
647
641
|
scm ||= configuration['.']
|
@@ -653,7 +647,6 @@ commands below if you actually wish to delete them."
|
|
653
647
|
(such as --git or --svn)"
|
654
648
|
end
|
655
649
|
|
656
|
-
#main_project = self.class.project_class(scm).new("#{repository} #{path}", :is_main)
|
657
650
|
project = main_project
|
658
651
|
project.scm ||= scm
|
659
652
|
project.up
|
@@ -737,7 +730,7 @@ Please use the --type option to tell ext which to use."
|
|
737
730
|
|
738
731
|
config.add_empty_section '.'
|
739
732
|
|
740
|
-
# If we are using subversion, we should warn about not setting a branch
|
733
|
+
# TODO: If we are using subversion, we should warn about not setting a branch
|
741
734
|
if scm == "svn"
|
742
735
|
if options[:branch]
|
743
736
|
config['.'][:repository] = SvnProject.extract_repository(
|
@@ -746,7 +739,6 @@ Please use the --type option to tell ext which to use."
|
|
746
739
|
)
|
747
740
|
elsif args[0]
|
748
741
|
config['.'][:repository] = args[0].strip
|
749
|
-
else
|
750
742
|
end
|
751
743
|
end
|
752
744
|
|
data/test/test_checkout_git.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
-
require '
|
2
|
+
require 'ext_test_case'
|
3
3
|
require 'externals/ext'
|
4
|
-
require '
|
4
|
+
require 'basic_git_repository'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class TestCheckoutGit < TestCase
|
8
|
+
class TestCheckoutGit < ::Test::Unit::TestCase
|
9
9
|
include ExtTestCase
|
10
10
|
|
11
11
|
def test_checkout
|
@@ -1,11 +1,11 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
-
require '
|
2
|
+
require 'ext_test_case'
|
3
3
|
require 'externals/ext'
|
4
|
-
require '
|
4
|
+
require 'rails_app_git_branches'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class TestCheckoutWithSubprojectsGit < TestCase
|
8
|
+
class TestCheckoutWithSubprojectsGit < ::Test::Unit::TestCase
|
9
9
|
include ExtTestCase
|
10
10
|
|
11
11
|
def test_checkout_with_subproject
|
@@ -1,12 +1,12 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'ext_test_case'
|
4
4
|
require 'externals/ext'
|
5
|
-
require '
|
5
|
+
require 'rails_app_svn_repository'
|
6
6
|
|
7
7
|
module Externals
|
8
8
|
module Test
|
9
|
-
class TestCheckoutWithSubprojectsSvn < TestCase
|
9
|
+
class TestCheckoutWithSubprojectsSvn < ::Test::Unit::TestCase
|
10
10
|
include ExtTestCase
|
11
11
|
|
12
12
|
def test_checkout_with_subproject
|
@@ -1,11 +1,11 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__),'..','lib') if $0 == __FILE__
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'ext_test_case'
|
4
4
|
require 'externals/ext'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class TestFileUtilsExtensions < TestCase
|
8
|
+
class TestFileUtilsExtensions < ::Test::Unit::TestCase
|
9
9
|
include ExtTestCase
|
10
10
|
|
11
11
|
def test_dir_empty
|
@@ -1,13 +1,13 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
-
require '
|
2
|
+
require 'ext_test_case'
|
3
3
|
require 'externals/ext'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
4
|
+
require 'rails_app_git_repository'
|
5
|
+
require 'basic_git_repository'
|
6
|
+
require 'modules_svn_branches_repository'
|
7
7
|
|
8
8
|
module Externals
|
9
9
|
module Test
|
10
|
-
class TestFreezeToRevision < TestCase
|
10
|
+
class TestFreezeToRevision < ::Test::Unit::TestCase
|
11
11
|
include ExtTestCase
|
12
12
|
|
13
13
|
def test_freeze_to_revision
|
@@ -135,6 +135,38 @@ module Externals
|
|
135
135
|
|
136
136
|
assert_equal subproject.current_branch, "branches/branch2"
|
137
137
|
assert_equal subproject.current_revision, "3"
|
138
|
+
|
139
|
+
# now let's test unfreezing...
|
140
|
+
Ext.run "unfreeze", "modules"
|
141
|
+
assert_equal subproject.current_branch, "branches/branch2"
|
142
|
+
assert_equal subproject.current_revision, "4"
|
143
|
+
|
144
|
+
# Check it in to make sure it sticks
|
145
|
+
`git add .externals`
|
146
|
+
raise unless $? == 0
|
147
|
+
`git commit -m 'unfreezing modules'`
|
148
|
+
raise unless $? == 0
|
149
|
+
`git push`
|
150
|
+
raise unless $? == 0
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
rm_rf workdir
|
155
|
+
mkdir_p workdir
|
156
|
+
|
157
|
+
Dir.chdir workdir do
|
158
|
+
rm_r repository.name if File.exists? repository.name
|
159
|
+
source = repository.clean_dir
|
160
|
+
|
161
|
+
puts "About to checkout #{source}"
|
162
|
+
Ext.run "checkout", "--git", source
|
163
|
+
|
164
|
+
Dir.chdir repository.name do
|
165
|
+
ext = Ext.new
|
166
|
+
subproject = ext.subproject_by_name_or_path("modules")
|
167
|
+
|
168
|
+
assert_equal subproject.current_branch, "branches/branch2"
|
169
|
+
assert_equal subproject.current_revision, "4"
|
138
170
|
end
|
139
171
|
end
|
140
172
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
-
require '
|
2
|
+
require 'ext_test_case'
|
3
3
|
require 'externals/ext'
|
4
4
|
require 'stringio'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class TestGitProjectExtractName < TestCase
|
8
|
+
class TestGitProjectExtractName < ::Test::Unit::TestCase
|
9
9
|
include ExtTestCase
|
10
10
|
|
11
11
|
def test_extract_name
|
data/test/test_init_git.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
-
require '
|
2
|
+
require 'ext_test_case'
|
3
3
|
require 'externals/ext'
|
4
|
-
require '
|
4
|
+
require 'basic_git_repository'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class TestInitGit < TestCase
|
8
|
+
class TestInitGit < ::Test::Unit::TestCase
|
9
9
|
include ExtTestCase
|
10
10
|
|
11
11
|
def test_init
|
@@ -1,11 +1,11 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
2
|
-
require '
|
2
|
+
require 'ext_test_case'
|
3
3
|
require 'externals/ext'
|
4
|
-
require '
|
4
|
+
require 'simple_git_with_sub'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class TestOutOfDateGitSubproject < TestCase
|
8
|
+
class TestOutOfDateGitSubproject < ::Test::Unit::TestCase
|
9
9
|
include ExtTestCase
|
10
10
|
|
11
11
|
def test_out_of_date_sub
|