puppet_module_packaging 0.0.1

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.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/.gitignore +12 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +17 -0
  6. data/Changelog.md +6 -0
  7. data/Gemfile +3 -0
  8. data/LICENSE +22 -0
  9. data/README.md +90 -0
  10. data/Rakefile +22 -0
  11. data/Vagrantfile +11 -0
  12. data/lib/puppet_module/pkg/tasks/build.rb +120 -0
  13. data/lib/puppet_module/pkg/tasks/clean.rb +15 -0
  14. data/lib/puppet_module/pkg/tasks/deb.rb +13 -0
  15. data/lib/puppet_module/pkg/tasks/install.rb +33 -0
  16. data/lib/puppet_module/pkg/tasks/modulefile.rb +69 -0
  17. data/lib/puppet_module/pkg/tasks/rake_tasks.rb +42 -0
  18. data/lib/puppet_module/pkg/tasks/rpm.rb +13 -0
  19. data/lib/puppet_module/pkg/tasks/system.rb +25 -0
  20. data/lib/puppet_module/pkg/tasks.rb +13 -0
  21. data/lib/puppet_module/pkg/version.rb +5 -0
  22. data/puppet_module_packaging.gemspec +40 -0
  23. data/rubygems-stefanozanella.crt +20 -0
  24. data/test/end_to_end/.gitkeep +0 -0
  25. data/test/end_to_end/clean_test.rb +14 -0
  26. data/test/end_to_end/install_test.rb +34 -0
  27. data/test/end_to_end/pkg_test.rb +33 -0
  28. data/test/end_to_end/tasks_test.rb +16 -0
  29. data/test/fixture/testmod/Modulefile +13 -0
  30. data/test/fixture/testmod/Modulefile.no_name_or_author +2 -0
  31. data/test/fixture/testmod/Modulefile.no_version +1 -0
  32. data/test/fixture/testmod/Rakefile +3 -0
  33. data/test/fixture/testmod/files/example.dat +0 -0
  34. data/test/fixture/testmod/lib/utils.rb +0 -0
  35. data/test/fixture/testmod/manifests/init.pp +0 -0
  36. data/test/fixture/testmod/templates/config.erb +0 -0
  37. data/test/integration/modulefile_test.rb +50 -0
  38. data/test/integration/system_test.rb +59 -0
  39. data/test/test_helper.rb +85 -0
  40. data/test/test_vm.pp +23 -0
  41. data/test/unit/.gitkeep +0 -0
  42. data/test/unit/build_test.rb +81 -0
  43. data/test/unit/clean_test.rb +13 -0
  44. data/test/unit/install_test.rb +34 -0
  45. data.tar.gz.sig +0 -0
  46. metadata +242 -0
  47. metadata.gz.sig +2 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 355d955a3532b7fd7bec451b8177c3220247f5f1
4
+ data.tar.gz: 6d8e077720efe12fe7c556dd77af6cf09a3a62ae
5
+ SHA512:
6
+ metadata.gz: c19b218cdeafa6f4f11362842c3e4e4198905bf62da25cb415decf44094c8bdcaf03abdc2397719dfa2412b768be61a04ede7815a91fd301b158eabaf65c692c
7
+ data.tar.gz: 9dac89efa58e82ac8e090f9f8fdc3bcafc8a87f5ffbca2e3875f1045206ee5e4095e9d65d5dd128243b584c9cb6c0073601da3d8270bb50562b71faf2f04db7c
checksums.yaml.gz.sig ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *.swp
2
+ *.swo
3
+ .bundle
4
+ .envrc
5
+ .vagrant
6
+ Gemfile.lock
7
+ vendor
8
+ #! IMPORTANT as we don't want to commit things built by tests (esp. packages)
9
+ **/pkg
10
+ !lib/**/pkg
11
+ test/fixture/**/build
12
+ #! IMPORTANT
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p247
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ language: ruby
3
+
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - jruby-18mode
8
+ - jruby-19mode
9
+ - rbx-19mode
10
+
11
+ bundler_args: --path vendor/bundle
12
+
13
+ before_install:
14
+ - sudo apt-get install rpm
15
+
16
+ script:
17
+ - bundle exec rake test:all
data/Changelog.md ADDED
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1
4
+
5
+ * Add `rpm`, `deb`, `install` and `clean` tasks.
6
+ * Recognize all the `Modulefile` fields except dependencies.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Stefano Zanella
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # Puppet Module Packaging
2
+
3
+ [![Build Status](https://travis-ci.org/stefanozanella/puppet_module_packaging.png?branch=master)](https://travis-ci.org/stefanozanella/puppet_module_packaging)
4
+
5
+ Provides Rake tasks to ease shipping of Puppet modules as proper system
6
+ packages.
7
+
8
+ Currently, it provides tasks to build Debian and RPM packages. To do that, it
9
+ uses excellent Jordan Sissel's [fpm](https://github.com/jordansissel/fpm).
10
+
11
+ **NOTE**: at this stage, this library lacks a bunch of useful features
12
+ (particularly, its behavior can't be customized in any way and there's no
13
+ dependency management). Feel free to
14
+ submit issues or PRs if there's something that could help you out and you'd
15
+ like to see integrated.
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ gem 'puppet_module_packaging'
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install puppet_module_packaging
30
+
31
+ ## Usage
32
+
33
+ To have the shipped Rake tasks available for your module, just add the
34
+ following line to your `Rakefile`:
35
+
36
+ require 'puppet_module_packaging/rake_task'
37
+
38
+ This will add the following tasks to your set:
39
+
40
+ * `install`
41
+ * `clean`
42
+ * `deb`
43
+ * `rpm`
44
+
45
+ To package your module, you only need to call the `deb` or `rpm` one.
46
+ The package will be output into the `pkg` folder; you can see the packaged
47
+ content into the `build` folder. _Package name_ will respect the following
48
+ format:
49
+
50
+ puppet-mod-<author>-<module_name>
51
+
52
+ The information needed to build the package are carved out from the
53
+ `Modulefile`. In particular, there must be a `name` and a `version` field; the
54
+ first one must be in the form `author/module_name`. All other fields are
55
+ optional and are mapped into package fields with equivalent meaning.
56
+
57
+ **NOTE**: The module will be installed under `/usr/share/puppet/modules`, not
58
+ into `/etc/puppet`!
59
+
60
+ ## Compatibility
61
+
62
+ OS compatibility resembles the one of FPM; in particular:
63
+
64
+ * on **OS X**, only Debian packages can be built
65
+ * in order to create RPMs on other platforms, the `rpmbuild` command must be
66
+ present on the system. This can be obtained with:
67
+ * `apt-get install rpm` (Debian-based)
68
+ * `yum install rpm-build` (RedHat-based)
69
+
70
+ ## Contributing
71
+
72
+ 1. Fork it
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create new Pull Request
77
+
78
+ ## Testing
79
+
80
+ Executed tests vary depending on tools availability. In particular, end-to-end
81
+ tests involving generation of an RPM package are not run if `rpmbuild` is not
82
+ found on the system. To ease development, a `Vagrantfile` is provided, complete
83
+ with a Puppet manifest to configure the testing host. If you wish to run all
84
+ the tests without installing `rpmbuild`, you can just do the following:
85
+
86
+ vagrant up
87
+ vagrant ssh
88
+ cd /vagrant
89
+ bundle install --path vendor/bundle
90
+ bundle exec rake test:all
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require 'rake/testtask'
2
+ require 'rubygems/tasks'
3
+
4
+ namespace :test do
5
+ suites = [:end_to_end, :unit, :integration]
6
+
7
+ desc "Run all test suites"
8
+ task :all => suites
9
+
10
+ suites.each do |suite|
11
+ Rake::TestTask.new suite do |t|
12
+ t.libs << 'lib'
13
+ t.libs << 'test'
14
+ t.pattern = "test/#{suite}/**/*.rb"
15
+ t.verbose = true
16
+ end
17
+ end
18
+ end
19
+
20
+ Gem::Tasks.new
21
+
22
+ task :default => "test:all"
data/Vagrantfile ADDED
@@ -0,0 +1,11 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+ config.vm.box = "ubuntu-base-oss"
6
+ config.vm.box_url = "http://vagrantboxes.derecom.it/boxes/ubuntu-base-oss.box"
7
+ config.vm.provision :puppet do |puppet|
8
+ puppet.manifests_path = "test"
9
+ puppet.manifest_file = "test_vm.pp"
10
+ end
11
+ end
@@ -0,0 +1,120 @@
1
+ class Class
2
+ def type(sym)
3
+ self.class_eval <<-EOS
4
+ def type
5
+ "#{sym.to_s}"
6
+ end
7
+ EOS
8
+ end
9
+
10
+ def filename(str)
11
+ self.class_eval <<-EOS
12
+ def filename
13
+ "#{str}"
14
+ end
15
+ EOS
16
+ end
17
+ end
18
+
19
+ module PuppetModule
20
+ module Pkg
21
+ class Tasks
22
+ class Build
23
+ def initialize(system)
24
+ @sys = system
25
+ end
26
+
27
+ def invoke(mod, opts)
28
+ self.modinfo = mod
29
+ self.build_opts = opts
30
+
31
+ @sys.mkdir opts.pkg_dir
32
+ @sys.sh("fpm #{fpm_opts} #{installed_files}")
33
+ end
34
+
35
+ def type
36
+ raise NotImplementedError
37
+ end
38
+
39
+ def filename
40
+ raise NotImplementedError
41
+ end
42
+
43
+ private
44
+
45
+ attr_accessor :modinfo
46
+ attr_accessor :build_opts
47
+
48
+ def fpm_opts
49
+ [ src_fmt,
50
+ dest_fmt,
51
+ name,
52
+ version,
53
+ arch,
54
+ maintainer,
55
+ url,
56
+ description,
57
+ license,
58
+ chdir,
59
+ output ].join " "
60
+ end
61
+
62
+ def pkg_name
63
+ "puppet-mod-#{modinfo.author}-#{modinfo.name}"
64
+ end
65
+
66
+ def name
67
+ "-n #{pkg_name}"
68
+ end
69
+
70
+ def version
71
+ "-v #{modinfo.version}"
72
+ end
73
+
74
+ def arch
75
+ "-a all"
76
+ end
77
+
78
+ def maintainer
79
+ optionally('-m', modinfo.author_full)
80
+ end
81
+
82
+ def url
83
+ optionally('--url', modinfo.project_page)
84
+ end
85
+
86
+ def description
87
+ optionally('--description', modinfo.summary)
88
+ end
89
+
90
+ def license
91
+ optionally('--license', modinfo.license)
92
+ end
93
+
94
+ def src_fmt
95
+ "-s dir"
96
+ end
97
+
98
+ def chdir
99
+ "-C #{build_opts.install_dir}"
100
+ end
101
+
102
+ def installed_files
103
+ "."
104
+ end
105
+
106
+ def output
107
+ "-p #{build_opts.pkg_dir}/#{filename}"
108
+ end
109
+
110
+ def dest_fmt
111
+ "-t #{type}"
112
+ end
113
+
114
+ def optionally(switch, field)
115
+ field ? "#{switch} '#{field}'" : ""
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,15 @@
1
+ module PuppetModule
2
+ module Pkg
3
+ class Tasks
4
+ class Clean
5
+ def initialize(system)
6
+ @sys = system
7
+ end
8
+
9
+ def invoke(mod, opts)
10
+ @sys.rm opts.install_dir
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ require 'puppet_module/pkg/tasks/build'
2
+
3
+ module PuppetModule
4
+ module Pkg
5
+ class Tasks
6
+ class Deb < Build
7
+ type :deb
8
+
9
+ filename '#{pkg_name}_VERSION_ARCH.deb'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ module PuppetModule
2
+ module Pkg
3
+ class Tasks
4
+ class Install
5
+ def initialize(system)
6
+ @sys = system
7
+ end
8
+
9
+ def invoke(mod, opts)
10
+ @mod_name = mod.name
11
+ @out_dir = opts.install_dir
12
+
13
+ @sys.mkdir install_path
14
+ @sys.cp assets_to_install, install_path
15
+ end
16
+
17
+ private
18
+
19
+ def install_path
20
+ File.join(@out_dir, dest_path, @mod_name)
21
+ end
22
+
23
+ def dest_path
24
+ '/usr/share/puppet/modules'
25
+ end
26
+
27
+ def assets_to_install
28
+ ['manifests','templates','lib','files']
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,69 @@
1
+ require 'ostruct'
2
+
3
+ module PuppetModule
4
+ module Pkg
5
+ class Tasks
6
+ class Modulefile
7
+ def self.parse(file)
8
+ self.new(File.read(file)).metadata
9
+ end
10
+
11
+ attr_reader :metadata
12
+
13
+ def initialize(str)
14
+ @metadata = OpenStruct.new
15
+ binding.eval str
16
+ validate_required_fields
17
+ end
18
+
19
+ def method_missing(*args)
20
+ # TODO: Maybe display an info message about the
21
+ # unrecognized/unsupported field? (it might be a typo, so the user
22
+ # might be happy to know what have been ignored)
23
+ end
24
+
25
+ private
26
+
27
+ def name(s)
28
+ @metadata.author, @metadata.name = s.split '/'
29
+ end
30
+
31
+ def version(s)
32
+ @metadata.version = s
33
+ end
34
+
35
+ def source(s)
36
+ @metadata.source = s
37
+ end
38
+
39
+ def author(s)
40
+ @metadata.author_full = s
41
+ end
42
+
43
+ def license(s)
44
+ @metadata.license = s
45
+ end
46
+
47
+ def summary(s)
48
+ @metadata.summary = s
49
+ end
50
+
51
+ def description(s)
52
+ @metadata.description = s
53
+ end
54
+
55
+ def project_page(s)
56
+ @metadata.project_page = s
57
+ end
58
+
59
+ def validate_required_fields
60
+ raise ArgumentError, 'Modulefile doesn`t contain name or author' unless
61
+ @metadata.name and @metadata.author
62
+
63
+ raise ArgumentError, 'Modulefile doesn`t contain version information' unless
64
+ @metadata.version
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,42 @@
1
+ require 'rake/tasklib'
2
+
3
+ require 'puppet_module/pkg/tasks/system'
4
+ require 'puppet_module/pkg/tasks/deb'
5
+ require 'puppet_module/pkg/tasks/rpm'
6
+ require 'puppet_module/pkg/tasks/install'
7
+ require 'puppet_module/pkg/tasks/clean'
8
+
9
+ module PuppetModule
10
+ module Pkg
11
+ class Tasks
12
+ class RakeTasks < Rake::TaskLib
13
+ def initialize(mod_info)
14
+ sys = System.new
15
+ options = OpenStruct.new(
16
+ :install_dir => 'build',
17
+ :pkg_dir => 'pkg')
18
+
19
+ desc "Install the module in a local temp dir"
20
+ task :install => :clean do
21
+ Install.new(sys).invoke(mod_info, options)
22
+ end
23
+
24
+ desc "Clean build artifacts"
25
+ task :clean do
26
+ Clean.new(sys).invoke(mod_info, options)
27
+ end
28
+
29
+ desc "Wraps the module into a Debian package"
30
+ task :deb => :install do
31
+ Deb.new(sys).invoke(mod_info, options)
32
+ end
33
+
34
+ desc "Wraps the module into a RPM package"
35
+ task :rpm => :install do
36
+ RPM.new(sys).invoke(mod_info, options)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,13 @@
1
+ require 'puppet_module/pkg/tasks/build'
2
+
3
+ module PuppetModule
4
+ module Pkg
5
+ class Tasks
6
+ class RPM < Build
7
+ type :rpm
8
+
9
+ filename '#{pkg_name}-VERSION.ARCH.rpm'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ module PuppetModule
2
+ module Pkg
3
+ class Tasks
4
+ class System
5
+ def mkdir(path)
6
+ FileUtils.mkdir_p path
7
+ end
8
+
9
+ def cp(src, dest)
10
+ sanitized_src = src.is_a?(Range) ? src.to_a : src
11
+
12
+ FileUtils.cp_r sanitized_src, dest
13
+ end
14
+
15
+ def rm(path)
16
+ FileUtils.rm_rf path
17
+ end
18
+
19
+ def sh(cmd)
20
+ `#{cmd}`
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ require 'puppet_module/pkg/tasks/rake_tasks'
2
+
3
+ require 'puppet_module/pkg/tasks/modulefile'
4
+
5
+ module PuppetModule
6
+ module Pkg
7
+ class Tasks
8
+ def initialize
9
+ RakeTasks.new(Modulefile.parse("Modulefile"))
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module PuppetModule
2
+ module Pkg
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $:.unshift(lib) unless $:.include?(lib)
4
+
5
+ require 'pathname'
6
+ require 'puppet_module/pkg/version'
7
+
8
+ signing_key_file = ENV['RUBYGEMS_SIGNING_KEY_FILE']
9
+
10
+ Gem::Specification.new do |spec|
11
+ spec.name = "puppet_module_packaging"
12
+ spec.version = PuppetModule::Pkg::VERSION
13
+ spec.authors = ["Stefano Zanella"]
14
+ spec.email = ["zanella.stefano@gmail.com"]
15
+ spec.summary = %q{Rake tasks for packaging Puppet modules}
16
+ spec.homepage = "https://github.com/stefanozanella/puppet_module_packaging"
17
+ spec.license = "MIT"
18
+ spec.description = <<-EOS
19
+ puppet_module_packaging provides some Rake tasks to ease wrapping Puppet
20
+ modules into proper system packages like deb and rpm.
21
+ EOS
22
+
23
+ spec.files = `git ls-files`.split($/)
24
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_runtime_dependency "fpm", "~> 0.4"
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rubygems-tasks"
33
+ spec.add_development_dependency "minitest"
34
+ spec.add_development_dependency "minitest-filesystem"
35
+ spec.add_development_dependency "minitest-around"
36
+ spec.add_development_dependency "mocha"
37
+
38
+ spec.signing_key = Pathname.new(signing_key_file).expand_path if signing_key_file
39
+ spec.cert_chain = ["rubygems-stefanozanella.crt"]
40
+ end
@@ -0,0 +1,20 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA96YW5l
3
+ bGxhLnN0ZWZhbm8xFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
4
+ ARkWA2NvbTAeFw0xMzA4MDcxOTA2MDZaFw0xNDA4MDcxOTA2MDZaMEYxGDAWBgNV
5
+ BAMMD3phbmVsbGEuc3RlZmFubzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
6
+ CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
7
+ 2JCnJCnjjs62MR/Tw/4WgSG42ruiCEqXV1ECMsXymHPE8xyHkYAwLXvBRzOkZ/IA
8
+ puJ1XhScduMRcUuE0ZPA5N2HBZI0WsmyyNTYBjOob8m0SNInoRZfIMloj3D8QzB7
9
+ /6G5HLMWNx60JEpIDgfXvIuSRKNKQ0/0+/G/H4COgj72pd3F4dYltvx+mSwPRq7Q
10
+ MdZsK3T5Q3d4eLBY1VSlJpq0wkwdEWTXAhR0Mfmbn1D8m9IhJfubgXuXVBY4OPO8
11
+ KAF/wWqTkzA6guVQlSKdZR4vwms7OpeFkotnivBKa6JwUQSXO8AZEyy53V8cSYDu
12
+ dbaFi53YbEwOWSMQnW8/kQIDAQABozkwNzAdBgNVHQ4EFgQUcBKkmJAvSTKfDf7z
13
+ LEu1wE+Rk+swCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQAD
14
+ ggEBAMeqfk1l4Y0iZ8jNiu0afcQ60DVqBkRtrT/rsZEqGsdOw11bntOE4yWpo4Kd
15
+ Y0C/kYrVQ/mIN7IGKbCSjES3aYdQftV9SRW77FA25m2KXRbnEYtJDUX35gAqSdRY
16
+ 9IiYivsMq2dr70eKPNFrFOwWvmwhcGyEG8EDvYoXWllke7RGz1Dn/AZx6jPnShO+
17
+ 0ru4OXsM9++md3sGXIugEFNygvo2/1yQoTe6+XiBocS+pWsJd6JZBfkxPRT4Dz4H
18
+ RigBD0E3/t/ABjCXkmqwp5gnAZmP8JiVUkn8rp5E0FXvC8T7nsPs2TW/TAmUV6rN
19
+ hK25FX8YWgT9fD9y3PpWjiYcrCo=
20
+ -----END CERTIFICATE-----
File without changes
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ describe 'clean task' do
4
+ around do |t|
5
+ do_into_tmp_module('testmod', t)
6
+ end
7
+
8
+ it 'removes the directories produced by the install task' do
9
+ `rake install`
10
+ `rake clean`
11
+
12
+ refute directory?('build'), 'expected build dir to have been wiped, but it was still there'
13
+ end
14
+ end
@@ -0,0 +1,34 @@
1
+ require 'test_helper'
2
+
3
+ describe 'install task' do
4
+ around do |t|
5
+ do_into_tmp_module('testmod', t)
6
+ end
7
+
8
+ describe 'by default' do
9
+ let(:output_dir) { 'build/usr/share/puppet/modules/testmod' }
10
+
11
+ it 'installs all module dirs into the `build` subfolder' do
12
+ `rake install`
13
+
14
+ assert directory?(output_dir), "expected #{output_dir} to exist, but it didn't"
15
+ filesystem {
16
+ dir 'manifests' do
17
+ file 'init.pp'
18
+ end
19
+
20
+ dir 'files' do
21
+ file 'example.dat'
22
+ end
23
+
24
+ dir 'templates' do
25
+ file 'config.erb'
26
+ end
27
+
28
+ dir 'lib' do
29
+ file 'utils.rb'
30
+ end
31
+ }.must_exist_within output_dir
32
+ end
33
+ end
34
+ end