class Lazycuke::App
Public Class Methods
source_root()
click to toggle source
# File lib/lazycuke/app.rb, line 8 def self.source_root File.expand_path('../../scaffold', File.dirname(__FILE__)) end
Public Instance Methods
setup()
click to toggle source
# File lib/lazycuke/app.rb, line 18 def setup generate_rakefile copy_file "features/test.feature" copy_file "Gemfile" copy_file "cucumber.yml" copy_file "README.md" copy_file "features/support/env.rb" copy_file "features/support/hooks.rb" copy_file "features/step_definitions/steps.rb" init_gitignore end
version()
click to toggle source
# File lib/lazycuke/app.rb, line 13 def version say Lazycuke::VERSION end
Private Instance Methods
add_task(the_task)
click to toggle source
# File lib/lazycuke/app.rb, line 72 def add_task(the_task) append_file "Rakefile", "\n\n#{the_task}\n" end
destination_file_exists?(filename)
click to toggle source
# File lib/lazycuke/app.rb, line 63 def destination_file_exists?(filename) File.exist?(File.join(destination_root, filename)) end
ensure_eof_newline(filename)
click to toggle source
# File lib/lazycuke/app.rb, line 76 def ensure_eof_newline(filename) gsub_file(filename, /([^\n])\z/, "\\1\n") end
genarate_gemfile()
click to toggle source
# File lib/lazycuke/app.rb, line 36 def genarate_gemfile unless destination_file_exists?("Gemfile") add_file "Gemfile" append_file "Gemfile" do "source 'http://rubygems.org'\n\n" + "gem 'rake'\n" "gem 'nokogiri', '1.6.1'\n" end end end
generate_rakefile()
click to toggle source
# File lib/lazycuke/app.rb, line 47 def generate_rakefile unless destination_file_exists?("Rakefile") add_file "Rakefile" append_file "Rakefile" do "require 'rubygems'\n" + "require 'bundler'\n" + "require 'bundler/setup'\n\n" end end end
init_gitignore()
click to toggle source
# File lib/lazycuke/app.rb, line 58 def init_gitignore add_file ".gitignore" unless destination_file_exists?(".gitignore") ensure_eof_newline(".gitignore") end
insert_gem(gem_name)
click to toggle source
# File lib/lazycuke/app.rb, line 67 def insert_gem(gem_name) ensure_eof_newline("Gemfile") append_file "Gemfile", "gem '#{gem_name}'\n" end
project_name()
click to toggle source
# File lib/lazycuke/app.rb, line 32 def project_name destination_root.split(/\/|\\/).last end