lib/susanoo/generators/frameworks.rb in susanoo-0.4.0 vs lib/susanoo/generators/frameworks.rb in susanoo-0.4.1

- old
+ new

@@ -19,11 +19,11 @@ "jquery" => "*", "lodash" => "*", }, } - @@js_files = ["jquery/jquery", + @@js_files = ["jquery/dist/jquery", "lodash/dist/lodash", "angular/angular", "angular-animate/angular-animate", "angular-route/angular-route", "angular-sanitize/angular-sanitize", @@ -41,37 +41,40 @@ def susanoo_files template "Gemfile", "#{Susanoo::Project.folder_name}/Gemfile" template "Rakefile", "#{Susanoo::Project.folder_name}/Rakefile" template "config.ru", "#{Susanoo::Project.folder_name}/config.ru" + template ".gitignore", "#{Susanoo::Project.folder_name}/.gitignore" template "bin/susanoo", "#{Susanoo::Project.folder_name}/bin/susanoo" end def ask_for_framework @@bower_data[:name] = Susanoo::Project.folder_name if yes? "Do you need Zurb Foundation? (y/n)" # installing Zurb Foundation @@bower_data[:dependencies][:foundation] = "*" - copy_file "lib/foundation/scss/foundation.scss", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/lib/foundation.scss" - directory "lib/foundation/scss/foundation", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/lib/foundation" - + @@css_dirs << "foundation/scss" @@js_files.unshift "modernizr/modernizr" @@js_files.unshift "foundation/js/foundation" - + @@js_dirs << "foundation/js/foundation" @@is_foundation = true return end - if yes? "What aboud ionic framework? (y/n)" + if yes? "What about ionic framework? (y/n)" # Install ionic framework @@bower_data[:dependencies][:ionic] = "*" - @@js_files.unshift "ionic/js/ionic" - @@js_dirs << "ionic/js/ext" + @@js_files.unshift "ionic/dist/js/ionic" + @@js_files << "angular-ui-router" + @@js_files << "ionic/dist/js/ionic-angular" @@css_dirs.concat(["ionic/scss"]) - @is_ionic = true + # Unfortunately angular-ui-router bower package did not provide current + # So we have to install it manually + template "www/assets/javascripts/lib/angular-ui-router.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/angular-ui-router.js" + @@is_ionic = true end end def bower_install require "json" @@ -85,13 +88,11 @@ end end def install_templates template "www/index.html", "#{Susanoo::Project.folder_name}/www/index.html" - create_file "#{Susanoo::Project.folder_name}/www/views/.keep" do - " " - end + template "www/views/main.html", "#{Susanoo::Project.folder_name}/www/views/main.html" template "www/assets/javascripts/application.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/application.js" template "www/assets/javascripts/functions.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/functions.js" template "www/assets/javascripts/variables.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/variables.js" create_file "#{Susanoo::Project.folder_name}/www/assets/javascripts/modules/.keep" do @@ -101,13 +102,14 @@ template "www/assets/javascripts/main.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/main.js" template "www/assets/stylesheets/application.css", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/application.css" template "www/assets/stylesheets/main.scss", "#{Susanoo::Project.folder_name}/www/assets/stylesheets/main.scss" @source_paths << File.expand_path("#{Susanoo::Project.folder_name}/www/bower_components/") - @@js_files.each do |file| - copy_file "#{file}.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/#{file}.js" + unless file == "angular-ui-router" + copy_file "#{file}.js", "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/#{file}.js" + end end @@js_dirs.each do |dir| directory dir, "#{Susanoo::Project.folder_name}/www/assets/javascripts/lib/#{dir}" end @@ -134,9 +136,13 @@ private def is_foundation? @@is_foundation + end + + def js_dirs + @@js_dirs end def is_ionic? @@is_ionic end