berks-monolith 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/README.md +10 -0
- data/lib/monolith/commands.rb +5 -4
- data/lib/monolith/locations/base.rb +2 -0
- data/lib/monolith/locations/default.rb +2 -0
- data/lib/monolith/locations/git.rb +4 -0
- data/lib/monolith/locations/path.rb +3 -0
- data/lib/monolith/version.rb +1 -1
- data/test/helpers.rb +22 -0
- data/test/test_gitexclude.rb +29 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5850a377e166641ecfdefc6eb15bee7f5a6ccfee
|
4
|
+
data.tar.gz: 44386e6b7dd0491a984fa9adae7289b3e75f91ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7517d54a444eaadf6f8b3997ec85f3ee114f065479043bc35d1c1a77f54be6473e271d2383e4ca84fa8d6f2d245f1b53ea6c127bdd5388809919048a5eb4fab5
|
7
|
+
data.tar.gz: 7c0dd2f7b722402b417696c18653920d66fa612e2447cf040528e42c700984df8af9d332cc1ef13643010a987af3e5e0cc8deedcde6046c01eb40ec20e78205f
|
data/README.md
CHANGED
@@ -33,6 +33,16 @@ The `berks install` command collects all cookbooks into
|
|
33
33
|
`~/.berkshelf/cookbooks`, but again VCS information is stripped out, and this
|
34
34
|
contains all cookbooks, not just those associated with a specific Berksfile.
|
35
35
|
|
36
|
+
# Installation
|
37
|
+
|
38
|
+
Install from rubygems:
|
39
|
+
|
40
|
+
gem install berks-monolith
|
41
|
+
|
42
|
+
Or to install the development version from a git clone:
|
43
|
+
|
44
|
+
rake install
|
45
|
+
|
36
46
|
## Usage
|
37
47
|
|
38
48
|
### berks-monolith install
|
data/lib/monolith/commands.rb
CHANGED
@@ -42,8 +42,9 @@ module Monolith
|
|
42
42
|
gitpath = File.expand_path('../.git', berksfile.berksfile.filepath)
|
43
43
|
gitexclude = GitExclude.new(gitpath, options)
|
44
44
|
berksfile.cookbooks(path) do |cookbook, dep, destination|
|
45
|
-
berksfile.monolith_action(:install, cookbook, dep, destination)
|
46
|
-
|
45
|
+
changed = berksfile.monolith_action(:install, cookbook, dep, destination)
|
46
|
+
|
47
|
+
gitexclude.add(destination) if changed
|
47
48
|
end
|
48
49
|
gitexclude.update
|
49
50
|
end
|
@@ -62,8 +63,8 @@ module Monolith
|
|
62
63
|
gitpath = File.expand_path('../.git', berksfile.berksfile.filepath)
|
63
64
|
gitexclude = GitExclude.new(gitpath, options)
|
64
65
|
berksfile.cookbooks(path) do |cookbook, dep, destination|
|
65
|
-
berksfile.monolith_action(:clean, cookbook, dep, destination)
|
66
|
-
gitexclude.remove(destination)
|
66
|
+
changed = berksfile.monolith_action(:clean, cookbook, dep, destination)
|
67
|
+
gitexclude.remove(destination) if changed
|
67
68
|
end
|
68
69
|
gitexclude.update
|
69
70
|
end
|
@@ -28,9 +28,11 @@ module Monolith
|
|
28
28
|
if File.exist?(@destination)
|
29
29
|
Monolith.formatter.clean(@cookbook, @destination)
|
30
30
|
FileUtils.rm_rf(@destination)
|
31
|
+
true
|
31
32
|
else
|
32
33
|
rel_dest = Monolith.formatter.rel_dir(@destination)
|
33
34
|
Monolith.formatter.skip(@cookbook, "#{rel_dest} doesn't exist")
|
35
|
+
nil
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -12,6 +12,7 @@ module Monolith
|
|
12
12
|
Monolith.formatter.install(@cookbook, @destination)
|
13
13
|
FileUtils.cp_r(@cookbook.path, @destination)
|
14
14
|
end
|
15
|
+
true
|
15
16
|
end
|
16
17
|
|
17
18
|
def update
|
@@ -19,6 +20,7 @@ module Monolith
|
|
19
20
|
# blowing it away and recreating it. For the moment I'm opting not to do
|
20
21
|
# that (it may be able ot be an option later)
|
21
22
|
Monolith.formatter.skip(@cookbook, "Not updating community cookbook")
|
23
|
+
nil
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -19,9 +19,11 @@ module Monolith
|
|
19
19
|
|
20
20
|
# Not sure if I want to do this - should probably be an option
|
21
21
|
#git %|reset --hard #{@revision}|
|
22
|
+
true
|
22
23
|
else
|
23
24
|
rel_dest = Monolith.formatter.rel_dir(@destination)
|
24
25
|
Monolith.formatter.skip(@cookbook, "#{rel_dest} already exists")
|
26
|
+
nil
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -31,9 +33,11 @@ module Monolith
|
|
31
33
|
Dir.chdir(@destination) do
|
32
34
|
git %|pull|
|
33
35
|
end
|
36
|
+
true
|
34
37
|
else
|
35
38
|
rel_dest = Monolith.formatter.rel_dir(@destination)
|
36
39
|
Monolith.formatter.skip(@cookbook, "#{rel_dest} doesn't exist")
|
40
|
+
nil
|
37
41
|
end
|
38
42
|
end
|
39
43
|
|
@@ -8,16 +8,19 @@ module Monolith
|
|
8
8
|
def install
|
9
9
|
Monolith.formatter.debug("Skipping cookbook #{@cookbook.cookbook_name}" \
|
10
10
|
"with path location")
|
11
|
+
nil
|
11
12
|
end
|
12
13
|
|
13
14
|
def update
|
14
15
|
Monolith.formatter.debug("Skipping cookbook #{@cookbook.cookbook_name}" \
|
15
16
|
"with path location")
|
17
|
+
nil
|
16
18
|
end
|
17
19
|
|
18
20
|
def clean
|
19
21
|
Monolith.formatter.debug("Skipping cookbook #{@cookbook.cookbook_name}" \
|
20
22
|
"with path location")
|
23
|
+
nil
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
data/lib/monolith/version.rb
CHANGED
data/test/helpers.rb
CHANGED
@@ -12,6 +12,13 @@ module Monolith
|
|
12
12
|
FileUtils.mkdir_p(tmp_path)
|
13
13
|
end
|
14
14
|
|
15
|
+
def setup_tmp_git_repo
|
16
|
+
# Makes the test directory into a git repo for testing excludes
|
17
|
+
Dir.chdir(tmp_path) do
|
18
|
+
%x|git init|
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
15
22
|
def make_git_repo(name)
|
16
23
|
# Makes an example git repo with a single file in and one commit
|
17
24
|
repo_path = tmp_path.join("git", name)
|
@@ -41,6 +48,18 @@ module Monolith
|
|
41
48
|
end
|
42
49
|
end
|
43
50
|
|
51
|
+
def make_path_cookbook(name)
|
52
|
+
# Makes an example git repo with a single file in and one commit
|
53
|
+
cb_path = tmp_path.join("cookbooks", name)
|
54
|
+
FileUtils.mkdir_p(cb_path)
|
55
|
+
Dir.chdir(cb_path) do
|
56
|
+
File.open('metadata.rb', 'w') do |f|
|
57
|
+
f.puts "name '#{name}'"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
cb_path
|
61
|
+
end
|
62
|
+
|
44
63
|
def make_berksfile(types)
|
45
64
|
File.open(tmp_path.join('Berksfile'), 'w') do |berksfile|
|
46
65
|
berksfile.puts "source 'https://supermarket.chef.io/'"
|
@@ -48,6 +67,9 @@ module Monolith
|
|
48
67
|
if type == :git
|
49
68
|
repo_path = make_git_repo('test_git')
|
50
69
|
berksfile.puts("cookbook 'test_git', :git => '#{repo_path}'")
|
70
|
+
elsif type == :path
|
71
|
+
cb_path = make_path_cookbook('test_path')
|
72
|
+
berksfile.puts("cookbook 'test_path', :path => '#{cb_path}'")
|
51
73
|
end
|
52
74
|
end
|
53
75
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative 'helpers'
|
3
|
+
|
4
|
+
# Fix 'Celluloid::Error Thread pool is not running' error.
|
5
|
+
# See https://github.com/celluloid/celluloid/pull/162
|
6
|
+
require 'celluloid/test'
|
7
|
+
Celluloid.init
|
8
|
+
|
9
|
+
require 'monolith'
|
10
|
+
|
11
|
+
class TestCommandInstall < MiniTest::Test
|
12
|
+
include Monolith::TestHelpers
|
13
|
+
|
14
|
+
def setup
|
15
|
+
clean_tmp_path
|
16
|
+
setup_tmp_git_repo
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_install_command
|
20
|
+
efile = ".git/info/exclude"
|
21
|
+
make_berksfile([:git, :path]) do
|
22
|
+
Monolith::Command.start(['install', '-q'])
|
23
|
+
assert File.exist?(efile)
|
24
|
+
assert File.read(efile).include?("cookbooks/test_git")
|
25
|
+
assert File.exist?("cookbooks/test_path")
|
26
|
+
refute File.read(efile).include?("cookbooks/test_path")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berks-monolith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Harrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: berkshelf
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- test/test_command_clean.rb
|
120
120
|
- test/test_command_install.rb
|
121
121
|
- test/test_command_update.rb
|
122
|
+
- test/test_gitexclude.rb
|
122
123
|
- test/test_gitlocation.rb
|
123
124
|
homepage: http://github.com/mivok/berks-monolith
|
124
125
|
licenses:
|
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
version: '0'
|
141
142
|
requirements: []
|
142
143
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.4.
|
144
|
+
rubygems_version: 2.4.4
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: Berkshelf monolithic repository tools
|
@@ -150,5 +151,6 @@ test_files:
|
|
150
151
|
- test/test_command_clean.rb
|
151
152
|
- test/test_command_install.rb
|
152
153
|
- test/test_command_update.rb
|
154
|
+
- test/test_gitexclude.rb
|
153
155
|
- test/test_gitlocation.rb
|
154
156
|
has_rdoc:
|