lib/wire/commands/spec_writer.rb
# ensures that all serverspec skeleton files such as
# Rakefile, spec_helper etc. exist
# Then writes the models specification files into the
# skeleton
ensures that all serverspec skeleton files such as
Rakefile, spec_helper etc. exist
Then writes the models specification files into the
skeleton
ensures that all serverspec skeleton files such as Rakefile spec_helper etc . exist Then writes the models specification files into the skeleton
def ensure_files
      rakefile_name = File.join(@target_dir, 'Rakefile')
      file?(rakefile_name) || File.open(rakefile_name, 'w') do |file|
        write_template(SpecTemplates.template_rakefile, file)
      end
      spechelper_name = File.join(@target_dir, 'spec', 'spec_helper.rb')
      file?(spechelper_name) || File.open(spechelper_name, 'w') do |file|
        write_template(SpecTemplates.template_spec_helper, file)
      end
      specfile_name = File.join(@target_dir, 'spec', 'localhost', 'wire_spec.rb')
      File.open(specfile_name, 'w') do |file|
        template = <<ERB
require 'spec_helper.rb'
# begin of generated specs
<%= @spec_contents.join('\n') %>
# end of spec file
ERB
        write_template(template, file)
      end
    end
def ensure_files rakefile_name = File . join ( @target_dir , 'Rakefile' ) file? ( rakefile_name ) || File . open ( rakefile_name , 'w' ) do | file | write_template ( SpecTemplates . template_rakefile , file ) end spechelper_name = File . join ( @target_dir , 'spec' , 'spec_helper.rb' ) file? ( spechelper_name ) || File . open ( spechelper_name , 'w' ) do | file | write_template ( SpecTemplates . template_spec_helper , file ) end specfile_name = File . join ( @target_dir , 'spec' , 'localhost' , 'wire_spec.rb' ) File . open ( specfile_name , 'w' ) do | file | template = <<ERB 
require 'spec_helper.rb'

# begin of generated specs

<%= @spec_contents.join(' \n ') %>

# end of spec file
 ERB write_template ( template , file ) end end
ensures that all serverspec skeleton files such as
Rakefile, spec_helper etc.
ensures that all serverspec skeleton files such as Rakefile spec_helper etc .