From b946ff95de405782c7835093f6d02ea526c9df2c Mon Sep 17 00:00:00 2001 From: Greg Jastrab Date: Thu, 18 Dec 2008 17:21:57 -0500 Subject: [PATCH] 0.1.1 - Working on Windows! Now properly executes ANT commands on Windows. Moved the events directory into the view folder. --- History.txt | 7 +++- README.txt | 68 ++++++++++++++++++++++++++++--- bin/puremvc-gen | 2 +- conf/build.xml | 4 +- lib/pure_m_v_c_gen.rb | 2 + lib/pure_m_v_c_gen/ant_checker.rb | 21 +++++++++- lib/pure_m_v_c_gen/version.rb | 2 +- puremvc-gen.gemspec | 6 +-- 8 files changed, 97 insertions(+), 15 deletions(-) diff --git a/History.txt b/History.txt index 5785ff7..fb98b0d 100644 --- a/History.txt +++ b/History.txt @@ -1,4 +1,9 @@ -=== 1.0.0 / 2008-12-02 +=== 0.1.1 / 2008-12-18 + +* Working on Windows! +* Moved events directory into view folder + +=== 0.1.0 / 2008-12-02 * 1 major enhancement diff --git a/README.txt b/README.txt index 6819d21..5cbb6cb 100644 --- a/README.txt +++ b/README.txt @@ -1,26 +1,82 @@ = PureMVCGen -* FIX (url) +* http://bit.ly/puremvc-gen == DESCRIPTION: -FIX (describe your package) +PureMVCGen is a ruby gem which wraps an ANT-based code generation +utility for generating PureMVC ActionScript code. == FEATURES/PROBLEMS: -* FIX (list of features or problems) + -Features- + + * Validates project property settings + * Generates the skeleton of a new Flex PureMVC project including: + - appropriate PureMVC folders + - Facade class + - StartupCommand and PrepareActorsCommand classes + * Generates skeleton PureMVC clases: + - SimpleCommand + - MacroCommand + _ Proxy + - Mediator + + -Problems- + + * MultiCore templates not yet created == SYNOPSIS: + Lines starting with a $ denote the following command should + be run on the command line. + + 1. Create a proj.properties file in the directory you wish to begin + your project + + 2. $ puremvc-gen check + + The check command will check if the required properties for a + project have been set. If they have not it will denote what + the required properties are. Refer to the example settings at + the blog post at http://bit.ly/puremvc-gen + + 3. Set the required properties in proj.properties + + 4. $ puremvc-gen init + + The init command will create the skeleton of a new Flex PureMVC project. + + If you want to create a new command: + + $ puremvc-gen new command -n Example + + which would generate a new SimpleCommand named ExampleCommand. + + For help using puremvc-gen: + + $ puremvc-gen help + + which will output the usage: + + Usage: puremvc-gen [options] COMMAND [options] [COMMAND [options] ...] [args] - FIX (code sample of usage) + Available commands: + check Validates that all required property settings are current detected + help Provide help for individual commands + init Initializes the current working directory with a new PureMVC project + new Command to generate PureMVC classes + command Creates a simple or macro command (defaults to simple). + mediator Creates a new mediator. + proxy Creates a new proxy. + version Show the version of the program == REQUIREMENTS: -* FIX (list of requirements) +* Apache ANT: http://ant.apache.org == INSTALL: -* FIX (sudo gem install, anything else) +* sudo gem install puremvc-gen == LICENSE: diff --git a/bin/puremvc-gen b/bin/puremvc-gen index 66ba186..ad70220 100644 --- a/bin/puremvc-gen +++ b/bin/puremvc-gen @@ -7,7 +7,7 @@ PMVC_GEN_HOME = File.join(File.dirname(__FILE__), '..', 'conf') BUILDFILE = File.join(PMVC_GEN_HOME, 'build.xml') def call_ant(args='') - system "ant -f #{BUILDFILE} -Dpmvcgen.dir=#{PMVC_GEN_HOME} -Dbasedir=#{Dir.pwd} #{args}" + system "#{ANT_BIN} -f #{File.expand_path BUILDFILE} -Dpmvcgen.dir=#{File.expand_path PMVC_GEN_HOME} -Dbasedir=#{Dir.pwd} #{args}" end cmd = CmdParse::CommandParser.new(true, true) diff --git a/conf/build.xml b/conf/build.xml index 655a01c..d460506 100644 --- a/conf/build.xml +++ b/conf/build.xml @@ -183,7 +183,7 @@ - + @@ -217,7 +217,7 @@ ${log.gen.event} + toFile="${core.dir}/${view.dir}/${events.dir}/${event.class.name}.as"> diff --git a/lib/pure_m_v_c_gen.rb b/lib/pure_m_v_c_gen.rb index ca57760..8d8bbe6 100644 --- a/lib/pure_m_v_c_gen.rb +++ b/lib/pure_m_v_c_gen.rb @@ -15,6 +15,8 @@ unless PureMVCGen::AntChecker.has_ant_installed? exit 1 end +ANT_BIN = PureMVCGen::AntChecker.on_windows? ? PureMVCGen::AntChecker.get_windows_ant : "ant" + CMD_PATH = File.join(PMVC_GEN_LIB, 'commands') require File.join(CMD_PATH, 'command_extensions') diff --git a/lib/pure_m_v_c_gen/ant_checker.rb b/lib/pure_m_v_c_gen/ant_checker.rb index 9861001..c24b8f7 100644 --- a/lib/pure_m_v_c_gen/ant_checker.rb +++ b/lib/pure_m_v_c_gen/ant_checker.rb @@ -9,7 +9,7 @@ module PureMVCGen # Searches the path, looking for the given utility. If an executable # file is found that matches the parameter, this returns true. def self.find_in_path(utility) - path = (ENV['PATH'] || "").split(File::PATH_SEPARATOR) + path = self.get_path suffixes = self.on_windows? ? self.windows_executable_extensions : [""] path.each do |dir| @@ -22,6 +22,25 @@ module PureMVCGen false end + def self.get_path + (ENV['PATH'] || "").split(File::PATH_SEPARATOR) + end + + # Locates the ant executable or BAT file and returns the full path to it + def self.get_windows_ant + ext = %w(.exe .bat) + path = self.get_path + + path.each do |dir| + ext.each do |sfx| + file = File.join(dir, "ant" + sfx) + return File.expand_path(file) if File.executable?(file) + end + end + + nil + end + def self.on_windows? RUBY_PLATFORM =~ /mswin|mingw/ end diff --git a/lib/pure_m_v_c_gen/version.rb b/lib/pure_m_v_c_gen/version.rb index f3c2ebe..43c0566 100644 --- a/lib/pure_m_v_c_gen/version.rb +++ b/lib/pure_m_v_c_gen/version.rb @@ -12,7 +12,7 @@ module PureMVCGen MAJOR = 0 MINOR = 1 - TINY = 0 + TINY = 1 ARRAY = [MAJOR, MINOR, TINY] STRING = ARRAY.join(".") diff --git a/puremvc-gen.gemspec b/puremvc-gen.gemspec index 45fb460..4d36565 100644 --- a/puremvc-gen.gemspec +++ b/puremvc-gen.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = %q{puremvc-gen} - s.version = "0.1.0" + s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Greg Jastrab"] - s.date = %q{2008-12-05} + s.date = %q{2008-12-18} s.default_executable = %q{puremvc-gen} s.description = %q{An ANT-based PureMVC generator.} s.email = %q{gjastrab.dev@gmail.com} @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"] s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/puremvc-gen", "conf/build.xml", "conf/config/pmvcgen.log.properties", "conf/config/pmvcgen.properties", "conf/example/author.properties", "conf/example/proj.properties", "conf/templates/.DS_Store", "conf/templates/Event.tpl", "conf/templates/standard/Application.tpl", "conf/templates/standard/Facade.tpl", "conf/templates/standard/MacroCommand.tpl", "conf/templates/standard/Mediator.tpl", "conf/templates/standard/Proxy.tpl", "conf/templates/standard/SimpleCommand.tpl", "lib/pure_m_v_c_gen.rb", "lib/pure_m_v_c_gen/ant_checker.rb", "lib/pure_m_v_c_gen/commands/check_command.rb", "lib/pure_m_v_c_gen/commands/command_extensions.rb", "lib/pure_m_v_c_gen/commands/initialize_command.rb", "lib/pure_m_v_c_gen/commands/new_command.rb", "lib/pure_m_v_c_gen/version.rb", "puremvc-gen.gemspec", "test/test_pure_m_v_c_gen.rb"] s.has_rdoc = true - s.homepage = %q{FIX (url)} + s.homepage = %q{http://bit.ly/puremvc-gen} s.rdoc_options = ["--main", "README.txt"] s.require_paths = ["lib"] s.rubyforge_project = %q{gjastrab}