Class: Sprinkle::Installers::PushText
- Defined in:
- lib/sprinkle/installers/push_text.rb
Overview
Beware, strange “installer” coming your way.
This push text installer pushes simple configuration into a file.
Example Usage
Installing magic_beans into apache2.conf
package :magic_beans do
push_text 'magic_beans', '/etc/apache2/apache2.conf'
end
If you user has access to ‘sudo’ and theres a file that requires priveledges, you can pass :sudo => true
package :magic_beans do
push_text 'magic_beans', '/etc/apache2/apache2.conf', :sudo => true
end
A special verify step exists for this very installer its known as file_contains
, it will test that a file indeed contains a substring that you send it.
package :magic_beans do
push_text 'magic_beans', '/etc/apache2/apache2.conf'
verify do
file_contains '/etc/apache2/apache2.conf', 'magic_beans'
end
end
Instance Attribute Summary collapse
-
#path ⇒ Object
:nodoc:.
-
#text ⇒ Object
:nodoc:.
Attributes inherited from Installer
#delivery, #options, #package, #post, #pre
Instance Method Summary collapse
-
#announce ⇒ Object
:nodoc:.
-
#initialize(parent, text, path, options = {}, &block) ⇒ PushText
constructor
:nodoc:.
Methods inherited from Installer
api, #commands_from_block, #defer, #escape_shell_arg, inherited, #install_sequence, #method_missing, #per_host?, #post_process, #process, subclasses, verify_api
Methods included from Sudo
#sudo?, #sudo_cmd, #sudo_stack
Methods included from Attributes
Constructor Details
#initialize(parent, text, path, options = {}, &block) ⇒ PushText
:nodoc:
42 43 44 45 46 47 48 |
# File 'lib/sprinkle/installers/push_text.rb', line 42 def initialize(parent, text, path, ={}, &block) #:nodoc: super parent, , &block # by default we would not want to push the same thing over and over .reverse_merge!(:idempotent => true) @text = text @path = path end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Sprinkle::Installers::Installer
Instance Attribute Details
#path ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/sprinkle/installers/push_text.rb', line 34 def path @path end |
#text ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/sprinkle/installers/push_text.rb', line 34 def text @text end |
Instance Method Details
#announce ⇒ Object
:nodoc:
50 51 52 |
# File 'lib/sprinkle/installers/push_text.rb', line 50 def announce #:nodoc: log "--> Append '#{@text}' to file #{@path}" end |