Commit d4e53411 authored by Michele's avatar Michele

[WIP] Integrating migrator with tests.

parent ac5f166c
...@@ -32,7 +32,7 @@ module Pod ...@@ -32,7 +32,7 @@ module Pod
# #
# @return [void] # @return [void]
# #
def run_install_with_update(update) def run_install_with_update(update)
installer = Installer.new(config.sandbox, config.podfile, config.lockfile) installer = Installer.new(config.sandbox, config.podfile, config.lockfile)
installer.update_mode = update installer.update_mode = update
installer.install! installer.install!
......
...@@ -161,8 +161,8 @@ module Pod ...@@ -161,8 +161,8 @@ module Pod
#--------------------------------------# #--------------------------------------#
it "returns whether the folder containing the Pod with the given name is empty" do it "returns whether the folder containing the Pod with the given name is empty" do
@analyzer.send(:folder_exist?, 'BananaLib').should.be.false @analyzer.send(:folder_exist?, '\BananaLib').should.be.false
path = temporary_directory + 'Pods/BananaLib' path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath path.mkpath
@analyzer.send(:folder_exist?, 'BananaLib').should.be.true @analyzer.send(:folder_exist?, 'BananaLib').should.be.true
...@@ -170,7 +170,7 @@ module Pod ...@@ -170,7 +170,7 @@ module Pod
it "returns whether the folder containing the Pod with the given name is empty" do it "returns whether the folder containing the Pod with the given name is empty" do
@analyzer.send(:folder_empty?, 'BananaLib').should.be.true @analyzer.send(:folder_empty?, 'BananaLib').should.be.true
path = temporary_directory + 'Pods/BananaLib' path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath path.mkpath
File.open(path + "file", "w") {} File.open(path + "file", "w") {}
@analyzer.send(:folder_empty?, 'BananaLib').should.be.false @analyzer.send(:folder_empty?, 'BananaLib').should.be.false
......
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install! @installer.install!
@installer.specific_source.should.be.nil @installer.specific_source.should.be.nil
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
...@@ -38,7 +38,7 @@ module Pod ...@@ -38,7 +38,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install! @installer.install!
@installer.specific_source[:commit].should == "0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc" @installer.specific_source[:commit].should == "0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc"
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
...@@ -46,7 +46,7 @@ module Pod ...@@ -46,7 +46,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' }
@installer.install! @installer.install!
@installer.specific_source[:commit].should == "446b22414597f1bb4062a62c4eed7af9627a3f1b" @installer.specific_source[:commit].should == "446b22414597f1bb4062a62c4eed7af9627a3f1b"
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
...@@ -70,14 +70,14 @@ module Pod ...@@ -70,14 +70,14 @@ module Pod
it "cleans the paths non used by the installation" do it "cleans the paths non used by the installation" do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
unused_file = config.sandbox.root + 'BananaLib/sub-dir/sub-dir-2/somefile.txt' unused_file = config.sandbox.root + 'Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt'
unused_file.should.not.exist unused_file.should.not.exist
end end
it "preserves important files like the LICENSE and the README" do it "preserves important files like the LICENSE and the README" do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
readme_file = config.sandbox.root + 'BananaLib/README' readme_file = config.sandbox.root + 'Sources/BananaLib/README'
readme_file.should.exist readme_file.should.exist
end end
...@@ -120,13 +120,13 @@ module Pod ...@@ -120,13 +120,13 @@ module Pod
@installer.send(:download_source) @installer.send(:download_source)
paths = @installer.send(:clean_paths) paths = @installer.send(:clean_paths)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
paths_without_git = relative_paths.reject { |p| p.include? 'Pods/BananaLib/.git' } paths_without_git = relative_paths.reject { |p| p.include? 'Pods/Sources/BananaLib/.git' }
paths_without_git.sort.should == [ paths_without_git.sort.should == [
"Pods/BananaLib/BananaLib.podspec", "Pods/Sources/BananaLib/BananaLib.podspec",
"Pods/BananaLib/libPusher", "Pods/Sources/BananaLib/libPusher",
"Pods/BananaLib/sub-dir", "Pods/Sources/BananaLib/sub-dir",
"Pods/BananaLib/sub-dir/sub-dir-2", "Pods/Sources/BananaLib/sub-dir/sub-dir-2",
"Pods/BananaLib/sub-dir/sub-dir-2/somefile.txt" "Pods/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt"
] ]
end end
...@@ -135,13 +135,13 @@ module Pod ...@@ -135,13 +135,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths.sort.should == [ relative_paths.sort.should == [
"Pods/BananaLib/Classes/Banana.h", "Pods/Sources/BananaLib/Classes/Banana.h",
"Pods/BananaLib/Classes/Banana.m", "Pods/Sources/BananaLib/Classes/Banana.m",
"Pods/BananaLib/Classes/BananaLib.pch", "Pods/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/BananaLib/Classes/BananaPrivate.h", "Pods/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/BananaLib/LICENSE", "Pods/Sources/BananaLib/LICENSE",
"Pods/BananaLib/README", "Pods/Sources/BananaLib/README",
"Pods/BananaLib/Resources/logo-sidebar.png" "Pods/Sources/BananaLib/Resources/logo-sidebar.png"
] ]
end end
...@@ -159,13 +159,13 @@ module Pod ...@@ -159,13 +159,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths.sort.should == [ relative_paths.sort.should == [
"Pods/BananaLib/Classes/Banana.h", "Pods/Sources/BananaLib/Classes/Banana.h",
"Pods/BananaLib/Classes/Banana.m", "Pods/Sources/BananaLib/Classes/Banana.m",
"Pods/BananaLib/Classes/BananaLib.pch", "Pods/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/BananaLib/Classes/BananaPrivate.h", "Pods/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/BananaLib/LICENSE", "Pods/Sources/BananaLib/LICENSE",
"Pods/BananaLib/README", "Pods/Sources/BananaLib/README",
"Pods/BananaLib/Resources/logo-sidebar.png" "Pods/Sources/BananaLib/Resources/logo-sidebar.png"
] ]
end end
......
...@@ -16,8 +16,8 @@ module Pod ...@@ -16,8 +16,8 @@ module Pod
end end
it "can return the relative path of a given absolute path" do it "can return the relative path of a given absolute path" do
path = temporary_directory + 'Pods/BananaLib/file' path = temporary_directory + 'Pods/Sources/BananaLib/file'
@project.relativize(path).should == Pathname.new('BananaLib/file') @project.relativize(path).should == Pathname.new('Sources/BananaLib/file')
end end
it "can return the relative path of a given absolute path outside its root" do it "can return the relative path of a given absolute path outside its root" do
......
...@@ -37,7 +37,7 @@ module Pod ...@@ -37,7 +37,7 @@ module Pod
end end
it "cleans any trace of the Pod with the given name" do it "cleans any trace of the Pod with the given name" do
pod_root = @sandbox.root + 'BananaLib' pod_root = @sandbox.pod_dir('BananaLib')
pod_root.mkpath pod_root.mkpath
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec')) @sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
specification_path = @sandbox.specification_path('BananaLib') specification_path = @sandbox.specification_path('BananaLib')
...@@ -47,7 +47,7 @@ module Pod ...@@ -47,7 +47,7 @@ module Pod
end end
it "doesn't remove the root of local Pods while cleaning" do it "doesn't remove the root of local Pods while cleaning" do
pod_root = @sandbox.root + 'BananaLib' pod_root = @sandbox.pod_dir('BananaLib')
@sandbox.stubs(:local?).returns(true) @sandbox.stubs(:local?).returns(true)
pod_root.mkpath pod_root.mkpath
@sandbox.clean_pod('BananaLib') @sandbox.clean_pod('BananaLib')
...@@ -73,7 +73,7 @@ module Pod ...@@ -73,7 +73,7 @@ module Pod
end end
it "returns the directory where a Pod is stored" do it "returns the directory where a Pod is stored" do
@sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/JSONKit' @sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/Sources/JSONKit'
end end
it "returns the directory where a local Pod is stored" do it "returns the directory where a local Pod is stored" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment