Module: Dployr::Config::Create
- Includes:
- Constants
- Defined in:
- lib/dployr/config/create.rb
Constant Summary collapse
- RB_CONTENT =
<<-EOS Dployr::configure do |dployr| dployr.config.set_default({ attributes: { instance_type: "m1.medium" } }) dployr.config.add_instance('name', { scripts: [ { path: 'path/to/script.sh' } ] }) end EOS
- YAML_CONTENT =
<<-EOS default: attributes: instance_type: m1.medium instance: attributes: name: my_instance scripts: - path: path/to/script.sh EOS
Constants included from Constants
Dployr::Config::Constants::EXTENSIONS, Dployr::Config::Constants::FILENAME, Dployr::Config::Constants::FILENAMES
Class Method Summary collapse
Class Method Details
.write_file(dir = Dir.pwd, type = 'rb') ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dployr/config/create.rb', line 39 def write_file(dir = Dir.pwd, type = 'rb') yaml = type == 'yaml' file_name = FILENAME file_name += ".yaml" if yaml content = yaml ? YAML_CONTENT : RB_CONTENT begin file = File.open "#{dir}/#{FILENAME}", "w" file.write content rescue IOError => e raise e ensure file.close unless file == nil end end |