puppetry_toolbox 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +8 -4
- data/lib/puppetry/cli.rb +5 -4
- data/lib/puppetry/version.rb +1 -1
- data/test/end_to_end/puppetry_test.rb +2 -1
- data/test/lib/puppetry/test/custom_assertions.rb +11 -4
- 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: 03fd1542bb8b18110ac356393ce59f3f6ab563d0
|
4
|
+
data.tar.gz: e828268fe9f59f82498051145f6795dfa30266db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d4890f0fd0f9223e5abe7ca9dcc7d486255092c3d89aa0d2421d8c7790ea7c6be6c7b14ea13372c449d5c1db74b080d0266e362c78224bfb2c5ecca0b7297ea
|
7
|
+
data.tar.gz: ac4080ca69e1aa247d4b35c8996d3847ddd30f0b6ae55c1a25e0eb6c0495de218e2e9c715504bd74926f23ebb81262125ab0ab999480c39698a46fad4750f6ba
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0-
|
1
|
+
2.0.0-p195
|
data/README.md
CHANGED
@@ -36,9 +36,13 @@ This will generate a `my_nice_module` subdirectory in the current working
|
|
36
36
|
directory. This directory will contain everything you need to start developing
|
37
37
|
your new module.
|
38
38
|
|
39
|
-
|
39
|
+
In particular, created directory will be a Git repository tracking a remote
|
40
|
+
named `skeleton` that points to the skeleton module used to scaffold the newly
|
41
|
+
created one. So, it's possible to update the current scaffolding configuration
|
42
|
+
by simply issuing:
|
40
43
|
```
|
41
|
-
|
42
|
-
$ puppetry test -c new_class
|
43
|
-
$ puppetry test --class new_class
|
44
|
+
git pull skeleton master
|
44
45
|
```
|
46
|
+
|
47
|
+
**NOTE**: This could lead to conflicts if you modify any of the files tracked
|
48
|
+
by the skeleton module. Normal git housekeeping apply here though.
|
data/lib/puppetry/cli.rb
CHANGED
@@ -13,11 +13,12 @@ module Puppetry
|
|
13
13
|
|
14
14
|
desc "new NAME", "Create a new module called NAME"
|
15
15
|
def new(name)
|
16
|
-
Grit::
|
17
|
-
|
18
|
-
# git history from the folder?
|
16
|
+
repo = Grit::Repo.init(name)
|
17
|
+
repo.remote_add 'skeleton', 'https://github.com/stefanozanella/puppet-skeleton'
|
19
18
|
FileUtils.cd name do
|
20
|
-
|
19
|
+
# No support for push/pull in Grit?
|
20
|
+
`git pull skeleton master`
|
21
|
+
|
21
22
|
Bundler.with_clean_env do
|
22
23
|
system "bundle install --path vendor/bundle"
|
23
24
|
end
|
data/lib/puppetry/version.rb
CHANGED
@@ -38,7 +38,8 @@ describe "puppetry" do
|
|
38
38
|
|
39
39
|
it "creates a new module starting from a scaffolded one" do
|
40
40
|
module_dir.must_contain_a_puppet_module
|
41
|
-
module_dir.
|
41
|
+
module_dir.must_be_a_git_repository
|
42
|
+
module_dir.must_track_remote "skeleton"
|
42
43
|
assert_bundler_is_initialized_in module_dir
|
43
44
|
end
|
44
45
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'grit'
|
2
|
+
|
1
3
|
module MiniTest::Assertions
|
2
4
|
def assert_contains_a_puppet_module(dir)
|
3
5
|
assert Dir.exists?(dir), "Module folder #{dir} wasn't created"
|
@@ -5,16 +7,21 @@ module MiniTest::Assertions
|
|
5
7
|
Dir.entries(dir).must_include "manifests"
|
6
8
|
end
|
7
9
|
|
8
|
-
def
|
9
|
-
Dir.entries(dir).
|
10
|
+
def assert_is_git_repository(dir)
|
11
|
+
assert Dir.entries(dir).include?(".git"), "Expected directory #{dir} to be a git repository"
|
12
|
+
end
|
13
|
+
|
14
|
+
def assert_tracks_remote(dir, remote)
|
15
|
+
assert Grit::Repo.new(dir).git.remote.split.include?(remote), "Expected repo #{dir} to track remote #{remote}"
|
10
16
|
end
|
11
17
|
|
12
18
|
def assert_bundler_is_initialized_in(dir)
|
13
|
-
assert Dir.entries(dir).include?(".bundle"), "Bundler
|
19
|
+
assert Dir.entries(dir).include?(".bundle"), "Expected Bundler to be initialized in folder #{dir}"
|
14
20
|
end
|
15
21
|
end
|
16
22
|
|
17
23
|
module MiniTest::Expectations
|
18
24
|
infect_an_assertion :assert_contains_a_puppet_module, :must_contain_a_puppet_module, :only_one_argument
|
19
|
-
infect_an_assertion :
|
25
|
+
infect_an_assertion :assert_is_git_repository, :must_be_a_git_repository, :only_one_argument
|
26
|
+
infect_an_assertion :assert_tracks_remote, :must_track_remote, :do_not_flip
|
20
27
|
end
|