Module: Setup

Defined in:
lib/setup.rb

Instance Method Summary collapse

Instance Method Details

#bundle_and_tarObject



5
6
7
8
9
10
11
# File 'lib/setup.rb', line 5

def bundle_and_tar
   io = Util::Tar::tar('template')
   f =  File.open('compress_template', 'w+')
   f.binmode
   f.write io.read
   f.close
end

#cml_optionsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/setup.rb', line 29

def cml_options
  options={}
  #ruby.about.com/od/advancedruby/a/optionparser.htm
  optparse = OptionParser.new do |opts|

     opts.banner = "Usage: runregress [options]"

     opts.on("-h", "--help", "Display this screen") do |h|
        puts opts
        exit
     end

     opts.on('-n', '--new PROJECTNAME','Create new project')do |projectname|
        options[:projectname] = projectname
     end

     opts.on('-r', '--test_list FILENAME', 'File with Tests for this regression') do |file|
        options[:regression_file] = file
        puts "\nRunning Regression with Test_List from: #{file} \n"
     end

     opts.on('-t', '--test test1,test2', Array, 'tests to run') do |tests|
        options[:testlist] = tests
        puts "Running Tests: #{options[:testlist]}"
     end
  end.parse!
  options
end

#scaffoldObject



21
22
23
24
25
26
27
# File 'lib/setup.rb', line 21

def scaffold
    puts "Adding Directory Structure"
    Dir.mkdir("reports2")
    FileUtils::mkdir_p "/tests/spec"
    FileUtils::mkdir_p("#{dir_name}/reports") \
       unless File.exists?('reports') 
end

#unbundle_and_untar(path, projectname) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/setup.rb', line 13

def unbundle_and_untar(path, projectname)
   f = File.open(path.concat('compress_template'), 'r')
   puts "Writing #{File.expand_path(f)} To:: #{projectname}.... "
   b = f.read
   ba = StringIO.new(b)
   Util::Tar::untar(ba,projectname)
end