Class: Roboto::Generators::InstallGenerator

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_roboto_route



23
24
25
# File 'lib/generators/roboto/install_generator.rb', line 23

def add_roboto_route
  route "mount_roboto"
end

- (Object) copy_locale



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/roboto/install_generator.rb', line 8

def copy_locale
  empty_directory "config/robots"
  env_list = Dir.glob("#{destination_root}/config/environments/*")
  env_list.each do |env_file|
    env_name = File.basename(env_file, ".rb")
    unless (env_name == "production" &&  FileTest.exists?("public/robots.txt"))
      copy_file "robots.txt", "config/robots/#{env_name}.txt"
    end
  end
  if FileTest.exists?("public/robots.txt")
   copy_file File.join(destination_root + "/public/robots.txt"), "config/robots/production.txt"
   remove_file "public/robots.txt"
  end
end

- (Object) show_readme



27
28
29
# File 'lib/generators/roboto/install_generator.rb', line 27

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