palimpsest 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/palimpsest/environment.rb +2 -1
- data/lib/palimpsest/external.rb +4 -3
- data/lib/palimpsest/version.rb +1 -1
- data/spec/environment_spec.rb +8 -8
- data/spec/external_spec.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5c5fd7be63cf42172ba38c5aa33e5be3fa92f83
|
4
|
+
data.tar.gz: 79170f2245713ce67b510482b3ad4283817aea95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fbb3b3b92713de6e71c56cd6d3e296e085cf2968d87ff6300eb0cbbb523735c887b137917df09ffbac9e964c3a55ea657ec57a1ab1b58245de8ba0b11b0191e
|
7
|
+
data.tar.gz: 83ff64c867a93424b6550623dd75a6ef39e9b91440c934f7bcbd85d09fc91eec9df180ed4d249794b722c7ff2f8c5a6b7c4ea0e6805c5ff1be2a4afb51663563
|
@@ -156,6 +156,7 @@ module Palimpsest
|
|
156
156
|
# @param dest [String] path to copy environment's files to
|
157
157
|
# @return [Environment] the current environment instance
|
158
158
|
def copy dest: site.path
|
159
|
+
FileUtils.mkdir_p dest
|
159
160
|
FileUtils.cp_r Dir["#{directory}/*"], dest, preserve: true
|
160
161
|
self
|
161
162
|
end
|
@@ -247,7 +248,7 @@ module Palimpsest
|
|
247
248
|
# Install all externals.
|
248
249
|
# @return [Environment] the current environment instance
|
249
250
|
def install_externals
|
250
|
-
externals.each { |e| e.install }
|
251
|
+
externals.each { |e| e.install.cleanup }
|
251
252
|
self
|
252
253
|
end
|
253
254
|
|
data/lib/palimpsest/external.rb
CHANGED
@@ -36,14 +36,15 @@ module Palimpsest
|
|
36
36
|
def environment
|
37
37
|
return @environment if @environment
|
38
38
|
|
39
|
-
site = Site.new repo: Grit::Repo.new(tmp_environment.directory)
|
39
|
+
site = Site.new name: "external_#{name.gsub '/', '_'}", repo: Grit::Repo.new(tmp_environment.directory)
|
40
40
|
@environment = Environment.new site: site, treeish: branch
|
41
41
|
end
|
42
42
|
|
43
43
|
# Copy the files to the {#install_path}.
|
44
44
|
# @return (see Environment#copy)
|
45
45
|
def install
|
46
|
-
environment.copy dest: install_path
|
46
|
+
environment.populate.copy dest: install_path
|
47
|
+
self
|
47
48
|
end
|
48
49
|
|
49
50
|
# @return [External] the current external instance
|
@@ -65,7 +66,7 @@ module Palimpsest
|
|
65
66
|
Grit::Git.git_max_size = 200 * 1048576
|
66
67
|
Grit::Git.git_timeout = 200
|
67
68
|
|
68
|
-
@tmp_environment = Environment.new
|
69
|
+
@tmp_environment = Environment.new site: Site.new(name: "external_clone_#{name.gsub '/', '_'}")
|
69
70
|
gritty = Grit::Git.new tmp_environment.directory
|
70
71
|
gritty.clone( { branch: branch }, repo_path, tmp_environment.directory )
|
71
72
|
@tmp_environment
|
data/lib/palimpsest/version.rb
CHANGED
data/spec/environment_spec.rb
CHANGED
@@ -79,9 +79,11 @@ describe Palimpsest::Environment do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "#copy" do
|
82
|
-
|
82
|
+
|
83
|
+
it "copies the environment to the destination" do
|
83
84
|
dir = environment.directory
|
84
85
|
allow(Dir).to receive(:[]).with("#{dir}/*").and_return( %W(#{dir}/path/1 #{dir}/path/2) )
|
86
|
+
expect(FileUtils).to receive(:mkdir_p).with('/dest/path')
|
85
87
|
expect(FileUtils).to receive(:cp_r).with( %W(#{dir}/path/1 #{dir}/path/2), '/dest/path', preserve: true)
|
86
88
|
environment.copy dest: '/dest/path'
|
87
89
|
end
|
@@ -292,13 +294,11 @@ describe Palimpsest::Environment do
|
|
292
294
|
allow(external_2).to receive(:install)
|
293
295
|
end
|
294
296
|
|
295
|
-
it "installs the externals" do
|
296
|
-
expect(external_1).to receive(:install)
|
297
|
-
expect(
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
it "returns itself" do
|
297
|
+
it "installs the externals and returns itself" do
|
298
|
+
expect(external_1).to receive(:install).and_return(external_1)
|
299
|
+
expect(external_1).to receive(:cleanup)
|
300
|
+
expect(external_2).to receive(:install).and_return(external_2)
|
301
|
+
expect(external_2).to receive(:cleanup)
|
302
302
|
expect(environment.install_externals).to be environment
|
303
303
|
end
|
304
304
|
end
|
data/spec/external_spec.rb
CHANGED
@@ -11,6 +11,7 @@ describe Palimpsest::External do
|
|
11
11
|
allow(Grit::Git).to receive(:new).and_return(gritty)
|
12
12
|
allow(Grit::Repo).to receive(:new).and_return(repo)
|
13
13
|
allow(gritty).to receive(:clone)
|
14
|
+
allow(repo).to receive(:archive_tar)
|
14
15
|
end
|
15
16
|
|
16
17
|
describe "#repo_path" do
|
@@ -77,10 +78,11 @@ describe Palimpsest::External do
|
|
77
78
|
|
78
79
|
describe "#install" do
|
79
80
|
|
80
|
-
it "installs the external to the install path" do
|
81
|
+
it "populates and installs the external to the install path and returns itself" do
|
81
82
|
external.install_path = 'path/to/install'
|
83
|
+
expect(external.environment).to receive(:populate).and_return(external.environment)
|
82
84
|
expect(external.environment).to receive(:copy).with(dest: 'path/to/install')
|
83
|
-
external.install
|
85
|
+
expect(external.install).to be external
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|