roundsman 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ require 'tempfile'
8
8
  def run_list(*recipes)
9
9
  if recipes.any?
10
10
  set :run_list, recipes
11
- install_ruby
11
+ install_ruby if fetch(:run_roundsman_checks, true) && install_ruby?
12
12
  run_chef
13
13
  else
14
14
  Array(fetch(:run_list))
@@ -48,10 +48,11 @@ require 'tempfile'
48
48
  set_default(:roundsman_user) { fetch(:user) { capture('whoami').strip } }
49
49
  set_default :debug_chef, false
50
50
  set_default :package_manager, 'apt-get'
51
+ set_default :run_roundsman_checks, true
51
52
 
52
53
  desc "Lists configuration"
53
54
  task :configuration do
54
- @_defaults.sort.each do |name|
55
+ @_defaults.sort_by {|sym| sym.to_s}.each do |name|
55
56
  display_name = ":#{name},".ljust(30)
56
57
  if variables[name].is_a?(Proc)
57
58
  value = "<block>"
@@ -77,11 +78,33 @@ require 'tempfile'
77
78
  def ensure_roundsman_working_dir
78
79
  unless @ensured_roundsman_working_dir
79
80
  run "mkdir -p #{fetch(:roundsman_working_dir)}"
81
+ run "mkdir -p #{fetch(:roundsman_working_dir)}/cache"
80
82
  sudo "chown -R #{fetch(:roundsman_user)} #{fetch(:roundsman_working_dir)}"
81
83
  @ensured_roundsman_working_dir = true
82
84
  end
83
85
  end
84
86
 
87
+ def install_ruby?
88
+ installed_version = capture("ruby --version || true").strip
89
+ if installed_version.include?("not found")
90
+ logger.info "No version of Ruby could be found."
91
+ return true
92
+ end
93
+ required_version = fetch(:ruby_version).gsub("-", "")
94
+ if installed_version.include?(required_version)
95
+ if fetch(:care_about_ruby_version)
96
+ logger.info "Ruby #{installed_version} matches the required version: #{required_version}."
97
+ return false
98
+ else
99
+ logger.info "Already installed Ruby #{installed_version}, not #{required_version}. Set :care_about_ruby_version if you want to fix this."
100
+ return false
101
+ end
102
+ else
103
+ logger.info "Ruby version mismatch. Installed version: #{installed_version}, required is #{required_version}"
104
+ return true
105
+ end
106
+ end
107
+
85
108
 
86
109
  namespace :install do
87
110
 
@@ -104,7 +127,7 @@ require 'tempfile'
104
127
  git clone -q https://github.com/sstephenson/ruby-build.git
105
128
  cd ruby-build
106
129
  ./install.sh
107
- ruby-build #{fetch(:ruby_version)} #{fetch(:ruby_install_dir)}
130
+ CONFIGURE_OPTS='--disable-install-rdoc' ruby-build #{fetch(:ruby_version)} #{fetch(:ruby_install_dir)}
108
131
  }
109
132
  end
110
133
 
@@ -145,27 +168,6 @@ require 'tempfile'
145
168
  end
146
169
  end
147
170
 
148
- def install_ruby?
149
- installed_version = capture("ruby --version || true").strip
150
- if installed_version.include?("not found")
151
- logger.info "No version of Ruby could be found."
152
- return true
153
- end
154
- required_version = fetch(:ruby_version).gsub("-", "")
155
- if installed_version.include?(required_version)
156
- if fetch(:care_about_ruby_version)
157
- logger.info "Ruby #{installed_version} matches the required version: #{required_version}."
158
- return false
159
- else
160
- logger.info "Already installed Ruby #{installed_version}, not #{required_version}. Set :care_about_ruby_version if you want to fix this."
161
- return false
162
- end
163
- else
164
- logger.info "Ruby version mismatch. Installed version: #{installed_version}, required is #{required_version}"
165
- return true
166
- end
167
- end
168
-
169
171
  end
170
172
 
171
173
  namespace :chef do
@@ -183,7 +185,7 @@ require 'tempfile'
183
185
 
184
186
  desc "Generates the config and copies over the cookbooks to the server"
185
187
  task :prepare_chef, :except => { :no_release => true } do
186
- install if install_chef?
188
+ install if fetch(:run_roundsman_checks, true) && install_chef?
187
189
  ensure_cookbooks_exists
188
190
  generate_config
189
191
  generate_attributes
@@ -239,7 +241,7 @@ require 'tempfile'
239
241
  def remove_procs_from_hash(hash)
240
242
  new_hash = {}
241
243
  hash.each do |key, value|
242
- next if fetch(:filter_sensitive_settings).find { |regex| regex.match(key) }
244
+ next if fetch(:filter_sensitive_settings).find { |regex| regex.match(key.to_s) }
243
245
  real_value = if value.respond_to?(:call)
244
246
  begin
245
247
  value.call
@@ -1,3 +1,3 @@
1
1
  module Roundsman
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/roundsman.gemspec CHANGED
@@ -16,5 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Roundsman::VERSION
17
17
 
18
18
  gem.add_runtime_dependency "capistrano", "~> 2.12"
19
+ gem.add_runtime_dependency "json", "~> 1.0"
19
20
  gem.add_development_dependency "vagrant", "~> 1.0"
20
21
  end
metadata CHANGED
@@ -1,56 +1,77 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: roundsman
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - iain
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-05-15 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-01-16 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: capistrano
16
- requirement: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
25
+ requirements:
19
26
  - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '2.12'
27
+ - !ruby/object:Gem::Version
28
+ hash: 27
29
+ segments:
30
+ - 2
31
+ - 12
32
+ version: "2.12"
22
33
  type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
23
37
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
25
39
  none: false
26
- requirements:
40
+ requirements:
27
41
  - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '2.12'
30
- - !ruby/object:Gem::Dependency
42
+ - !ruby/object:Gem::Version
43
+ hash: 15
44
+ segments:
45
+ - 1
46
+ - 0
47
+ version: "1.0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
31
51
  name: vagrant
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '1.0'
38
- type: :development
39
52
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
41
54
  none: false
42
- requirements:
55
+ requirements:
43
56
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '1.0'
46
- description: Combine the awesome powers of Capistrano and Chef. The only thing you
47
- need is SSH access.
48
- email:
57
+ - !ruby/object:Gem::Version
58
+ hash: 15
59
+ segments:
60
+ - 1
61
+ - 0
62
+ version: "1.0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ description: Combine the awesome powers of Capistrano and Chef. The only thing you need is SSH access.
66
+ email:
49
67
  - iain@iain.nl
50
68
  executables: []
69
+
51
70
  extensions: []
71
+
52
72
  extra_rdoc_files: []
53
- files:
73
+
74
+ files:
54
75
  - .gitignore
55
76
  - .rvmrc
56
77
  - Gemfile
@@ -69,29 +90,38 @@ files:
69
90
  - test/ubuntu-lucid/test.sh
70
91
  homepage: https://github.com/iain/roundsman
71
92
  licenses: []
93
+
72
94
  post_install_message:
73
95
  rdoc_options: []
74
- require_paths:
96
+
97
+ require_paths:
75
98
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
99
+ required_ruby_version: !ruby/object:Gem::Requirement
77
100
  none: false
78
- requirements:
79
- - - ! '>='
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
109
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
88
117
  requirements: []
118
+
89
119
  rubyforge_project:
90
- rubygems_version: 1.8.23
120
+ rubygems_version: 1.8.24
91
121
  signing_key:
92
122
  specification_version: 3
93
123
  summary: Various Capistrano tasks for bootstrapping servers with Chef
94
- test_files:
124
+ test_files:
95
125
  - test/ubuntu-lucid/Capfile
96
126
  - test/ubuntu-lucid/Rakefile
97
127
  - test/ubuntu-lucid/Vagrantfile