class Slices::InstallGenerator

Public Instance Methods

create_admin_nav_partials() click to toggle source
# File lib/generators/slices/install_generator.rb, line 25
    def create_admin_nav_partials
      create_file "app/views/admin/shared/_custom_navigation.html.erb", <<-END
      <%# Place custom navbar controls here i.e. %>
      <%#= admin_nav_link 'Example', example_path %>
      END

      create_file "app/views/admin/shared/_custom_links.html.erb", <<-END
      <%# Place custom navbar links here i.e. %>
      <%#= content_tag :li, link_to('Example', example_path) %>
      END
    end
create_application_layout() click to toggle source
# File lib/generators/slices/install_generator.rb, line 21
def create_application_layout
  copy_file "application.html.erb", "app/views/layouts/default.html.erb"
end
create_initializer() click to toggle source
# File lib/generators/slices/install_generator.rb, line 17
def create_initializer
  copy_file "slices.rb", "config/initializers/slices.rb"
end
create_slices_dir() click to toggle source
# File lib/generators/slices/install_generator.rb, line 12
def create_slices_dir
  say "Running the Slices installer..."
  create_file "app/slices/.gitkeep"
end
delete_superfluous_files() click to toggle source
# File lib/generators/slices/install_generator.rb, line 41
def delete_superfluous_files
  remove_file "public/index.html"
  remove_file "public/rails.png"
  remove_dir "public/assets"
end
finishing_up() click to toggle source
# File lib/generators/slices/install_generator.rb, line 59
def finishing_up
  say ""
  say "---------------------------", :green
  say "All done!", :green
  say "---------------------------", :green
  say ""
  say "Next, run 'rake slices:seed' to create your Slices admin user and home page."
  say "Then you can run 'rails server' and visit http://localhost:3000/admin to begin using Slices."
  say "The next step is to create some slices. You can find the guides in the wiki:"
  say "https://github.com/withassociates/slices/wiki"
  say ""
end
heroku_options() click to toggle source
# File lib/generators/slices/install_generator.rb, line 47
def heroku_options
  if options.heroku?
    say "Installing Slices for Heroku", :green
    inject_into_file "#{Rails.root}/config/application.rb", "config.assets.initialize_on_precompile = false",
      :after => "config.assets.enabled = true\n"

    gsub_file "#{Rails.root}/config/environments/production.rb",
      "config.assets.compile = false",
      "config.assets.compile = true"
  end
end
optionally_create_mongoid_yaml() click to toggle source
# File lib/generators/slices/install_generator.rb, line 37
def optionally_create_mongoid_yaml
  generate 'mongoid:config'
end