class Padrino::Angularjs::Generators::Install
Public Class Methods
source_root()
click to toggle source
# File lib/padrino/angularjs/generators/install.rb, line 7 def self.source_root; File.expand_path(File.dirname(__FILE__)); end
Public Instance Methods
add_assets()
click to toggle source
# File lib/padrino/angularjs/generators/install.rb, line 20 def add_assets self.destination_root = options[:root] if in_app_root? app = options[:app] check_app_existence(app) self.behavior = :revoke if options[:destroy] unless options[:destroy] require_dependencies('padrino-sprockets', :require => 'padrino/sprockets', :git => 'https://github.com/nightsailer/padrino-sprockets.git') end javascript_root = destination_root(app, '/assets/javascripts') javascript_file = File.join(javascript_root, 'application.js') if File.exist?(javascript_file) insert_into_file javascript_file, "//= require angular\n", :before => "//= require_tree \.\n" else empty_directory javascript_root template 'templates/application.js.tt', javascript_file end angularjs_register = <<-ANGULARJS register Padrino::Sprockets sprockets :paths => Padrino::Angularjs.assets_path ANGULARJS inject_into_file destination_root(app, 'app.rb'), angularjs_register, :after => "register Padrino::Helpers\n" return if self.behavior == :revoke say say '='*65, :green say 'All set for use the AngularJS! Next, follow these steps:', :green say '='*65, :green say 'Run "bundle install"' say '='*65, :green say else say 'You are not at the root of a Padrino application! (config/boot.rb not found)' end end
detect_css_format()
click to toggle source
# File lib/padrino/angularjs/generators/install.rb, line 67 def detect_css_format end
detect_js_format()
click to toggle source
# File lib/padrino/angularjs/generators/install.rb, line 63 def detect_js_format end