template/lib/generators/angular_controller/angular_controller_generator.rb
def add_angular_routes
    tmp_file = "app/assets/javascripts/routes.js.coffee"
    files_origin = File.expand_path(File.dirname(__FILE__))+"/templates"
    if FileTest.exists?(tmp_file) then
      if File.readlines(tmp_file).grep(/stateProvider/).size > 0 then
        if File.readlines(tmp_file).grep(/#{class_name.tableize}/).size <= 0 then
          open(tmp_file, 'a') { |f|
            f.puts ERB.new(File.read("#{files_origin}/assets/javascripts/routes.js.coffee.erb")).result(binding)
          }
        else
          say "Warning, #{class_name.tableize} already set in routes #{tmp_file}"
        end
      else
        say "Warning, $stateProvider not found in routes #{tmp_file}"
      end
    else
      say "Error, cannot find file #{tmp_file}"
    end
  end
# Add the new AngularJS routes in app/assets/javascripts/routes.js.coffee
# @todo insert a erb rendered file into the file
Add the new AngularJS routes in app/assets/javascripts/routes.js.coffee
Add the new AngularJS routes in app / assets / javascripts / routes . js . coffee
def add_angular_routes
    tmp_file = "app/assets/javascripts/routes.js.coffee"
    files_origin = File.expand_path(File.dirname(__FILE__))+"/templates"
    if FileTest.exists?(tmp_file) then
      if File.readlines(tmp_file).grep(/stateProvider/).size > 0 then
        if File.readlines(tmp_file).grep(/#{class_name.tableize}/).size <= 0 then
          open(tmp_file, 'a') { |f|
            f.puts ERB.new(File.read("#{files_origin}/assets/javascripts/routes.js.coffee.erb")).result(binding)
          }
        else
          say "Warning, #{class_name.tableize} already set in routes #{tmp_file}"
        end
      else
        say "Warning, $stateProvider not found in routes #{tmp_file}"
      end
    else
      say "Error, cannot find file #{tmp_file}"
    end
  end
def add_angular_routes tmp_file = "app/assets/javascripts/routes.js.coffee" files_origin = File . expand_path ( File . dirname ( __FILE__ ) ) + "/templates" if FileTest . exists? ( tmp_file ) then if File . readlines ( tmp_file ) . grep ( / stateProvider / ) . size > 0 then if File . readlines ( tmp_file ) . grep ( / #{ class_name . tableize } / ) . size <= 0 then open ( tmp_file , 'a' ) { | f | f . puts ERB . new ( File . read ( "#{files_origin}/assets/javascripts/routes.js.coffee.erb" ) ) . result ( binding ) } else say "Warning, #{class_name.tableize} already set in routes #{tmp_file}" end else say "Warning, $stateProvider not found in routes #{tmp_file}" end else say "Error, cannot find file #{tmp_file}" end end
Add the new AngularJS routes in app/assets/javascripts/routes.js.coffee
Add the new AngularJS routes in app / assets / javascripts / routes . js . coffee
todo
insert a erb rendered file into the file
insert a erb rendered file into the file