API in project files to enable generators and other features

7 views
Skip to first unread message

Dominic Graefen

unread,
Oct 13, 2011, 8:25:50 AM10/13/11
to gator-g...@googlegroups.com
I am having a little trouble deciding on an API to configure the generators and plugins you want to load in for your project.
In the old version we would just require the ruby gems/files and they would just add themselves,
but now I want to get rid of require as I don't think it is a nice solution.

Now that we have a nice configuration mechanism where every plugin can add it's own configuration to be accessible from the project file, I think we should add this functionality there.

Here is how you can configure a project now:

require 'gator-as3'

gator.project do |p|
  p.name = "MyProject"
  p.layout[:source, :main, :as3] = "src"
  p.layout[:source, :test, :as3] = "test"
end

As you can see we still require 'gator-as3'. My plan now is that just requiring it will not add any generators or other functionality to gator. But it will add a configuration for gator-as3, where you then can go in and say I want to load the generators for as3 or mxml with my test framework (asunit3, asunit4, flexunit4 ).

My first draft of the api could be something like this:

gator.as3.test_framework = :asunit4
gator.as3.generators << :mxml
gator.as3.generators << :as3

Or this, which I think is a little better:

gator.as3.use :generators => [:as3, :mxml], :test => :flexunit4

I am still not sold on either of them, let me know how you would like to add your generators.

-- 
Dominic Graefen
Freelance: Interactive Developer / Creative Technologist

Dominic Graefen

unread,
Oct 13, 2011, 3:46:54 PM10/13/11
to gator-g...@googlegroups.com
So I implemented a first draft and made a prerelease of gator and gator-as3,
a simple "gem install gator-as3 --pre" should get you the latest version.

Having a gator.rb file in your project dir that looks like:

require 'gator/as3'

gator.project do |p|
        p.name = "MyProject"
        p.layout[:source, :main, :as3] = "src"
        p.layout[:source, :test, :as3] = "test"
end

gator.as3.use :as3, :mxml, :asunit4

Should work but there are certainly bugs, I didn't look into asunit3 and flexunit4 yet, so they might break.
I would appreciate it if you could give it a try and report issues.

Cheers,

-- 
Dominic Graefen
Freelance: Interactive Developer / Creative Technologist

Dominic Graefen

unread,
Oct 13, 2011, 4:41:07 PM10/13/11
to gator-g...@googlegroups.com
Just made a little update and asunit3 & flexunit4 generators should work now in version 0.0.10.pre of gator-as3.

-- 
Dominic Graefen
Freelance: Interactive Developer / Creative Technologist

Reply all
Reply to author
Forward
0 new messages