Class: Rwiki::Rake::Migrate

Inherits:
Object
  • Object
show all
Defined in:
lib/rwiki/rake/migrate.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMigrate

Returns a new instance of Migrate.



19
20
21
22
23
24
# File 'lib/rwiki/rake/migrate.rb', line 19

def initialize
  @rwiki_path = Rwiki.configuration.rwiki_path
  @root_page_file = Rwiki.configuration.root_page_full_file_path
  @root_page_path = Rwiki.configuration.root_page_full_path
  @page_file_extension = Rwiki.configuration.page_file_extension
end

Class Method Details

.define_taskObject



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

def self.define_task
  namespace :rwiki do
    desc 'Migrate to the new rwiki structure'
    task :migrate do
      raise "unknown RWIKI_PATH" unless ENV['RWIKI_PATH']

      Rwiki.configuration.rwiki_path = File.expand_path(ENV['RWIKI_PATH'])
      puts "Rwiki path is: #{Rwiki.configuration.rwiki_path}"

      self.new
      execute!
    end
  end
end

Instance Method Details

#execute!Object



26
27
28
29
30
# File 'lib/rwiki/rake/migrate.rb', line 26

def execute!
  create_backup!
  create_home_page!
  update_pages!
end