livingsocial / rake-pipeline

An extension to Rake for dealing with a directory of inputs, a number of filters, and a directory of outputs
MIT License
276 stars 38 forks source link

Find a way to automatically generate ember.js or other frameworks’s libs. #35

Open juan77 opened 12 years ago

juan77 commented 12 years ago

When working on an application we have a bunch of frameworks that are cloned directly, and we need to find a way to generate the framework’s libraries when we made a change on it, so we can work without breaking :D, because we actually generate the ember.js manually by running rakep dist, and same for sproutcore-touch, sproutcore-routing and so on... and we can also add our own small framework.

I think that the idea is to find all other Assetfile, and chain it when something changes.

dudleyf commented 12 years ago

My first thought is to add something like a pipeline DSL method that would take a path to another Assetfile, making that pipeline part of the current pipeline.

xdissent commented 12 years ago

I reworked ember.js to use rake-pipeline (https://github.com/xdissent/ember.js/tree/rake-pipeline) and now I'm trying to hook up its Assetfile in my own project. Currently this works fine in my Rakefile (rack not rails):

task :dist => :clean do
  Dir.chdir "vendor/ember.js" do |d|
    Rake::Pipeline::Project.new("Assetfile").invoke
  end
  Dir.chdir "vendor/ember-data" do |d|
    Rake::Pipeline::Project.new("Assetfile").invoke
  end
  Rake::Pipeline::Project.new("Assetfile").invoke
end

I can't seem to hack the middleware to work though, since calls to Dir.chdir will be nested if you use multiple middlewares causing massive path confusion. A pipeline DSL method would be great. Perhaps we could pass it a base dir from which the Assetfile should be parsed and use a Dir.chdir block around the actual invoke call? I'll play with the idea tonight but I'm not super familiar with creating DSLs (sounds fun though!)

wagenet commented 12 years ago

@juan77 now that Ember is using RakeP to build, this should be possible. You'll probably need to set up a custom middleware that sees if the request is for Ember and punts it to the ember RakeP middleware, otherwise using your app's. If you're using standard Rack, you should be able to do this in your Rackup file.