class EspressoInit::Task

Public Class Methods

new(dir) click to toggle source
# File lib/espresso_init/task.rb, line 4
def initialize(dir)
  @dir = dir
  @name = 'Gemfile'
  @path = File.join(@dir, @name)
  fail("Will NOT overwrite the existing #{@path}") if File.exists?(@path)
end

Public Instance Methods

gemfile() click to toggle source
# File lib/espresso_init/task.rb, line 24
    def gemfile
<<GEMFILE
gem 'e',           '0.4.10', :git => 'git://github.com/wokibe/espresso'
gem 'el',          '0.4.10', :git => 'git://github.com/wokibe/espresso-lungo'
gem 'el-ace',      '0.0.7',  :git => 'git://github.com/wokibe/el-ace'
gem 'el-finder',   '0.0.9',  :git => 'git://github.com/wokibe/el-finder'
gem 'el-ckeditor', '0.0.2',  :git => 'git://github.com/wokibe/el-ckeditor'
gem 'rear',        '0.1.2',  :git => 'git://github.com/wokibe/rear'
gem 'enginery',    '0.2.12', :git => 'git://github.com/wokibe/enginery'

group :development do
  gem 'specular',  '0.2.2',  :git => 'git://github.com/wokibe/specular'
  gem 'sonar',     '0.2.0',  :git => 'git://github.com/wokibe/sonar'
end    
GEMFILE
    end
generate() click to toggle source
# File lib/espresso_init/task.rb, line 11
def generate
  if File.exists?(@dir)
    fail("#{@dir} is not a directory") unless File.directory?(@dir)
  else
    puts "Generating the directory #{@dir}"
    Dir.mkdir(@dir)
  end
  
  source = gemfile
  puts "Generating the file #{@path}"
  File.open(@path, 'w') {|f| f << source}
end