class Barman::ProjectGenerators::QA

Attributes

options[R]
project_name[R]
project_path[R]
templates_path[R]
test_path[R]

Public Class Methods

new(project_name, options) click to toggle source
# File lib/barman/project_generators/qa.rb, line 10
def initialize(project_name, options)
  @project_name   = project_name
  @options        = options
  @templates_path = File.join(Barman.templates_path, "qa")
  @project_path   = File.join(".", project_name.to_s)
  @test_path      = File.join(project_path, "test")
end

Public Instance Methods

generate!() click to toggle source
# File lib/barman/project_generators/qa.rb, line 18
def generate!
  create_project_dir
  create_test_dir
  copy_template_files
  install_gems
end

Private Instance Methods

copy_template_files() click to toggle source
# File lib/barman/project_generators/qa.rb, line 40
def copy_template_files
  TTY::File.copy_file(File.join(templates_path, "Gemfile"), File.join(project_path, "Gemfile"))
  TTY::File.copy_file(File.join(templates_path, "Rakefile"), File.join(project_path, "Rakefile"))
  TTY::File.copy_file(File.join(templates_path, "test_helper.rb"), File.join(project_path, "test", "test_helper.rb"))
  TTY::File.copy_file(File.join(templates_path, "truth_test.rb"), File.join(project_path, "test", "truth_test.rb"))
  TTY::File.copy_file(File.join(templates_path, "multidevice.rb"), File.join(project_path, "test", "support", "multidevice.rb"))
end
create_project_dir() click to toggle source
# File lib/barman/project_generators/qa.rb, line 27
def create_project_dir
  TTY::File.create_dir(project_path)
end
create_support_dir() click to toggle source
# File lib/barman/project_generators/qa.rb, line 36
def create_support_dir
  TTY::File.create_dir File.join(test_path, "support")
end
create_test_dir() click to toggle source
# File lib/barman/project_generators/qa.rb, line 31
def create_test_dir
  TTY::File.create_dir test_path
  create_support_dir
end
install_gems() click to toggle source
# File lib/barman/project_generators/qa.rb, line 48
def install_gems
  cmd = TTY::Command.new
  unless TTY::Which.exist?('bundle')
    cmd.run("gem install bundler")
  end
  cmd.run("bundle install", chdir: project_path)
end