brick_and_mortar 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick_and_mortar/brick.rb +9 -0
- data/lib/brick_and_mortar/version.rb +1 -1
- data/spec/config_spec.rb +28 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 367a629c8459c80a299aa44892dae105acc9121a
|
4
|
+
data.tar.gz: aeb405918d8fae1c1183f716f38e79e79ea4d266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f14791e70635e51a316505ab4c583449db528faa569dd97e8f12fe2a7cd844ed5810cf7e1bec1663e199d91b146f7004bc9bf65fbeb5f8551c3cb0e29694995
|
7
|
+
data.tar.gz: ed76868ee05516c8449bc1d7362cd4bc43fb728e53c2d9d84323a41b3837d131e3939e695edd2ac6fa224873cf02523a63adb4080456ee5ba0f40c0468d2a644
|
@@ -57,6 +57,8 @@ module BrickAndMortar
|
|
57
57
|
@method = 'git'
|
58
58
|
elsif data.match(/^\s*https?:/)
|
59
59
|
@method = 'download'
|
60
|
+
else
|
61
|
+
@method = 'copy'
|
60
62
|
end
|
61
63
|
@path = data
|
62
64
|
@format = self.class().url_to_format(data)
|
@@ -124,6 +126,13 @@ module BrickAndMortar
|
|
124
126
|
else
|
125
127
|
raise UnrecognizedFormat.new(@location.format)
|
126
128
|
end
|
129
|
+
when 'copy'
|
130
|
+
if @verbose
|
131
|
+
puts "Copying #{@name_with_version} to #{@destination} from #{@location.path}"
|
132
|
+
end
|
133
|
+
dir = File.dirname(@destination)
|
134
|
+
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
135
|
+
FileUtils.cp_r @location.path, @destination
|
127
136
|
else
|
128
137
|
raise UnrecognizedRetrievalMethod.new(@location.method)
|
129
138
|
end
|
data/spec/config_spec.rb
CHANGED
@@ -5,6 +5,22 @@ require_relative 'support/network_mocks'
|
|
5
5
|
|
6
6
|
BRICK_STORE = File.expand_path('../.test_brick_store', __FILE__)
|
7
7
|
|
8
|
+
def test_local_config(patient)
|
9
|
+
patient.length.must_equal 1
|
10
|
+
patient[0].name.must_equal 'brick_and_mortar'
|
11
|
+
patient[0].version.must_equal '0.0.1'
|
12
|
+
patient[0].location.method.must_equal 'copy'
|
13
|
+
patient[0].location.format.must_equal 'plain'
|
14
|
+
patient[0].location.path.must_equal File.expand_path('../support/test_files/local_project', __FILE__)
|
15
|
+
File.basename(patient[0].destination).must_equal 'brick_and_mortar-0.0.1'
|
16
|
+
patient[0].destination.must_equal File.join(BRICK_STORE, 'brick_and_mortar-0.0.1')
|
17
|
+
patient[0].exists?.must_equal false
|
18
|
+
patient[0].create!
|
19
|
+
patient[0].exists?.must_equal true
|
20
|
+
patient[0].destroy!
|
21
|
+
patient[0].exists?.must_equal false
|
22
|
+
end
|
23
|
+
|
8
24
|
def test_git_https_config(patient)
|
9
25
|
patient.length.must_equal 1
|
10
26
|
patient[0].name.must_equal 'brick_and_mortar'
|
@@ -270,6 +286,18 @@ END
|
|
270
286
|
end
|
271
287
|
end
|
272
288
|
|
289
|
+
describe 'local' do
|
290
|
+
it 'from string' do
|
291
|
+
test_brickfile_config = <<-END
|
292
|
+
-
|
293
|
+
name: brick_and_mortar
|
294
|
+
version: 0.0.1
|
295
|
+
location: #{File.expand_path('../support/test_files/local_project', __FILE__)}
|
296
|
+
END
|
297
|
+
test_local_config BrickAndMortar::Config.new(BRICK_STORE).parse!(test_brickfile_config)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
273
301
|
# @todo Copy the above tests, but for hg and local project configurations (see support/test_files for example configurations)
|
274
302
|
|
275
303
|
# @todo A little more has to be done for local project, since the path to the local project might have to be relative to the brickfile, so I can do that one
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brick_and_mortar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Morrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|