Sha256: 7e5d5d9a6c0bc1ba8441e20f54365b8c897522df9bb11b911d05c19e67639924

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'rails'
require 'net/http'
require 'uri'


module Backbonejs
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      
      desc "This generator installs backbone.js, underscore.js, and json2.js"
      source_root File.expand_path('../javascripts', __FILE__)
      # class_option :ich, :type => :boolean, :aliases => "-i", :default => false, :desc => 'Include ICanHaz.js'

      # Copy backbone, underscore, json2 to assets folder
      def copy_backbone
        copy_file "backbone.js", "app/assets/javascripts/backbone.js"
        copy_file "underscore.js", "app/assets/javascripts/underscore.js"
        copy_file "json2.js", "app/assets/javascripts/json2.js"
      end
      
      def insert_backbone_in_applicationjs
        inject_into_file "app/assets/javascripts/application.js", :before => "//= require_tree" do
          "//= require json2\n//= require underscore\n//= require backbone\n"
        end
      end
      
      # def create_dir_layout
      #   %W{routers models views}.each do |dir|
      #     empty_directory "app/assets/javascripts/backbone/#{dir}" 
      #   end
      # end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backbonejs-rails-1.0.1 lib/generators/backbonejs/install/install_generator.rb