kitchenplan 2.1.16 → 2.1.17

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: d46b1bd5831d618ca09aa815b29efd483e2def87
4
- data.tar.gz: e95a103eece0602bb829a96f8d66283af0404eb8
3
+ metadata.gz: ca95e10b1683c13bfb0d0d657df2f1511e1ca229
4
+ data.tar.gz: 7181e239dd59ee7aa0dbd1fe58d6900cdb648f5c
5
5
  SHA512:
6
- metadata.gz: e6e4a94c91c3e314dd38f665892996ac2295ab868731420183863c0d0dd397c74e4d7780cc8297c5cf393ca43ab9269caaa48b544686ead38e017c17c96cfb4a
7
- data.tar.gz: 03fcd97fb043eda7a87c438a5e4663771acccebf5c2996e3c9acc03d03bfc5748fa9198b2ae708bba475d3043628751b5d8fc8860931e6e6f5ebcff4d71b184d
6
+ metadata.gz: ada6b96f543516c6c233b485181c4ebd4fb07a9b8d741266c04d1fba8393387da2b1a0e294e8ad94f9f6d84a0ac66f0d0c8c26389f9663d7de8ebaae7d5e9ef4
7
+ data.tar.gz: 2b2e37c37cd5c0ea57f3e5e45b4dc167b5c723f0ff118b6a62aa3dd12a9138baa90b8f3c0f7767b556d0a6d37854f0a52113e7c66acf11b33127c4d993190acb
data/README.md CHANGED
@@ -2,10 +2,6 @@
2
2
 
3
3
  Kitchenplan is a small tool to fully automate the installation and configuration of an OSX workstation (or server for that matter) using Chef. But while doing so manually is not a trivial undertaking, Kitchenplan has abstracted away all the hard parts.
4
4
 
5
- ## History
6
-
7
- This is a brand new implementation of Kitchenplan. If you have issues with this new versions, please use [version2](https://github.com/kitchenplan/kitchenplan/blob/version2/README.md) for now.
8
-
9
5
  ## Using kitchenplan
10
6
 
11
7
  ### Installation
@@ -78,6 +74,15 @@ Please enter the clone URL of your git config repository: https://github.com/rod
78
74
  run git clone -q https://github.com/roderik/kitchenplan-config.git kitchenplan from "/opt"
79
75
  ```
80
76
 
77
+ *WARNING: Chef v12 breaks everyhting related to the way users work in Kitchenplan. Please update your Gemfile to look like:*
78
+
79
+ ```
80
+ source "https://rubygems.org"
81
+
82
+ gem "chef", "~> 11.0"
83
+ gem "librarian-chef", "~> 0.0.2"
84
+ ```
85
+
81
86
  ### Editing the config files in /opt/kitchenplan/config
82
87
 
83
88
  The most important file is named after your user in config/people/. In my case a roderik.yml file since my username on my Mac is roderik. When running `kitchenplan setup` will create a YAML file in this folder with your username. You can use your config repository for everyone in your organisation by adding a file per username in the people folder.
@@ -129,6 +134,10 @@ At this point Chef will start installing everything you configured. Depending on
129
134
  * [Setting up my perfect dev environment on OSX 10.9 using Chef / Kitchenplan](http://vanderveer.be/setting-up-my-perfect-dev-environment-on-osx-10-9-using-chef-kitchenplan/)
130
135
  * [Presenting Kitchenplan @ vanderveer.be](http://vanderveer.be/blog/2013/04/14/presenting-kitchenplan/)
131
136
 
137
+ ## History
138
+
139
+ This is a brand new implementation of Kitchenplan. If you have issues with this new versions, please use [version2](https://github.com/kitchenplan/kitchenplan/blob/version2/README.md) for now.
140
+
132
141
  ## Contributing to kitchenplan
133
142
 
134
143
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
@@ -4,7 +4,9 @@ module Kitchenplan
4
4
  class Cli < Thor
5
5
  include Thor::Actions
6
6
 
7
- desc 'setup [<gitrepo>] [<target directory>]', 'Setup your workstation to run Kitchenplan and create an example configuration'
7
+ option :gitrepo, :type => :string, :desc => 'Repo with kitchenplan configs', :default => nil
8
+ option :config, :type => :boolean, :desc => 'Create <username>.yml'
9
+ desc 'setup [<target directory>] [--config] [--gitrepo=http://...]', 'Setup your workstation to run Kitchenplan and create an example configuration'
8
10
  long_desc <<-LONGDESC
9
11
  `kitchenplan setup` will install the dependencies of Kitchenplan and create a configuration in /opt/kitchenplan (or <target directory>
10
12
  if you pass it along) to use with the `kitchenplan provision` command.
@@ -12,7 +14,8 @@ module Kitchenplan
12
14
  If you already have a configuration stored in git somewhere, it will ask you to pass the git repo url. If you want to bypass the
13
15
  prompt, pass it along on the commandline. (see .travis.yml for an example)
14
16
  LONGDESC
15
- def setup(gitrepo=nil, targetdir='/opt')
17
+ def setup(targetdir='/opt')
18
+ gitrepo = options[:gitrepo]
16
19
  logo
17
20
  install_clt unless File.exist? "/Library/Developer/CommandLineTools/usr/bin/clang"
18
21
  if gitrepo || File.exists?("#{targetdir}/kitchenplan")
@@ -27,7 +30,8 @@ module Kitchenplan
27
30
  end
28
31
  end
29
32
  unless File.exists?("#{targetdir}/kitchenplan/config/people/#{ENV['USER']}.yml")
30
- user_create = yes?("config/people/#{ENV['USER']}.yml does not exist. Do you wish to create it? [y,n]", :green)
33
+ user_create = options[:config]
34
+ user_create = yes?("config/people/#{ENV['USER']}.yml does not exist. Do you wish to create it? [y,n]", :green) if user_create.nil?
31
35
  if user_create
32
36
  create_user(targetdir)
33
37
  end
@@ -35,33 +39,42 @@ module Kitchenplan
35
39
  end
36
40
 
37
41
  option :debug, :type => :boolean
42
+ option 'no-fetch', :type => :boolean
38
43
  option :recipes, :type => :array
39
- desc 'provision [<target directory>] [--debug] [--recipes=x y z]', 'Provision your workstation with Kitchenplan'
44
+ option :solorb, :type => :string, :default => 'tmp/solo.rb'
45
+ desc 'provision [<target directory>] [--debug] [--recipes=x y z] [--solorb=path] [--no-fetch]', 'Provision your workstation with Kitchenplan'
40
46
  long_desc <<-LONGDESC
41
47
  `kitchenplan provision` will use the configuration in /opt/kitchenplan (or <target directory>
42
48
  if you pass it along) to provision your workstation using Chef.
43
49
 
44
50
  You can optionally pass --debug to see more detail of what's happening.
45
51
 
52
+ Passing --no-fetch will skip updating the librarian sources from remote sources.
53
+
46
54
  If you just want to install a few recipes pass them along with --recipes and it will override the run list (not the attributes!)
47
55
  LONGDESC
48
56
  def provision(targetdir='/opt')
49
57
  logo
58
+ inside("#{targetdir}/kitchenplan") do
59
+ pid = Process.fork do
60
+ dorun "while true; do sudo -n true; sleep 60; kill -0 \"$$\" || exit; done 2>/dev/null"
61
+ end
62
+ Process.detach pid
63
+ end
50
64
  prepare_folders(targetdir)
51
65
  install_bundler(targetdir)
52
- send_ping
53
66
  recipes = parse_config(targetdir)
54
- fetch_cookbooks(targetdir, options[:debug])
55
- run_chef(targetdir, (options[:recipes] ? options[:recipes] : recipes), options[:debug])
67
+ fetch_cookbooks(targetdir, options[:debug]) unless options['no-fetch']
68
+ run_chef(targetdir, (options[:recipes] ? options[:recipes] : recipes), options[:solorb], options[:debug])
56
69
  cleanup(targetdir, options[:debug])
57
70
  print_notice('Installation complete!')
58
71
  end
59
72
 
60
73
  no_commands do
61
74
 
62
- def run_chef(targetdir, recipes, debug=false)
75
+ def run_chef(targetdir, recipes, solo_rb, debug=false)
63
76
  inside("#{targetdir}/kitchenplan") do
64
- dorun "sudo vendor/bin/chef-solo #{( debug ? ' --log_level debug' : ' ' )} -c tmp/solo.rb -j tmp/kitchenplan-attributes.json -o #{recipes.join(',')}"
77
+ dorun "sudo vendor/bin/chef-solo #{( debug ? ' --log_level debug' : ' ' )} -c #{solo_rb} -j tmp/kitchenplan-attributes.json -o #{recipes.join(',')}"
65
78
  end
66
79
  end
67
80
 
@@ -106,15 +119,9 @@ module Kitchenplan
106
119
  end
107
120
  end
108
121
 
109
- def send_ping
110
- print_step('Sending a ping to Google Analytics')
111
- require 'gabba'
112
- Gabba::Gabba.new('UA-46288146-1', 'github.com').event('Kitchenplan', 'Run', ENV['USER'])
113
- end
114
-
115
122
  def fetch(gitrepo, targetdir)
116
123
  prepare_folders(targetdir)
117
- if File.exists?("#{targetdir}/kitchenplan")
124
+ if system("cd #{File.join(targetdir, 'kitchenplan')} && git remote -v | grep origin")
118
125
  print_step "#{targetdir}/kitchenplan already exists, updating from git."
119
126
  inside("#{targetdir}/kitchenplan") do
120
127
  dorun('git pull -q')
@@ -197,9 +204,6 @@ module Kitchenplan
197
204
  print_step('Installing XCode CLT')
198
205
  osx_ver = dorun('sw_vers -productVersion | awk -F "." \'{print $2}\'', true).to_i
199
206
  if osx_ver >= 9
200
- if osx_ver >= 10
201
- print_failure('Until CLT is available via softwareupdate, please install both the CLT and XCode from https://developer.apple.com')
202
- end
203
207
  dorun('touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress')
204
208
  prod = dorun('softwareupdate -l | grep -B 1 "Developer" | head -n 1 | awk -F"*" \'{print $2}\'', true)
205
209
  dorun("softwareupdate -i #{prod.chomp} -v")
@@ -1,3 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "librarian-chef", "~> 0.0.2"
3
+ gem "chef", "~> 11.0"
4
+ gem 'librarian-chef', '~> 0.0.4'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchenplan
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.16
4
+ version: 2.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roderik van der Veer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor