dust-deploy 0.10.7 → 0.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/changelog.md CHANGED
@@ -1,6 +1,16 @@
1
1
  Changelog
2
2
  =============
3
3
 
4
+ 0.10.8
5
+ ------------
6
+
7
+ - only use colors if stdout is a tty
8
+ - switches to colorize gem
9
+ - replaces basic_setup with skel recipe, to copy e.g. basic configuration files placed in templates/skel
10
+
11
+ skel: [ root, john ]
12
+
13
+
4
14
  0.10.7
5
15
  ------------
6
16
 
data/dust.gemspec CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |s|
25
25
  s.add_runtime_dependency 'net-sftp'
26
26
  s.add_runtime_dependency 'thor'
27
27
  s.add_runtime_dependency 'ipaddress'
28
+ s.add_runtime_dependency 'colorize'
28
29
  end
@@ -1,16 +1,15 @@
1
- this is <%= Dust.blue %><%= @node['hostname'] %><%= Dust.none %>, a <%= @node['domain'] %> <%= @node['environment'] %> server
1
+ % require 'colorize'
2
+ this is <%= @node['hostname'].blue %>, a <%= @node['domain'] %> <%= @node['environment'] %> server
2
3
 
3
4
  % if @node['environment'] == 'production'
4
5
  just in case you didn't notice the line above, maybe this cow helps:
5
6
 
6
7
  ___________________________________
7
- < <%= Dust.red %>YOU ARE ON A PRODUCTION SERVER!<%= Dust.none %> >
8
+ < <%= 'YOU ARE ON A PRODUCTION SERVER!'.red %> >
8
9
  -----------------------------------
9
- <%= Dust.yellow %>
10
10
  \ ^__^
11
11
  \ (oo)\_______
12
12
  (__))\/\
13
13
  ||----w |
14
14
  || ||
15
- <%= Dust.none %>
16
15
  % end
@@ -1,15 +1,6 @@
1
- module Dust
2
- # colors for terminal
3
- def self.red thick=1; "\033[#{thick};31m"; end
4
- def self.green thick=1; "\033[#{thick};32m"; end
5
- def self.yellow thick=1; "\033[#{thick};33m"; end
6
- def self.blue thick=1; "\033[#{thick};34m"; end
7
- def self.pink thick=1; "\033[#{thick};35m"; end
8
- def self.turquois thick=1; "\033[#{thick};36m"; end
9
- def self.grey thick=1; "\033[#{thick};37m"; end
10
- def self.black thick=1; "\033[#{thick};38m"; end
11
- def self.none; "\033[0m"; end
1
+ require 'colorize'
12
2
 
3
+ module Dust
13
4
  $stdout.sync = true # autoflush
14
5
 
15
6
  def self.print_result ret, options={:quiet => false, :indent => 1}
@@ -25,29 +16,29 @@ module Dust
25
16
  def self.print_ok string='', options={:quiet => false, :indent => 1}
26
17
  opts = options.clone
27
18
  opts[:indent] = 0 if string.empty?
28
- print_msg "#{string} #{blue}[ ok ]#{none}\n", opts
19
+ print_msg "#{string} #{'[ ok ]'.green}\n", opts
29
20
  true
30
21
  end
31
22
 
32
23
  def self.print_failed string='', options={:quiet => false, :indent => 1}
33
24
  opts = options.clone
34
25
  opts[:indent] = 0 if string.empty?
35
- print_msg "#{string} #{red}[ failed ]#{none}\n", opts
26
+ print_msg "#{string} #{'[ failed ]'.red}\n", opts
36
27
  false
37
28
  end
38
29
 
39
30
  def self.print_warning string='', options={:quiet => false, :indent => 1}
40
31
  opts = options.clone
41
32
  opts[:indent] = 0 if string.empty?
42
- print_msg "#{string} #{yellow}[ warning ]#{none}\n", opts
33
+ print_msg "#{string} #{'[ warning ]'.yellow}\n", opts
43
34
  end
44
35
 
45
36
  def self.print_hostname hostname, options={:quiet => false, :indent => 0}
46
- print_msg "\n[ #{blue}#{hostname}#{none} ]\n\n", options
37
+ print_msg "\n[ #{hostname.blue} ]\n\n", options
47
38
  end
48
39
 
49
40
  def self.print_recipe recipe, options={:quiet => false, :indent => 0}
50
- print_msg "#{green}|#{recipe}|#{none}\n", options
41
+ print_msg "|#{recipe}|\n".green, options
51
42
  end
52
43
 
53
44
  # prints stdout in grey and stderr in red (if existend)
@@ -55,8 +46,8 @@ module Dust
55
46
  opts = options.clone
56
47
 
57
48
  opts[:indent] += 1
58
- print_msg "#{green 0}#{ret[:stdout].chomp}#{none}\n", opts unless ret[:stdout].empty?
59
- print_msg "#{red 0}#{ret[:stderr].chomp}#{none}\n", opts unless ret[:stderr].empty?
49
+ print_msg "#{ret[:stdout].chomp.green}\n", opts unless ret[:stdout].empty?
50
+ print_msg "#{ret[:stderr].chomp.red}\n", opts unless ret[:stderr].empty?
60
51
  end
61
52
 
62
53
  # indent according to options[:indent]
@@ -0,0 +1,13 @@
1
+ class Skel < Recipe
2
+ desc 'skel:deploy', 'copy default configuration files to users home directory'
3
+ def deploy
4
+ @config.to_array.each do |user|
5
+ ::Dust.print_msg "deploying homedir skeleton for #{user}\n"
6
+ Dir["#{@template_path}/.*"].each do |file|
7
+ next unless File.file? file
8
+ @node.deploy_file file, "/#{@node.get_home user}/#{File.basename file}", { :binding => binding, :indent => 2 }
9
+ end
10
+ puts
11
+ end
12
+ end
13
+ end
data/lib/dust/server.rb CHANGED
@@ -84,13 +84,13 @@ module Dust
84
84
  sudo_authenticated = true
85
85
  else
86
86
  stdout += data
87
- Dust.print_msg "#{Dust.green 0}#{data}#{Dust.none}", :indent => 0 if options[:live] and not data.empty?
87
+ Dust.print_msg data.green, :indent => 0 if options[:live] and not data.empty?
88
88
  end
89
89
  end
90
90
 
91
91
  channel.on_extended_data do |ch, type, data|
92
92
  stderr += data
93
- Dust.print_msg "#{Dust.red 0}#{data}#{Dust.none}", :indent => 0 if options[:live] and not data.empty?
93
+ Dust.print_msg data.red, :indent => 0 if options[:live] and not data.empty?
94
94
  end
95
95
 
96
96
  channel.on_request('exit-status') { |ch, data| exit_code = data.read_long }
data/lib/dust/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dust
2
- VERSION = "0.10.7"
2
+ VERSION = "0.10.8"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 10
8
- - 7
9
- version: 0.10.7
8
+ - 8
9
+ version: 0.10.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - kris kechagia
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-04-23 00:00:00 +02:00
17
+ date: 2012-05-03 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -89,6 +89,18 @@ dependencies:
89
89
  version: "0"
90
90
  type: :runtime
91
91
  version_requirements: *id006
92
+ - !ruby/object:Gem::Dependency
93
+ name: colorize
94
+ prerelease: false
95
+ requirement: &id007 !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ type: :runtime
103
+ version_requirements: *id007
92
104
  description: when puppet and chef suck because you want to be in control and sprinkle just cannot do enough for you
93
105
  email:
94
106
  - kk@rndsec.net
@@ -135,7 +147,6 @@ files:
135
147
  - lib/dust/recipe.rb
136
148
  - lib/dust/recipes/aliases.rb
137
149
  - lib/dust/recipes/apt.rb
138
- - lib/dust/recipes/basic_setup.rb
139
150
  - lib/dust/recipes/cjdroute.rb
140
151
  - lib/dust/recipes/cups_client.rb
141
152
  - lib/dust/recipes/debsecan.rb
@@ -160,6 +171,7 @@ files:
160
171
  - lib/dust/recipes/repositories.rb
161
172
  - lib/dust/recipes/resolv_conf.rb
162
173
  - lib/dust/recipes/ruby_rvm.rb
174
+ - lib/dust/recipes/skel.rb
163
175
  - lib/dust/recipes/ssh_authorized_keys.rb
164
176
  - lib/dust/recipes/sshd.rb
165
177
  - lib/dust/recipes/sudoers.rb
@@ -1,32 +0,0 @@
1
- class BasicSetup < Recipe
2
- desc 'basic_setup:deploy', 'installs basic packages and config files'
3
- def deploy
4
- # install some basic packages
5
- ::Dust.print_msg "installing basic packages\n"
6
-
7
- @node.install_package 'tmux', :indent => 2
8
- @node.install_package 'rsync', :indent => 2
9
- @node.install_package 'psmisc', :indent => 2 if @node.uses_apt?
10
-
11
- if @node.uses_rpm?
12
- @node.install_package 'vim-enhanced', :indent => 2
13
- else
14
- @node.install_package 'vim', :indent => 2
15
- end
16
-
17
- if @node.uses_apt?
18
- @node.install_package 'git-core', :indent => 2
19
- else
20
- @node.install_package 'git', :indent => 2
21
- end
22
- puts
23
-
24
- # deploy basic configuration for root user
25
- ::Dust.print_msg "deploying configuration files for root\n"
26
- Dir["#{@template_path}/.*"].each do |file|
27
- next unless File.file? file
28
- @node.deploy_file file, "/root/#{File.basename file}", { :binding => binding, :indent => 2 }
29
- end
30
-
31
- end
32
- end