lib/middleman_ember_scaffold/cli.rb in mes-0.2.2 vs lib/middleman_ember_scaffold/cli.rb in mes-0.2.3

- old
+ new

@@ -17,10 +17,15 @@ unless ARGV[1].nil? || ARGV[1].start_with?("-") ARGV.push ARGV[1] ARGV[1] = '-p' end + unless ARGV[3].nil? || ARGV[3].start_with?("-") + ARGV.push ARGV[3] + ARGV[3] = '-f' + end + # Default command is server if ARGV[0] != "help" && (ARGV.length < 1 || ARGV.first.include?("-")) ARGV.unshift("help") end super @@ -57,16 +62,23 @@ end # Intercept missing methods and search subtasks for them # @param [Symbol] meth def method_missing(meth, *args) - meth = meth.to_s + unless meth.to_s.include?(":") + meth = meth.to_s + myclass = meth.to_s + else + parts = meth.to_s.split(":") + meth = parts[1] + myclass = parts[0] + end if self.class.map.has_key?(meth) meth = self.class.map[meth] end - klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}") + klass, task = Thor::Util.find_class_and_task_by_namespace("#{myclass}:#{meth}") if klass.nil? tasks_dir = File.join(Dir.pwd, "tasks") if File.exists?(tasks_dir)