kitchenplan 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -10
  3. data/lib/kitchenplan/cli.rb +26 -15
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45272d06331a4420f7df036e09fa2f6626867f90
4
- data.tar.gz: de7f6c4078c608b2ca87ba8e87f011998496c56d
3
+ metadata.gz: 5ebb0db12e3ed09eb671248d12d8edf97a2334fb
4
+ data.tar.gz: 9b03987338deb36560b0c6fc6ea656961a5b1fd9
5
5
  SHA512:
6
- metadata.gz: 3f99898b77d4b046d81a456ecbbea5eaedd59bde67f7d9f4832b9c0a0282bfc5b4f0f7a3626c6dbcbba948ff13cafcd40984ad24edad29f353fbb5a8baaf8623
7
- data.tar.gz: c596e4d3db9b64737c9a92ef62fceb4335ef733f2a88ff6c53393b9670583e815ee38ef73f474e63775972419a2377b0d5cf4ef92cb43aa97c6fe0a14da6f6c5
6
+ metadata.gz: 401779d5cdf43c7ae19ac9e63e45fa406bfe4fc457cd4b71907074af5412e062ca705d66464bbc5b750a204aee5c8aea6f734486908e96386c31fad13f7badab
7
+ data.tar.gz: 5fd4f56c63ec48107a220e62036dd566a27a79967dc11735fdc25625222ae3b135248d1495e3af00b2f664cae4daadb85d47c1aea0edfb497d503ae1fb61c124
data/README.md CHANGED
@@ -2,16 +2,9 @@
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
- ## Important
5
+ ## History
6
6
 
7
- I'm currently working on a brand new way of running Kitchenplan. If you are using Kitchenplan, please use [version2](https://github.com/kitchenplan/kitchenplan/blob/version2/README.md) for now.
8
-
9
- ## To Do
10
-
11
- * debug options
12
- * installing a manual list of recipes
13
- * --no-chef
14
- * only update cookbooks if we run with -c
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.
15
8
 
16
9
  ## Using kitchenplan
17
10
 
@@ -122,8 +115,14 @@ Running Kitchenplan is as easy as running `kitchenplan provision`
122
115
  run sudo vendor/bin/chef-solo -c tmp/solo.rb -j tmp/kitchenplan-attributes.json -o applications::create_var_chef_cache,homebrewalt::default,nodejs::default,... from "/opt/kitchenplan"
123
116
  ```
124
117
 
125
- At this point Chef will start installing everything you configured. Depending on your install list, this might take a while.
118
+ At this point Chef will start installing everything you configured. Depending on your install list, this might take a while. It will hopefully go smooth and end with
126
119
 
120
+ ```
121
+ -> Cleanup parsed configuration files
122
+ run rm -f kitchenplan-attributes.json from "/opt/kitchenplan"
123
+ run rm -f solo.rb from "/opt/kitchenplan"
124
+ => Installation complete!
125
+ ```
127
126
 
128
127
  ## Some blogposts about Kitchenplan
129
128
 
@@ -7,7 +7,7 @@ module Kitchenplan
7
7
  desc 'setup [<GITREPO>] [<TARGET DIRECTORY>]', 'setup Kitchenplan'
8
8
  def setup(gitrepo=nil, targetdir='/opt')
9
9
  logo
10
- install_clt
10
+ install_clt unless File.exists?("/usr/bin/cc")
11
11
  if gitrepo
12
12
  fetch(gitrepo, targetdir)
13
13
  else
@@ -21,43 +21,49 @@ module Kitchenplan
21
21
  end
22
22
  end
23
23
 
24
- desc 'provision [<TARGET DIRECTORY>]', 'run Kitchenplan'
24
+ option :debug, :type => :boolean
25
+ option :recipes, :type => :array
26
+ desc 'provision [<TARGET DIRECTORY>] [--debug] [--recipes=x y z]', 'run Kitchenplan, using debug will show more command output'
25
27
  def provision(targetdir='/opt')
26
28
  logo
27
29
  prepare_folders(targetdir)
28
30
  install_bundler(targetdir)
29
31
  send_ping
30
32
  recipes = parse_config(targetdir)
31
- fetch_cookbooks(targetdir)
32
- run_chef(targetdir, recipes)
33
- cleanup(targetdir)
33
+ fetch_cookbooks(targetdir, options[:debug])
34
+ run_chef(targetdir, (options[:recipes] ? options[:recipes] : recipes), options[:debug])
35
+ cleanup(targetdir, options[:debug])
34
36
  print_notice('Installation complete!')
35
37
  end
36
38
 
37
39
  no_commands do
38
40
 
39
- def run_chef(targetdir, recipes)
41
+ def run_chef(targetdir, recipes, debug=false)
40
42
  inside("#{targetdir}/kitchenplan") do
41
- dorun "sudo vendor/bin/chef-solo -c tmp/solo.rb -j tmp/kitchenplan-attributes.json -o #{recipes.join(',')}"
43
+ dorun "sudo vendor/bin/chef-solo #{( debug ? ' --log_level debug' : ' ' )} -c tmp/solo.rb -j tmp/kitchenplan-attributes.json -o #{recipes.join(',')}"
42
44
  end
43
45
  end
44
46
 
45
- def fetch_cookbooks(targetdir)
47
+ def fetch_cookbooks(targetdir,debug=false)
46
48
  print_step('Fetch the chef cookbooks')
47
49
  inside("#{targetdir}/kitchenplan") do
48
50
  if File.exists?('vendor/cookbooks')
49
- dorun 'vendor/bin/librarian-chef update 2>&1 > /dev/null'
51
+ dorun "vendor/bin/librarian-chef update #{( debug ? ' ' : '2>&1 > /dev/null' )}"
50
52
  else
51
- dorun 'vendor/bin/librarian-chef install --clean --quiet --path=vendor/cookbooks'
53
+ dorun "vendor/bin/librarian-chef install --clean #{( debug ? ' ' : '--quiet' )} --path=vendor/cookbooks"
52
54
  end
53
55
  end
54
56
  end
55
57
 
56
- def cleanup(targetdir)
57
- print_step('Cleanup parsed configuration files')
58
- inside("#{targetdir}/kitchenplan") do
59
- dorun('rm -f kitchenplan-attributes.json')
60
- dorun('rm -f solo.rb')
58
+ def cleanup(targetdir,debug=false)
59
+ unless debug
60
+ print_step('Cleanup parsed configuration files')
61
+ inside("#{targetdir}/kitchenplan") do
62
+ dorun('rm -f kitchenplan-attributes.json')
63
+ dorun('rm -f solo.rb')
64
+ end
65
+ else
66
+ print_step('Skipping cleanup parsed configuration files')
61
67
  end
62
68
  end
63
69
 
@@ -90,11 +96,16 @@ module Kitchenplan
90
96
  print_step "#{targetdir}/kitchenplan already exists, updating from git."
91
97
  inside("#{targetdir}/kitchenplan") do
92
98
  dorun('git pull -q')
99
+ dorun('git submodule update')
93
100
  end
94
101
  else
95
102
  print_step "Fetching #{gitrepo} to #{targetdir}/kitchenplan."
96
103
  inside("#{targetdir}") do
97
104
  dorun("git clone -q #{gitrepo} kitchenplan")
105
+ inside("#{targetdir}/kitchenplan") do
106
+ dorun('git submodule init')
107
+ dorun('git submodule update')
108
+ end
98
109
  end
99
110
  end
100
111
  end
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.1
4
+ version: 2.1.2
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-03-08 00:00:00.000000000 Z
11
+ date: 2014-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor