mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 01:17:42 -04:00
More testing
This commit is contained in:
parent
d008f064cc
commit
1241ef7c85
9 changed files with 65 additions and 23 deletions
5
.rubocop.yml
Normal file
5
.rubocop.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
AllCops:
|
||||
Exclude:
|
||||
- 'vendor/**/*'
|
||||
- 'spec/fixtures/**/*'
|
||||
TargetRubyVersion: 2.0
|
||||
5
Gemfile
5
Gemfile
|
|
@ -1,11 +1,13 @@
|
|||
# vim:ft=ruby
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# rubocop:disable ConditionalAssignment
|
||||
if ENV.key?('PUPPET_VERSION')
|
||||
puppetversion = "#{ENV['PUPPET_VERSION']}"
|
||||
puppetversion = ENV['PUPPET_VERSION'].to_s
|
||||
else
|
||||
puppetversion = ['~> 4.0']
|
||||
end
|
||||
# rubocop:enable ConditionalAssignment
|
||||
|
||||
group :production do
|
||||
gem 'os', '~> 1.0'
|
||||
|
|
@ -20,6 +22,7 @@ group :development, :unit_tests do
|
|||
gem 'metadata-json-lint', '~> 1.0'
|
||||
gem 'puppetlabs_spec_helper', '~> 1.1'
|
||||
gem 'rspec-puppet', '~> 2.5'
|
||||
gem 'rubocop', '~> 0.48'
|
||||
gem 'yamllint', '~> 0.0.9'
|
||||
|
||||
# puppet-lint and plugins
|
||||
|
|
|
|||
15
Gemfile.lock
15
Gemfile.lock
|
|
@ -2,6 +2,7 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (2.2.8)
|
||||
ast (2.3.0)
|
||||
colored (1.2)
|
||||
cri (2.6.1)
|
||||
colored (~> 1.2)
|
||||
|
|
@ -37,6 +38,9 @@ GEM
|
|||
multi_json (1.12.1)
|
||||
multipart-post (2.0.0)
|
||||
os (1.0.0)
|
||||
parser (2.4.0.0)
|
||||
ast (~> 2.2)
|
||||
powerpack (0.1.1)
|
||||
puppet (4.5.3)
|
||||
facter (> 2.0, < 4)
|
||||
hiera (>= 2.0, < 4)
|
||||
|
|
@ -90,6 +94,8 @@ GEM
|
|||
multi_json (~> 1.10)
|
||||
puppet_forge (~> 2.2)
|
||||
semantic_puppet (~> 0.1.0)
|
||||
rainbow (2.2.2)
|
||||
rake
|
||||
rake (12.0.0)
|
||||
rspec (3.6.0)
|
||||
rspec-core (~> 3.6.0)
|
||||
|
|
@ -106,12 +112,20 @@ GEM
|
|||
rspec-puppet (2.5.0)
|
||||
rspec
|
||||
rspec-support (3.6.0)
|
||||
rubocop (0.48.1)
|
||||
parser (>= 2.3.3.1, < 3.0)
|
||||
powerpack (~> 0.1)
|
||||
rainbow (>= 1.99.1, < 3.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||
ruby-progressbar (1.8.1)
|
||||
rugged (0.25.1.1)
|
||||
semantic_puppet (0.1.4)
|
||||
gettext-setup (>= 0.3)
|
||||
spdx-licenses (1.1.0)
|
||||
text (1.3.1)
|
||||
trollop (2.1.2)
|
||||
unicode-display_width (1.2.1)
|
||||
yamllint (0.0.9)
|
||||
trollop (~> 2)
|
||||
|
||||
|
|
@ -140,6 +154,7 @@ DEPENDENCIES
|
|||
puppetlabs_spec_helper (~> 1.1)
|
||||
r10k (~> 2.3)
|
||||
rspec-puppet (~> 2.5)
|
||||
rubocop (~> 0.48)
|
||||
rugged (~> 0.24)
|
||||
yamllint (~> 0.0.9)
|
||||
|
||||
|
|
|
|||
37
Rakefile
37
Rakefile
|
|
@ -1,3 +1,4 @@
|
|||
require 'rubocop/rake_task'
|
||||
require 'rubygems'
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
|
|
@ -9,28 +10,56 @@ exclude_paths = [
|
|||
'spec/**/*'
|
||||
]
|
||||
|
||||
RuboCop::RakeTask.new
|
||||
RuboCop::RakeTask.new(:rubocop) do |task|
|
||||
# task.patterns = ['lib/**/*.rb']
|
||||
# only show the files with failures
|
||||
# task.formatters = ['files']
|
||||
# don't abort rake on failure
|
||||
# task.fail_on_error = false
|
||||
end
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.ignore_paths = exclude_paths
|
||||
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
|
||||
PuppetLint.configuration.log_format =
|
||||
'%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
|
||||
|
||||
PuppetSyntax.exclude_paths = exclude_paths
|
||||
|
||||
desc 'Validate manifests, templates, and ruby files'
|
||||
task :validate do
|
||||
Dir['puppet/manifests/**/*.pp', 'puppet/site/*/manifests/**/*.pp'].each do |manifest|
|
||||
Dir['puppet/manifests/**/*.pp',
|
||||
'puppet/site/*/manifests/**/*.pp'].each do |manifest|
|
||||
sh "puppet parser validate --noop #{manifest}"
|
||||
end
|
||||
Dir['bin/**/*.rb', 'spec/**/*.rb'].each do |ruby_file|
|
||||
# sh "ruby -c #{ruby_file}" unless ruby_file.match? %r{spec\/fixtures}
|
||||
Dir['bin/**/*.rb',
|
||||
'spec/**/*.rb'].each do |ruby_file|
|
||||
# rubocop:disable RegexpLiteral
|
||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
||||
# rubocop:enable RegexpLiteral
|
||||
end
|
||||
Dir['puppet/site/*/templates/**/*.erb'].each do |template|
|
||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
||||
end
|
||||
end
|
||||
|
||||
YamlLint::RakeTask.new do |yamllint|
|
||||
yamllint.paths = %w[
|
||||
.*.yaml
|
||||
.*.yml
|
||||
*.yaml
|
||||
*.yml
|
||||
copy/**/*.yml
|
||||
link/**/*.yml
|
||||
puppet/hieradata/**/*.yml
|
||||
puppet/hieradata/**/*.yaml
|
||||
]
|
||||
end
|
||||
|
||||
task :tests do
|
||||
Rake::Task[:lint].invoke
|
||||
Rake::Task[:yamllint].invoke
|
||||
Rake::Task[:validate].invoke
|
||||
Rake::Task[:rubocop].invoke
|
||||
Rake::Task[:spec].invoke
|
||||
end
|
||||
|
|
|
|||
4
Vagrantfile
vendored
4
Vagrantfile
vendored
|
|
@ -1,3 +1,3 @@
|
|||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "genebean/centos-7-nocm"
|
||||
Vagrant.configure('2') do |config|
|
||||
config.vm.box = 'genebean/centos-7-nocm'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ if OS.mac?
|
|||
elsif Integer(stdout.strip.split('.')[0]) < 10
|
||||
puts "Wow... you're sure running an old os (#{stdout.strip} to be exact)"
|
||||
else
|
||||
abort("It seems you are on a Mac but I don't know what to do on v#{stdout.strip}")
|
||||
abort("It seems you are on a Mac but I don't know what to do on \
|
||||
v#{stdout.strip}")
|
||||
end
|
||||
elsif OS.liux?
|
||||
puts 'It seems you are on Linux'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
forge "http://forge.puppetlabs.com"
|
||||
# rubocop:disable FileName
|
||||
forge 'http://forge.puppetlabs.com'
|
||||
|
||||
mod 'puppetlabs-vcsrepo', '1.5.0'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'json'
|
||||
|
||||
environmentpath = ARGV[0]
|
||||
environment = ARGV[1]
|
||||
|
||||
r10k_deploy_file_path = File.join(environmentpath, environment, '.r10k-deploy.json')
|
||||
|
||||
# output the sha1 from the control-repo
|
||||
puts JSON.parse(File.read(r10k_deploy_file_path))['signature']
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env ruby
|
||||
begin
|
||||
require 'rugged'
|
||||
rescue LoadError => e
|
||||
rescue LoadError
|
||||
t = Time.new
|
||||
puts t.to_i
|
||||
else
|
||||
|
||||
environmentpath = ARGV[0]
|
||||
environment = ARGV[1]
|
||||
|
||||
|
|
@ -16,7 +15,7 @@ else
|
|||
head_sha = head.target_id
|
||||
|
||||
# the commit message associated the newest commit
|
||||
commit = repo.lookup(head_sha)
|
||||
# commit = repo.lookup(head_sha)
|
||||
|
||||
# add something to find the remote url
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue