vanagon 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db5e799055a41530a8526f5b169598bd3d158f01
4
- data.tar.gz: 541a9c6a444f670d0101b191cb6511108429d782
3
+ metadata.gz: 8b0e96f27593b42424b55cc7ba76070664a735c8
4
+ data.tar.gz: 47a0c3146160d374f6879e1b8a9c71f0aaf72215
5
5
  SHA512:
6
- metadata.gz: 6782736f6b1733dab4b193dc3f1364591c41c5d5681e415f6f9b32d9fc6553ab59b18bce081ec90e7e960e2f65e50d0c7a2c3cd18bc9fd88907ad63fd1b09bd7
7
- data.tar.gz: 622a7d7b4b5060eb1ccfc5ba0b5e4d9b5128e5a34b665868a090d312280d79bb546ba243a091efbeba3a4599abb6300275750f4c8807a49e6e0ce7e0d294797e
6
+ metadata.gz: c17032026ae9f33b3c82126210e8db967068156a4ba3c348c6590fb88b44905b30e23a75f55d17da31ae4e5bd7e87c16718d9c7d9a6e2987f1d50130c0fe9860
7
+ data.tar.gz: 434b37c3e194ade303bdb2402fcc201f23cdf1a5316f723b2fa573506aa624178bfbb7a8c05ee3595c312436fc607ad3f213c67f7dc49176cd34a80045faffe8
@@ -226,9 +226,18 @@ class Vanagon
226
226
  # @param target [String] path to the desired target of the file
227
227
  # @param owner [String] owner of the file
228
228
  # @param group [String] group owner of the file
229
- def install_file(source, target, mode: '0644', owner: nil, group: nil)
229
+ def install_file(source, target, mode: nil, owner: nil, group: nil) # rubocop:disable Metrics/AbcSize
230
230
  @component.install << "#{@component.platform.install} -d '#{File.dirname(target)}'"
231
231
  @component.install << "#{@component.platform.copy} -p '#{source}' '#{target}'"
232
+
233
+ if @component.platform.is_windows?
234
+ unless mode.nil? && owner.nil? && group.nil?
235
+ warn "You're trying to set the mode, owner, or group for windows. I don't know how to do that, ignoring!"
236
+ end
237
+ else
238
+ mode ||= '0644'
239
+ @component.install << "chmod #{mode} '#{target}'"
240
+ end
232
241
  @component.add_file Vanagon::Common::Pathname.file(target, mode: mode, owner: owner, group: group)
233
242
  end
234
243
 
@@ -369,7 +378,16 @@ class Vanagon
369
378
  # @param mode [String] octal mode to apply to the directory
370
379
  # @param owner [String] owner of the directory
371
380
  # @param group [String] group of the directory
372
- def directory(dir, mode: nil, owner: nil, group: nil)
381
+ def directory(dir, mode: nil, owner: nil, group: nil) # rubocop:disable Metrics/AbcSize
382
+ install_flags = ['-d']
383
+ if @component.platform.is_windows?
384
+ unless mode.nil? && owner.nil? && group.nil?
385
+ warn "You're trying to set the mode, owner, or group for windows. I don't know how to do that, ignoring!"
386
+ end
387
+ else
388
+ install_flags << "-m '#{mode}'" unless mode.nil?
389
+ end
390
+ @component.install << "#{@component.platform.install} #{install_flags.join(' ')} '#{dir}'"
373
391
  @component.directories << Vanagon::Common::Pathname.new(dir, mode: mode, owner: owner, group: group)
374
392
  end
375
393
 
@@ -69,6 +69,7 @@ end" }
69
69
  before do
70
70
  allow(platform).to receive(:install).and_return('install')
71
71
  allow(platform).to receive(:copy).and_return('cp')
72
+ allow(platform).to receive(:is_windows?).and_return(false)
72
73
  end
73
74
 
74
75
  describe "#md5sum" do
@@ -576,6 +577,7 @@ end" }
576
577
  comp.install_file('thing1', 'place/to/put/thing1', owner: 'bob', group: 'timmy', mode: '0022')
577
578
  expect(comp._component.install).to include("install -d 'place/to/put'")
578
579
  expect(comp._component.install).to include("cp -p 'thing1' 'place/to/put/thing1'")
580
+ expect(comp._component.install).to include("chmod 0022 'place/to/put/thing1'")
579
581
  expect(comp._component.files).to include(Vanagon::Common::Pathname.file('place/to/put/thing1', mode: '0022', owner: 'bob', group: 'timmy'))
580
582
  end
581
583
  end
@@ -716,32 +718,36 @@ end" }
716
718
 
717
719
  describe '#directory' do
718
720
  it 'adds a directory with the desired path to the directory collection for the component' do
719
- comp = Vanagon::Component::DSL.new('directory-test', {}, {})
721
+ comp = Vanagon::Component::DSL.new('directory-test', {}, platform)
720
722
  comp.directory('/a/b/c')
721
723
  expect(comp._component.directories).to include(Vanagon::Common::Pathname.new('/a/b/c'))
722
724
  end
723
725
 
724
726
  it 'adds a directory with the desired mode to the directory collection for the component' do
725
- comp = Vanagon::Component::DSL.new('directory-test', {}, {})
727
+ comp = Vanagon::Component::DSL.new('directory-test', {}, platform)
726
728
  comp.directory('/a/b/c', mode: '0755')
729
+ expect(comp._component.install).to include("install -d -m '0755' '/a/b/c'")
727
730
  expect(comp._component.directories.first).to eq(Vanagon::Common::Pathname.new('/a/b/c', mode: '0755'))
728
731
  end
729
732
 
730
733
  it 'adds a directory with the desired owner to the directory collection for the component' do
731
- comp = Vanagon::Component::DSL.new('directory-test', {}, {})
734
+ comp = Vanagon::Component::DSL.new('directory-test', {}, platform)
732
735
  comp.directory('/a/b/c', owner: 'olivia')
736
+ expect(comp._component.install).to include("install -d '/a/b/c'")
733
737
  expect(comp._component.directories.first).to eq(Vanagon::Common::Pathname.new('/a/b/c', owner: 'olivia'))
734
738
  end
735
739
 
736
740
  it 'adds a directory with the desired group to the directory collection for the component' do
737
- comp = Vanagon::Component::DSL.new('directory-test', {}, {})
741
+ comp = Vanagon::Component::DSL.new('directory-test', {}, platform)
738
742
  comp.directory('/a/b/c', group: 'release-engineering')
743
+ expect(comp._component.install).to include("install -d '/a/b/c'")
739
744
  expect(comp._component.directories.first).to eq(Vanagon::Common::Pathname.new('/a/b/c', group: 'release-engineering'))
740
745
  end
741
746
 
742
747
  it 'adds a directory with the desired attributes to the directory collection for the component' do
743
- comp = Vanagon::Component::DSL.new('directory-test', {}, {})
748
+ comp = Vanagon::Component::DSL.new('directory-test', {}, platform)
744
749
  comp.directory('/a/b/c', mode: '0400', owner: 'olivia', group: 'release-engineering')
750
+ expect(comp._component.install).to include("install -d -m '0400' '/a/b/c'")
745
751
  expect(comp._component.directories.first).to eq(Vanagon::Common::Pathname.new('/a/b/c', mode: '0400', owner: 'olivia', group: 'release-engineering'))
746
752
  end
747
753
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-31 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  requirements: []
241
241
  rubyforge_project:
242
- rubygems_version: 2.2.5
242
+ rubygems_version: 2.6.11
243
243
  signing_key:
244
244
  specification_version: 3
245
245
  summary: All of your packages will fit into this van with this one simple trick.