roundsman 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,6 +45,9 @@ require 'tempfile'
45
45
 
46
46
  set_default :roundsman_working_dir, "/tmp/roundsman"
47
47
  set_default :stream_roundsman_output, true
48
+ set_default(:roundsman_user) { fetch(:user) { capture('whoami').strip } }
49
+ set_default :debug_chef, false
50
+ set_default :package_manager, 'apt-get'
48
51
 
49
52
  desc "Lists configuration"
50
53
  task :configuration do
@@ -74,7 +77,7 @@ require 'tempfile'
74
77
  def ensure_roundsman_working_dir
75
78
  unless @ensured_roundsman_working_dir
76
79
  run "mkdir -p #{fetch(:roundsman_working_dir)}"
77
- sudo "chown -R #{user} #{fetch(:roundsman_working_dir)}"
80
+ sudo "chown -R #{fetch(:roundsman_user)} #{fetch(:roundsman_working_dir)}"
78
81
  @ensured_roundsman_working_dir = true
79
82
  end
80
83
  end
@@ -82,7 +85,7 @@ require 'tempfile'
82
85
 
83
86
  namespace :install do
84
87
 
85
- set_default :ruby_version, "1.9.3-p125"
88
+ set_default :ruby_version, "1.9.3-p194"
86
89
  set_default :care_about_ruby_version, true
87
90
  set_default :ruby_install_dir, "/usr/local"
88
91
 
@@ -98,7 +101,7 @@ require 'tempfile'
98
101
  set -e
99
102
  cd #{roundsman_working_dir}
100
103
  rm -rf ruby-build
101
- git clone -q git://github.com/sstephenson/ruby-build.git
104
+ git clone -q https://github.com/sstephenson/ruby-build.git
102
105
  cd ruby-build
103
106
  ./install.sh
104
107
  ruby-build #{fetch(:ruby_version)} #{fetch(:ruby_install_dir)}
@@ -121,8 +124,8 @@ require 'tempfile'
121
124
  desc "Installs the dependencies needed for Ruby"
122
125
  task :dependencies, :except => { :no_release => true } do
123
126
  ensure_supported_distro
124
- sudo "aptitude -yq update"
125
- sudo "aptitude -yq install #{fetch(:ruby_dependencies).join(' ')}"
127
+ sudo "#{fetch(:package_manager)} -yq update"
128
+ sudo "#{fetch(:package_manager)} -yq install #{fetch(:ruby_dependencies).join(' ')}"
126
129
  end
127
130
 
128
131
  desc "Checks if the ruby version installed matches the version specified"
@@ -170,6 +173,7 @@ require 'tempfile'
170
173
  set_default :chef_version, "~> 0.10.8"
171
174
  set_default :cookbooks_directory, ["config/cookbooks"]
172
175
  set_default :copyfile_disable, false
176
+ set_default :filter_sensitive_settings, [ /password/, /filter_sensitive_settings/ ]
173
177
 
174
178
  task :default, :except => { :no_release => true } do
175
179
  ensure_cookbooks_exists
@@ -196,7 +200,7 @@ require 'tempfile'
196
200
  desc "Runs the existing chef configuration"
197
201
  task :chef_solo, :except => { :no_release => true } do
198
202
  logger.info "Now running #{fetch(:run_list).join(', ')}"
199
- sudo "chef-solo -c #{roundsman_working_dir("solo.rb")} -j #{roundsman_working_dir("solo.json")}"
203
+ sudo "chef-solo -c #{roundsman_working_dir("solo.rb")} -j #{roundsman_working_dir("solo.json")}#{' -l debug' if fetch(:debug_chef)}"
200
204
  end
201
205
 
202
206
  def ensure_cookbooks_exists
@@ -217,11 +221,11 @@ require 'tempfile'
217
221
  def generate_config
218
222
  cookbook_string = cookbooks_paths.map { |c| "File.join(root, #{c.to_s.inspect})" }.join(', ')
219
223
  solo_rb = <<-RUBY
220
- root = File.expand_path(File.dirname(__FILE__))
221
- file_cache_path File.join(root, "cache")
222
- cookbook_path [ #{cookbook_string} ]
223
- RUBY
224
- put solo_rb, roundsman_working_dir("solo.rb"), :via => :scp
224
+ root = File.expand_path(File.dirname(__FILE__))
225
+ file_cache_path File.join(root, "cache")
226
+ cookbook_path [ #{cookbook_string} ]
227
+ RUBY
228
+ put solo_rb, roundsman_working_dir("solo.rb"), :via => :scp
225
229
  end
226
230
 
227
231
  def generate_attributes
@@ -235,21 +239,22 @@ require 'tempfile'
235
239
  def remove_procs_from_hash(hash)
236
240
  new_hash = {}
237
241
  hash.each do |key, value|
242
+ next if fetch(:filter_sensitive_settings).find { |regex| regex.match(key) }
238
243
  real_value = if value.respond_to?(:call)
239
- begin
240
- value.call
241
- rescue ::Capistrano::CommandError => e
242
- logger.debug "Could not get the value of #{key}: #{e.message}"
243
- nil
244
- end
245
- else
246
- value
247
- end
244
+ begin
245
+ value.call
246
+ rescue ::Capistrano::CommandError => e
247
+ logger.debug "Could not get the value of #{key}: #{e.message}"
248
+ nil
249
+ end
250
+ else
251
+ value
252
+ end
248
253
 
249
254
  if real_value.is_a?(Hash)
250
255
  real_value = remove_procs_from_hash(real_value)
251
256
  end
252
- unless real_value.class.to_s.include?("Capistrano") # skip capistrano tasks
257
+ if real_value && !real_value.class.to_s.include?("Capistrano") # skip capistrano tasks
253
258
  new_hash[key] = real_value
254
259
  end
255
260
  end
@@ -1,3 +1,3 @@
1
1
  module Roundsman
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roundsman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-16 00:00:00.000000000 Z
12
+ date: 2012-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70276376984320 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '2.12'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70276376984320
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.12'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: vagrant
27
- requirement: &70276376983820 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '1.0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70276376983820
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
36
46
  description: Combine the awesome powers of Capistrano and Chef. The only thing you
37
47
  need is SSH access.
38
48
  email:
@@ -77,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
87
  version: '0'
78
88
  requirements: []
79
89
  rubyforge_project:
80
- rubygems_version: 1.8.15
90
+ rubygems_version: 1.8.23
81
91
  signing_key:
82
92
  specification_version: 3
83
93
  summary: Various Capistrano tasks for bootstrapping servers with Chef