diff --git a/bin/puppet/.bundle/config b/.bundle/config similarity index 82% rename from bin/puppet/.bundle/config rename to .bundle/config index 4398f63..e22421c 100644 --- a/bin/puppet/.bundle/config +++ b/.bundle/config @@ -1,4 +1,5 @@ --- +BUNDLE_DISABLE_SHARED_GEMS: "true" BUNDLE_JOBS: "3" BUNDLE_PATH: "vendor/bundle" -BUNDLE_DISABLE_SHARED_GEMS: "true" +BUNDLE_RETRY: "3" diff --git a/.gitignore b/.gitignore index 52f4df7..115655a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -.vagrant/ -bin/puppet/vendor/ +/.vagrant/ +/vendor/ + diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..005119b --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.4.1 diff --git a/.travis.yml b/.travis.yml index 7002068..48b66b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,12 @@ -language: python -python: -- '2.7' -- '3.3' -- pypy -script: pytest +language: ruby +cache: bundler +rvm: + - 2.4.1 + - 2.3.1 + - 2.2.0 + - 2.0.0 + +notifications: + slack: + secure: "HLf1vdPyg/2ezvShnwmRRtkXXap2yrMCsbU9Ow2moIhdPfDBhecXBBUsZ7/9vkIq6aTjvNb40708Q72Ndhycr1v9BE4y1KGTxcid99IhRuQEBFKkJRQpRSAqUhKq46hgUb986alQ5NoxYfMgXIC9+HzQYkoM1TXVrS3+D0cqBpkjUGl5pBG2DCa6nyAVeXzmVcs4+xeEOhkblfE5I7mXiFO0/aVcUeo+TYwSwDslPWx8OFd2PJjuceLMM8B1iBk4zY47FMdveUSA4lDQAtYMantiJvUrAGcyOUNEQZ8AsvVHuYW4HL3h3dvKXy6DM9ejwYxSFIYYtDlfCvTkY/m5HPCXvwLjABxV1JGCNkVs2vhmiCcvKSt4T4IdPxoGnMiT0UljVke5SY16hYaHkoaBtuzkRqCkRjD+nyPH5Y90c4D0uhrlob9dmUS7RkRqIZRDoaPoNS2xfrIHyEpsaXYr4rY0gBVB+ILd1DWJPIyAjRURkOVxKg1+0Tslq3B1FLAMmW/SkqYTtek680I5r+BDPFA9Eo+hxYqpWed/j68imRy6x6ZvwjS0ku+TG1G4z3P0W0wbys31/uC0PRP6YRJt1APKYxzP13rMWc21LXJoUgFtu19PbaCG2tHeb2oEdWkv3ilbbpMogjkU0+lrBP3ZLSIduuEvDDC9kpQy6Nrea5Y=" diff --git a/bin/puppet/Gemfile b/Gemfile similarity index 63% rename from bin/puppet/Gemfile rename to Gemfile index 30fd8f3..82a5138 100644 --- a/bin/puppet/Gemfile +++ b/Gemfile @@ -1,23 +1,28 @@ # vim:ft=ruby source 'https://rubygems.org' +ruby '>= 2.0.0' + if ENV.key?('PUPPET_VERSION') puppetversion = "#{ENV['PUPPET_VERSION']}" else puppetversion = ['~> 4.0'] end -group :development, :unit_tests do +group :production do + gem 'os', '~> 1.0' + gem 'puppet', puppetversion + gem 'r10k', '~> 2.3' + gem 'rugged', '~> 0.24' +end - gem 'json', '>= 2.0.2' - gem 'json_pure', '>= 2.0.2' - gem 'metadata-json-lint', '~> 1.0' - gem 'puppet', puppetversion - gem 'puppetlabs_spec_helper', '~> 1.1' - gem 'r10k', '~> 2.3' - gem 'rspec-puppet', '~> 2.5' - gem 'rugged', '~> 0.24' - gem 'yamllint', '~> 0.0.9' +group :development, :unit_tests do + gem 'json', '>= 2.0.2' + gem 'json_pure', '>= 2.0.2' + gem 'metadata-json-lint', '~> 1.0' + gem 'puppetlabs_spec_helper', '~> 1.1' + gem 'rspec-puppet', '~> 2.5' + gem 'yamllint', '~> 0.0.9' # puppet-lint and plugins gem 'puppet-lint', '~> 1.1' diff --git a/bin/puppet/Gemfile.lock b/Gemfile.lock similarity index 91% rename from bin/puppet/Gemfile.lock rename to Gemfile.lock index 6cece14..7879ac3 100644 --- a/bin/puppet/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,14 @@ GEM remote: https://rubygems.org/ specs: + CFPropertyList (2.2.8) colored (1.2) cri (2.6.1) colored (~> 1.2) diff-lcs (1.3) facter (2.4.6) + facter (2.4.6-universal-darwin) + CFPropertyList (~> 2.2.6) faraday (0.9.2) multipart-post (>= 1.2, < 3) faraday_middleware (0.10.1) @@ -33,10 +36,16 @@ GEM metaclass (~> 0.0.1) multi_json (1.12.1) multipart-post (2.0.0) + os (1.0.0) puppet (4.5.3) facter (> 2.0, < 4) hiera (>= 2.0, < 4) json_pure + puppet (4.5.3-universal-darwin) + CFPropertyList (~> 2.2.6) + facter (> 2.0, < 4) + hiera (>= 2.0, < 4) + json_pure puppet-lint (1.1.0) puppet-lint-absolute_classname-check (0.2.4) puppet-lint (>= 1.0, < 3.0) @@ -108,11 +117,14 @@ GEM PLATFORMS ruby + x86_64-darwin-16 + x86_64-linux DEPENDENCIES json (>= 2.0.2) json_pure (>= 2.0.2) metadata-json-lint (~> 1.0) + os (~> 1.0) puppet (~> 4.0) puppet-lint (~> 1.1) puppet-lint-absolute_classname-check (~> 0.2) @@ -131,5 +143,8 @@ DEPENDENCIES rugged (~> 0.24) yamllint (~> 0.0.9) +RUBY VERSION + ruby 2.3.1p112 + BUNDLED WITH 1.14.6 diff --git a/README.md b/README.md index d2d2590..5b0a55e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ My dot files and a tool to deploy them to various OS's * files in [link/](link) get symlinked to `~/.{filename}` * files in [copy/](copy) get copied to `~/.{filename}` * this process should default to not clobbering existing files -* [bin/dots.py](bin/dots.py) is what users will interact with +* [bin/dots.rb](bin/dots.rb) is what users will interact with * it should bootstrap based on the OS it is being run on * it should run Puppet and associated tools such as r10k via bundler * it should not utilize Git submodules; it should instead use [vcsrepo](https://forge.puppet.com/puppetlabs/vcsrepo) @@ -30,7 +30,7 @@ My dot files and a tool to deploy them to various OS's ```bash git clone git@github.com:genebean/dots.git ~/.dotfiles -cd ~/.dotfiles/bin/puppet +cd ~/.dotfiles bundle install -bundle exec r10k puppetfile install --moduledir vendor/puppet_modules --puppetfile Puppetfile -v +bundle exec r10k puppetfile install --moduledir vendor/puppet_modules --puppetfile puppet/Puppetfile -v ``` diff --git a/bin/dots.py b/bin/dots.py deleted file mode 100644 index 0c25d4c..0000000 --- a/bin/dots.py +++ /dev/null @@ -1,16 +0,0 @@ -import platform - -my_platform=platform.platform().lower() -if 'darwin' in my_platform: - mac_version=platform.mac_ver()[0].split('.') - if int(mac_version[0]) == 10 and int(mac_version[1]) >= 12: - print("It seems you are on macOS") - elif int(mac_version[0]) == 10 and int(mac_version[1]) < 12: - print("It seems you are on OS X") - else: - print("What tha... you're Apple is pre-OS X (" + platform.mac_ver()[0] + " to be exact)" ) -elif 'linux' in my_platform: - print("It seems you are on Linux") -else: - print("Not sure what OS you are on but here's what I see: " + my_platform) - diff --git a/bin/dots.rb b/bin/dots.rb new file mode 100755 index 0000000..1991051 --- /dev/null +++ b/bin/dots.rb @@ -0,0 +1,23 @@ +require 'open3' +require 'os' + +if OS.mac? + stdout, _stderr, _status = Open3.capture3('sw_vers -productVersion') + if Integer(stdout.strip.split('.')[0]) == 10 + if Integer(stdout.strip.split('.')[1]) >= 12 + puts "It seems you are on macOS #{stdout.strip}" + else + puts "It seems you are on OX X #{stdout.strip}" + end + 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}") + end +elsif OS.liux? + puts 'It seems you are on Linux' +elsif OS.windows? + puts 'It seems you are on Windows' +else + abort("I'm not sure what to do with this OS...") +end diff --git a/bin/puppet/Puppetfile b/puppet/Puppetfile similarity index 100% rename from bin/puppet/Puppetfile rename to puppet/Puppetfile diff --git a/bin/puppet/environment.conf b/puppet/environment.conf similarity index 100% rename from bin/puppet/environment.conf rename to puppet/environment.conf diff --git a/bin/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml similarity index 100% rename from bin/puppet/hieradata/common.yaml rename to puppet/hieradata/common.yaml diff --git a/bin/puppet/hieradata/nodes/example-node.yaml b/puppet/hieradata/nodes/example-node.yaml similarity index 100% rename from bin/puppet/hieradata/nodes/example-node.yaml rename to puppet/hieradata/nodes/example-node.yaml diff --git a/bin/puppet/manifests/site.pp b/puppet/manifests/site.pp similarity index 100% rename from bin/puppet/manifests/site.pp rename to puppet/manifests/site.pp diff --git a/bin/puppet/scripts/code_manager_config_version.rb b/puppet/scripts/code_manager_config_version.rb similarity index 100% rename from bin/puppet/scripts/code_manager_config_version.rb rename to puppet/scripts/code_manager_config_version.rb diff --git a/bin/puppet/scripts/config_version.rb b/puppet/scripts/config_version.rb similarity index 100% rename from bin/puppet/scripts/config_version.rb rename to puppet/scripts/config_version.rb diff --git a/bin/puppet/scripts/config_version.sh b/puppet/scripts/config_version.sh similarity index 100% rename from bin/puppet/scripts/config_version.sh rename to puppet/scripts/config_version.sh diff --git a/bin/puppet/site/profile/manifests/base.pp b/puppet/site/profile/manifests/base.pp similarity index 100% rename from bin/puppet/site/profile/manifests/base.pp rename to puppet/site/profile/manifests/base.pp diff --git a/bin/puppet/site/role/manifests/server.pp b/puppet/site/role/manifests/server.pp similarity index 100% rename from bin/puppet/site/role/manifests/server.pp rename to puppet/site/role/manifests/server.pp diff --git a/bin/puppet/site/role/manifests/workstation.pp b/puppet/site/role/manifests/workstation.pp similarity index 100% rename from bin/puppet/site/role/manifests/workstation.pp rename to puppet/site/role/manifests/workstation.pp diff --git a/bin/puppet/r10k.yaml b/r10k.yaml similarity index 100% rename from bin/puppet/r10k.yaml rename to r10k.yaml