0.1.1 - Working on Windows!

Now properly executes ANT commands on Windows.

Moved the events directory into the view folder.
This commit is contained in:
Greg Jastrab 2008-12-18 17:21:57 -05:00
parent 558863a224
commit b946ff95de
8 changed files with 97 additions and 15 deletions

View File

@ -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 * 1 major enhancement

View File

@ -1,26 +1,82 @@
= PureMVCGen = PureMVCGen
* FIX (url) * http://bit.ly/puremvc-gen
== DESCRIPTION: == 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: == 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: == SYNOPSIS:
Lines starting with a $ denote the following command should
be run on the command line.
FIX (code sample of usage) 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]
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: == REQUIREMENTS:
* FIX (list of requirements) * Apache ANT: http://ant.apache.org
== INSTALL: == INSTALL:
* FIX (sudo gem install, anything else) * sudo gem install puremvc-gen
== LICENSE: == LICENSE:

View File

@ -7,7 +7,7 @@ PMVC_GEN_HOME = File.join(File.dirname(__FILE__), '..', 'conf')
BUILDFILE = File.join(PMVC_GEN_HOME, 'build.xml') BUILDFILE = File.join(PMVC_GEN_HOME, 'build.xml')
def call_ant(args='') 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 end
cmd = CmdParse::CommandParser.new(true, true) cmd = CmdParse::CommandParser.new(true, true)

View File

@ -183,7 +183,7 @@
<mkdir dir="${core.dir}/${model.dir}" /> <mkdir dir="${core.dir}/${model.dir}" />
<mkdir dir="${core.dir}/${view.dir}" /> <mkdir dir="${core.dir}/${view.dir}" />
<mkdir dir="${core.dir}/${controller.dir}/components" /> <mkdir dir="${core.dir}/${controller.dir}/components" />
<mkdir dir="${core.dir}/${events.dir}" /> <mkdir dir="${core.dir}/${view.dir}/${events.dir}" />
</target> </target>
<target name="set-filters"> <target name="set-filters">
@ -217,7 +217,7 @@
<echo>${log.gen.event}</echo> <echo>${log.gen.event}</echo>
<input message="Specify the name of the new event class you wish to create:" addproperty="event.class.name" /> <input message="Specify the name of the new event class you wish to create:" addproperty="event.class.name" />
<copy file="${event.template}" <copy file="${event.template}"
toFile="${core.dir}/${events.dir}/${event.class.name}.as"> toFile="${core.dir}/${view.dir}/${events.dir}/${event.class.name}.as">
<filterset refid="common.filters" /> <filterset refid="common.filters" />
<filterset> <filterset>
<filter token="event.name" value="${event.class.name}" /> <filter token="event.name" value="${event.class.name}" />

View File

@ -15,6 +15,8 @@ unless PureMVCGen::AntChecker.has_ant_installed?
exit 1 exit 1
end end
ANT_BIN = PureMVCGen::AntChecker.on_windows? ? PureMVCGen::AntChecker.get_windows_ant : "ant"
CMD_PATH = File.join(PMVC_GEN_LIB, 'commands') CMD_PATH = File.join(PMVC_GEN_LIB, 'commands')
require File.join(CMD_PATH, 'command_extensions') require File.join(CMD_PATH, 'command_extensions')

View File

@ -9,7 +9,7 @@ module PureMVCGen
# Searches the path, looking for the given utility. If an executable # Searches the path, looking for the given utility. If an executable
# file is found that matches the parameter, this returns true. # file is found that matches the parameter, this returns true.
def self.find_in_path(utility) 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 : [""] suffixes = self.on_windows? ? self.windows_executable_extensions : [""]
path.each do |dir| path.each do |dir|
@ -22,6 +22,25 @@ module PureMVCGen
false false
end 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? def self.on_windows?
RUBY_PLATFORM =~ /mswin|mingw/ RUBY_PLATFORM =~ /mswin|mingw/
end end

View File

@ -12,7 +12,7 @@ module PureMVCGen
MAJOR = 0 MAJOR = 0
MINOR = 1 MINOR = 1
TINY = 0 TINY = 1
ARRAY = [MAJOR, MINOR, TINY] ARRAY = [MAJOR, MINOR, TINY]
STRING = ARRAY.join(".") STRING = ARRAY.join(".")

View File

@ -2,11 +2,11 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{puremvc-gen} 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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Greg Jastrab"] s.authors = ["Greg Jastrab"]
s.date = %q{2008-12-05} s.date = %q{2008-12-18}
s.default_executable = %q{puremvc-gen} s.default_executable = %q{puremvc-gen}
s.description = %q{An ANT-based PureMVC generator.} s.description = %q{An ANT-based PureMVC generator.}
s.email = %q{gjastrab.dev@gmail.com} 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.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.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.has_rdoc = true
s.homepage = %q{FIX (url)} s.homepage = %q{http://bit.ly/puremvc-gen}
s.rdoc_options = ["--main", "README.txt"] s.rdoc_options = ["--main", "README.txt"]
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.rubyforge_project = %q{gjastrab} s.rubyforge_project = %q{gjastrab}