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

- old
+ new

@@ -1,11 +1,12 @@ module Susanoo module Generators class Cordova < Thor::Group include Thor::Actions - CORDOVA_VERSION = "v3.3.0" + CORDOVA_VERSION = `cordova -v` + CORDOVA_PATH = `which cordova` def initialize_project fname = Susanoo::Project.folder_name.dup # Java Package name @@ -20,21 +21,23 @@ end # Project name project_name = ask "Project Name [#{fname.colorize(:light_red)}".colorize(:light_green) + "]: ".colorize(:light_green) - say "Initializing project with Apache Cordova #{version}" + say "Initializing project with Apache Cordova #{version} at #{CORDOVA_PATH}" system "cordova create #{Susanoo::Project.folder_name} #{package_name.chomp} #{project_name.chomp}" end def platforms platforms = ask "Platforms (comma separated): ".colorize(:light_blue) inside Susanoo::Project.folder_name do platforms.chomp.split(",").each do |platform| say "Adding #{platform.strip} platform ...".colorize(:green) system "cordova platform add #{platform.strip}" end + say "Adding console plugin to project".colorize(:green) + system "cordova plugin add org.apache.cordova.console" end end def remove_default_files say "Removing cordova default files . . .".colorize(:yellow) @@ -53,10 +56,10 @@ end private def version - CORDOVA_VERSION + CORDOVA_VERSION.chomp end end end end