lib/thesilverspoon.rb~ in thesilverspoon-0.0.12 vs lib/thesilverspoon.rb~ in thesilverspoon-0.0.13
- old
+ new
@@ -1,9 +1,9 @@
require "thesilverspoon/version"
# Require the RAILS generators to be able to extend Rails:Generators::NamedBase
require 'rails/generators'
-
+#sample module
module Everything
# If you use the NamedBase inheritance, a 'name' parameter has to follow the 'rails g integratedscaffold'. Won't work otherwise. If you don't want this, use ::Base
class Scaffold < Rails::Generators::NamedBase
# Method in the 'thor' library which gives you access to the accessor methods
@@ -67,10 +67,15 @@
namespaces = plural_name.split('/')
resource = namespaces.pop
route namespaces.reverse.inject("resources :#{resource}") { |acc, namespace|
"namespace(:#{namespace}){ #{acc} }"
}
+
+ s=%{match "#{resource}_integrated_view"=>"#{resource}#integrated_view"\n}
+
+ inject_into_file "config/routes.rb", s, :after=>"resources :#{resource}\n"
+
end
def create_views
@@ -300,14 +305,17 @@
template "#{Install.source_root}/layouts/welcome.html.erb", "app/views/layouts/welcome.html.erb"
end
def insert_devise_code
- inject_into_file "config/application.rb",'require "devise"',:after=>"require File.expand_path('../boot', __FILE__)"
- inject_into_file "app/assets/stylesheets/application.css",'*=require_directory',:before=>"*/"
-append_to_file "app/assets/javascripts/application.js",'//= require bootstrap'
-
- end
+ inject_into_file "config/application.rb", 'require "devise"', :after=>"require File.expand_path('../boot', __FILE__)\n"
+ inject_into_file "config/application.rb", "require 'bootstrap-sass'\n", :after=>"require File.expand_path('../boot', __FILE__)\n"
+ inject_into_file "config/application.rb", "require 'gritter'\n", :after=>"require File.expand_path('../boot', __FILE__)\n"
+
+ inject_into_file "app/assets/stylesheets/application.css", '*=require_directory', :before=>"*/"
+
+ append_to_file "app/assets/javascripts/application.js", '//= require bootstrap'
+ inject_into_file "app/controllers/application_controller.rb", "before_filter :authenticate_user!\n", :after=>" protect_from_forgery\n"
end