Module: App2Engine

Defined in:
lib/app2engine.rb,
lib/app2engine/rake/tasks.rb,
lib/app2engine/rake/extra_tasks.rb,
lib/app2engine/rake/convert_tasks.rb

Defined Under Namespace

Modules: Rake

Class Method Summary collapse

Class Method Details

.install(dir) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/app2engine.rb', line 4

def install(dir)
  unless File.directory?(dir) and
      rakefile = File.join(dir, 'Rakefile') and File.exist?(rakefile) and
      gemfile  = File.join(dir, 'Gemfile')  and File.exist?(gemfile)
    raise "#{dir} is not a rails app"
  end

  tasks = App2Engine::Rake::Tasks.new

  puts "Appending the App2Engine tasks to the Rakefile"
  tasks.append_to_file(rakefile, "require 'app2engine/rake/tasks'\nApp2Engine::Rake::Tasks.new")

  puts "Adding app2engine in the Gemfile (necessary for Rake tasks to run)"
  tasks.append_to_file(gemfile, "gem 'app2engine'")
end