Class: Kindeditor::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/kindeditor/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/generators/kindeditor/install_generator.rb', line 29

def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Instance Method Details

#copy_appObject



15
16
17
18
# File 'lib/generators/kindeditor/install_generator.rb', line 15

def copy_app
  copy_controller
  copy_model
end

#copy_kindeditorObject



9
10
11
12
13
# File 'lib/generators/kindeditor/install_generator.rb', line 9

def copy_kindeditor
  src_dir = File.join(self.class.source_root, 'kindeditor')
  dst_dir="#{Rails.root}/public/javascripts/kindeditor"
  directory src_dir, dst_dir
end

#create_rotesObject



20
21
22
23
# File 'lib/generators/kindeditor/install_generator.rb', line 20

def create_rotes
  route "post 'kindeditor/upload'"
  route "get 'kindeditor/images_list'"
end

#read_meObject



25
26
27
# File 'lib/generators/kindeditor/install_generator.rb', line 25

def read_me
  readme "README" if behavior == :invoke
end