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.
Files changed (37) hide show
  1. data/CHANGELOG +3 -0
  2. data/README +12 -12
  3. data/Rakefile +1 -1
  4. data/lib/externals/ext.rb +35 -43
  5. data/test/test_checkout_git.rb +3 -3
  6. data/test/test_checkout_with_subprojects_git.rb +3 -3
  7. data/test/test_checkout_with_subprojects_svn.rb +3 -3
  8. data/test/test_file_utils_extensions.rb +2 -2
  9. data/test/test_freeze_to_revision.rb +37 -5
  10. data/test/test_git_project_extract_name.rb +2 -2
  11. data/test/test_init_git.rb +3 -3
  12. data/test/test_out_of_date_git_subproject.rb +3 -3
  13. data/test/test_projects.rb +2 -2
  14. data/test/test_rails_detection.rb +3 -3
  15. data/test/test_string_extensions.rb +2 -2
  16. data/test/test_svn_branches.rb +3 -3
  17. data/test/test_touch_emptydirs.rb +2 -2
  18. data/test/test_version.rb +2 -2
  19. metadata +4 -22
  20. data/lib/externals/test/basic_git_repository.rb +0 -57
  21. data/lib/externals/test/engines.rb +0 -11
  22. data/lib/externals/test/engines_with_branch1.rb +0 -36
  23. data/lib/externals/test/fake_rails_repository.rb +0 -112
  24. data/lib/externals/test/git_repository.rb +0 -15
  25. data/lib/externals/test/git_repository_from_internet.rb +0 -20
  26. data/lib/externals/test/modules_svn_branches_repository.rb +0 -72
  27. data/lib/externals/test/modules_svn_repository.rb +0 -41
  28. data/lib/externals/test/rails_app_git_branches.rb +0 -109
  29. data/lib/externals/test/rails_app_git_repository.rb +0 -66
  30. data/lib/externals/test/rails_app_svn_branches.rb +0 -132
  31. data/lib/externals/test/rails_app_svn_repository.rb +0 -106
  32. data/lib/externals/test/rails_app_unmanaged.rb +0 -25
  33. data/lib/externals/test/repository.rb +0 -186
  34. data/lib/externals/test/simple_git_with_sub.rb +0 -72
  35. data/lib/externals/test/svn_repository_from_dump.rb +0 -27
  36. data/lib/externals/test/svn_repository_helper.rb +0 -10
  37. data/lib/externals/test_case.rb +0 -54
@@ -1,41 +0,0 @@
1
- require 'externals/test/repository'
2
- require 'externals/test/svn_repository_helper'
3
-
4
- module Externals
5
- module Test
6
- class ModulesSvnRepository < Repository
7
- include SvnRepositoryHelper
8
-
9
- def initialize
10
- super "modules", "svn"
11
- end
12
-
13
- def build_here
14
- puts `svnadmin create #{name}`
15
-
16
- mkdir_p "workdir"
17
- Dir.chdir 'workdir' do
18
- rm_rf name
19
-
20
- cmd = "svn checkout \"#{clean_url}\""
21
- puts "about to run #{cmd}"
22
- puts `#{cmd}`
23
- raise unless $? == 0
24
-
25
- Dir.chdir name do
26
- open("modules.txt", "w") do |f|
27
- f.write "line1 of modules.txt\n"
28
- end
29
-
30
- SvnProject.add_all
31
- puts `svn commit -m "created modules.txt"`
32
- raise unless $? == 0
33
- end
34
-
35
- rm_rf name
36
- end
37
- end
38
-
39
- end
40
- end
41
- end
@@ -1,109 +0,0 @@
1
- require 'externals/test/git_repository'
2
- require 'externals/test/git_repository_from_internet'
3
- require 'externals/test/svn_repository_from_dump'
4
- require 'externals/test/engines_with_branch1'
5
- require 'externals/test/fake_rails_repository'
6
- require 'externals/test/rails_app_unmanaged'
7
-
8
- module Externals
9
- module Test
10
- class RailsAppGitBranches < GitRepository
11
- def initialize
12
- super "rails_app", File.join("git", "branches")
13
- dependents.merge!(
14
- :acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
15
- :redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
16
- :foreign_key_migrations => SvnRepositoryFromDump.new("foreign_key_migrations"),
17
- :engines => EnginesWithBranch1.new,
18
- :rails => FakeRailsRepository.new,
19
- :rails_app_unmanaged => RailsAppUnmanaged.new
20
- )
21
- dependents[:foreign_key_migrations].attributes[:revision] = "2"
22
- dependents[:acts_as_list].attributes[:revision] =
23
- "9baff190a52c05cc542bfcaa7f77a91ce669f2f8"
24
- end
25
-
26
- def build_here
27
- mkdir "#{name}.git"
28
- Dir.chdir "#{name}.git" do
29
- `git init --bare`
30
- raise unless $? == 0
31
- end
32
-
33
- cp_a dependents[:rails_app_unmanaged].clean_dir, "#{name}.working"
34
-
35
- Dir.chdir "#{name}.working" do
36
- Ext.run "touch_emptydirs"
37
-
38
- `git init`
39
- raise unless $? == 0
40
- Ext.run "init"
41
- raise " could not create .externals" unless File.exists? '.externals'
42
- Ext.run "install", dependents[:acts_as_list].clean_dir
43
-
44
- #install a couple svn managed subprojects
45
- [:foreign_key_migrations, :redhillonrails_core].each do |proj|
46
- Ext.run "install", "--svn", 'file:///' + dependents[proj].clean_dir
47
- end
48
-
49
- ext = Ext.new
50
- main_project = ext.main_project
51
-
52
- unless !main_project.ignore_contains? "vendor/plugins/engines"
53
- raise
54
- end
55
- #install project with a branch
56
- Ext.run "install", dependents[:engines].clean_dir, "-b", "edge"
57
- unless main_project.ignore_contains? "vendor/plugins/engines"
58
- raise
59
- end
60
-
61
- #install fake_rails
62
- unless !main_project.ignore_contains? "vendor/rails"
63
- raise
64
- end
65
- Ext.run "install",
66
- dependents[:rails].clean_dir
67
- unless main_project.ignore_contains? "vendor/rails"
68
- raise
69
- end
70
-
71
- GitProject.add_all
72
- `git commit -m "created empty rails app with some subprojects"`
73
- raise unless $? == 0
74
-
75
- `git push ../#{name}.git HEAD:master`
76
- raise unless $? == 0
77
-
78
- #let's create a branch for the main project called 'new_branch' and a
79
- #branch for the engines subproject called 'new_branch' and make sure
80
- #that checking one out and doing "ext up" correctly changes the branch
81
- #of the subproject
82
- `git checkout -b new_branch`
83
- raise unless $? == 0
84
-
85
- ext = Ext.new
86
- main_project = ext.main_project
87
-
88
- #update .externals
89
- ext.configuration["vendor/plugins/engines"]["branch"] = "branch1"
90
- ext.configuration.write
91
-
92
- #let's uninstall rails
93
- Ext.run "uninstall", "-f", "rails"
94
- raise if File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
95
-
96
- GitProject.add_all
97
- raise unless $? == 0
98
- `git commit -m "changed branch on engines subproject, removed rails"`
99
- raise unless $? == 0
100
- `git push ../#{name}.git HEAD:new_branch`
101
- raise unless $? == 0
102
- end
103
-
104
- rm_rf "#{name}.working"
105
- end
106
-
107
- end
108
- end
109
- end
@@ -1,66 +0,0 @@
1
- require 'externals/test/git_repository'
2
- require 'externals/test/git_repository_from_internet'
3
- require 'externals/test/svn_repository_from_dump'
4
- require 'externals/test/rails_app_unmanaged'
5
-
6
- module Externals
7
- module Test
8
- class RailsAppGitRepository < GitRepository
9
- def initialize
10
- super "rails_app", "git"
11
- dependents.merge!(
12
- :acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
13
- :redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
14
- :foreign_key_migrations => SvnRepositoryFromDump.new("foreign_key_migrations"),
15
- :rails_app_unmanaged => RailsAppUnmanaged.new
16
- )
17
- dependents[:foreign_key_migrations].attributes[:revision] = "2"
18
- dependents[:acts_as_list].attributes[:revision] =
19
- "9baff190a52c05cc542bfcaa7f77a91ce669f2f8"
20
- end
21
-
22
- def build_here
23
- mkdir "#{name}.git"
24
- Dir.chdir "#{name}.git" do
25
- `git init --bare`
26
- raise unless $? == 0
27
- end
28
-
29
- cp_a dependents[:rails_app_unmanaged].clean_dir, "#{name}.working"
30
-
31
- Dir.chdir "#{name}.working" do
32
- Ext.run "touch_emptydirs"
33
-
34
- `git init`
35
- raise unless $? == 0
36
- Ext.run "init"
37
- raise " could not create .externals" unless File.exists? '.externals'
38
- Ext.run "install", dependents[:acts_as_list].clean_dir
39
-
40
- #install a couple svn managed subprojects
41
- [:foreign_key_migrations, :redhillonrails_core].each do |proj|
42
- Ext.run "install", "--svn", 'file:///' + dependents[proj].clean_dir
43
- end
44
-
45
- Dir.chdir File.join('vendor', 'plugins', 'foreign_key_migrations') do
46
- raise unless `svn info` !~ /^.*:\s*2\s*$/i
47
- raise unless $? == 0
48
- end
49
-
50
- Ext.run "freeze", "foreign_key_migrations", "2"
51
- Ext.run "freeze", "acts_as_list", "9baff190a52c05cc542bfcaa7f77a91ce669f2f8"
52
-
53
- GitProject.add_all
54
- `git commit -m "created empty rails app with some subprojects"`
55
- raise unless $? == 0
56
-
57
- `git push ../#{name}.git HEAD:master`
58
- raise unless $? == 0
59
- end
60
-
61
- rm_rf "#{name}.working"
62
- end
63
-
64
- end
65
- end
66
- end
@@ -1,132 +0,0 @@
1
- require 'externals/test/repository'
2
- require 'externals/test/git_repository_from_internet'
3
- require 'externals/test/svn_repository_from_dump'
4
- require 'externals/test/svn_repository_helper'
5
- require 'externals/test/engines_with_branch1'
6
- require 'externals/test/fake_rails_repository'
7
- require 'externals/test/modules_svn_branches_repository'
8
- require 'externals/test/rails_app_unmanaged'
9
-
10
- module Externals
11
- module Test
12
- class RailsAppSvnBranches < Repository
13
- include SvnRepositoryHelper
14
-
15
- def initialize
16
- super "rails_app_svn_branches", "svn"
17
- dependents.merge!(
18
- :acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
19
- :ssl_requirement => GitRepositoryFromInternet.new("ssl_requirement"),
20
- :engines => EnginesWithBranch1.new,
21
- :redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
22
- :empty_plugin => SvnRepositoryFromDump.new("empty_plugin"),
23
- #fkm seems to cause problems when running tests, concerning a corrupt repository.
24
- #commenting out for now.
25
- #:foreign_key_migrations => SvnRepositoryFromDump.new("foreign_key_migrations", ""),
26
- :rails => FakeRailsRepository.new,
27
- :modules => ModulesSvnBranchesRepository.new,
28
- :rails_app_unmanaged => RailsAppUnmanaged.new
29
- )
30
-
31
- dependents[:ssl_requirement].attributes[:revision] =
32
- "aa2dded823f8a9b378c22ba0159971508918928a"
33
- end
34
-
35
- def build_here
36
- puts `svnadmin create #{name}`
37
- raise unless $? == 0
38
-
39
- mkdir "workdir" unless File.exists? 'workdir'
40
- Dir.chdir 'workdir' do
41
- rm_rf name if File.exists? name
42
- cmd = "svn checkout \"#{clean_url}\""
43
- puts "about to run #{cmd}"
44
- puts `#{cmd}`
45
- raise unless $? == 0
46
-
47
- Dir.chdir name do
48
- mkdir "branches"
49
-
50
- cp_a dependents[:rails_app_unmanaged].clean_dir, name
51
-
52
- mv name, "current"
53
-
54
- SvnProject.add_all
55
- puts `svn commit -m "created branch directory structure"`
56
- raise unless $? == 0
57
-
58
- puts `svn switch #{[clean_url, "current"].join("/")}`
59
- raise unless $? == 0
60
-
61
- Ext.run "init", "-b", "current"
62
- raise " could not create .externals" unless File.exists? '.externals'
63
-
64
- # this line is necessary as ext can't perform the necessary
65
- # ignores otherwise if vendor and vendor/plugins haven't been added
66
- SvnProject.add_all
67
-
68
- #install some git subprojects
69
- [:rails, :acts_as_list].each do |proj|
70
- Ext.run "install", dependents[proj].clean_dir
71
- end
72
-
73
- #install a couple svn managed subprojects
74
- [
75
- #:foreign_key_migrations,
76
- :redhillonrails_core
77
- ].each do |proj|
78
- Ext.run "install", "--svn", dependents[proj].clean_url
79
- end
80
-
81
- #install project with a git branch
82
- Ext.run "install", dependents[:engines].clean_dir, "-b", "edge"
83
-
84
- #install project with a non-default path and svn branching
85
- Ext.run "install", "--svn",
86
- "#{dependents[:modules].clean_url}",
87
- "-b", "current",
88
- "modules"
89
-
90
- SvnProject.add_all
91
-
92
- puts `svn commit -m "created empty rails app with some subprojects"`
93
- raise unless $? == 0
94
-
95
- # now let's make a branch in the main project called new_branch
96
- `svn copy #{
97
- [clean_url, "current"].join("/")
98
- } #{[clean_url, "branches", "new_branch"].join("/")} -m "creating branch" `
99
- raise unless $? == 0
100
-
101
- # let's update the .externals file in new_branch to reflect these changes
102
- `svn switch #{[clean_url, "branches", "new_branch"].join("/")}`
103
- raise unless $? == 0
104
-
105
- # let's remove rails from this branch
106
- Ext.run "uninstall", "-f", "rails"
107
-
108
- # add a git managed project...
109
- Ext.run "install", dependents[:ssl_requirement].clean_dir,
110
- "-r", dependents[:ssl_requirement].attributes[:revision]
111
-
112
- # add a svn managed project
113
- Ext.run "install", "--svn", dependents[:empty_plugin].clean_url
114
-
115
- ext = Ext.new
116
- ext.configuration["vendor/plugins/engines"]["branch"] = "branch1"
117
- ext.configuration["modules"]["branch"] = "branches/branch2"
118
- ext.configuration.write
119
-
120
- SvnProject.add_all
121
- `svn commit -m "updated .externals to point to new branches."`
122
- raise unless $? == 0
123
- end
124
-
125
- rm_rf name
126
- end
127
- end
128
-
129
- end
130
- end
131
-
132
- end
@@ -1,106 +0,0 @@
1
- require 'externals/test/repository'
2
- require 'externals/test/git_repository_from_internet'
3
- require 'externals/test/svn_repository_from_dump'
4
- require 'externals/test/svn_repository_helper'
5
- require 'externals/test/fake_rails_repository'
6
- require 'externals/test/modules_svn_repository'
7
- require 'externals/test/rails_app_unmanaged'
8
- require 'externals/test/engines'
9
-
10
- module Externals
11
- module Test
12
- class RailsAppSvnRepository < Repository
13
- include SvnRepositoryHelper
14
-
15
- def initialize
16
- super "rails_app", "svn2"
17
- dependents.merge!(
18
- :acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
19
- :ssl_requirement => GitRepositoryFromInternet.new("ssl_requirement"),
20
- :engines => Engines.new,
21
- :redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
22
- :empty_plugin => SvnRepositoryFromDump.new("empty_plugin"),
23
- #fkm seems to cause problems when running tests, concerning a corrupt repository.
24
- #commenting out for now.
25
- #:foreign_key_migrations => SvnRepositoryFromDump.new("foreign_key_migrations", ""),
26
- :rails => FakeRailsRepository.new,
27
- :modules => ModulesSvnRepository.new,
28
- :rails_app_unmanaged => RailsAppUnmanaged.new
29
- )
30
-
31
- dependents[:ssl_requirement].attributes[:revision] =
32
- "aa2dded823f8a9b378c22ba0159971508918928a"
33
- end
34
-
35
- def build_here
36
- puts `svnadmin create #{name}`
37
- raise unless $? == 0
38
-
39
- mkdir_p "workdir"
40
- Dir.chdir 'workdir' do
41
- rm_rf_ie name
42
-
43
- cmd = "svn checkout \"#{clean_url}\""
44
- puts `#{cmd}`
45
- raise unless $? == 0
46
-
47
- Dir.entries(dependents[:rails_app_unmanaged].clean_dir).each do |file|
48
- unless %w(.. .).include? file.to_s
49
- cp_a File.join(dependents[:rails_app_unmanaged].clean_dir, file), name
50
- end
51
- end
52
-
53
- Dir.chdir name do
54
- SvnProject.add_all
55
- puts `svn commit -m "created initial project"`
56
- raise unless $? == 0
57
-
58
- `svn up`
59
- raise unless $? == 0
60
-
61
- Ext.run "init"
62
- raise " could not create .externals" unless File.exists? '.externals'
63
-
64
- # this line is necessary as ext can't perform the necessary
65
- # ignores otherwise if vendor and vendor/plugins haven't been added
66
- SvnProject.add_all
67
- # puts `svn commit -m "added .externals file"`
68
- # raise unless $? == 0
69
-
70
- #install some git subprojects
71
- Ext.run "install", dependents[:acts_as_list].clean_dir
72
- #we have to use file:// to test export, because without that
73
- #git clone optimizes by copying and igores --depth
74
- Ext.run "install", "file://#{dependents[:rails].clean_dir}"
75
-
76
- #install a couple svn managed subprojects
77
- [
78
- #:foreign_key_migrations,
79
- :redhillonrails_core
80
- ].each do |proj|
81
- Ext.run "install", "--svn", dependents[proj].clean_url
82
- end
83
-
84
- #install project with a git branch
85
- Ext.run "install", dependents[:engines].clean_dir, "-b", "edge"
86
-
87
- #install project with a non-default path
88
- Ext.run "install", "--svn",
89
- "#{dependents[:modules].clean_url}",
90
- "modules"
91
-
92
- SvnProject.add_all
93
-
94
- puts `svn commit -m "created empty rails app with some subprojects"`
95
- unless $? == 0
96
- raise
97
- end
98
- end
99
-
100
- rm_rf "workdir"
101
- end
102
- end
103
- end
104
-
105
- end
106
- end