Module: Lazyportal::CLI

Defined in:
lib/lazyportal/cli.rb

Instance Method Summary collapse

Instance Method Details

#generate_rakefileObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lazyportal/cli.rb', line 3

def generate_rakefile
  
  # Rakefile contents includes the Tasks
  # module and loads lazy's tasks
  tasks = %{
require 'rubygems'
require 'lazyportal'

include Lazyportal::Tasks
  
Lazyportal::Tasks.load_tasks
  }
  
  # Use existing Rakefile if one exists
  rakefile = existing_rakefile.nil? ? "Rakefile" : existing_rakefile
  
  # Append contents to existing Rakefile
  # or generate a new Rakefile
  create_file rakefile, tasks, :noclobber => true
  
  # Print message to tell the user 
  # what happened
  print_message
end