lib/gooddata/bricks/brick.rb in gooddata-0.6.0.pre10 vs lib/gooddata/bricks/brick.rb in gooddata-0.6.0.pre11
- old
+ new
@@ -1,22 +1,27 @@
-require 'gooddata/bricks/utils'
-require 'gooddata/bricks/base_downloader'
-require 'gooddata/bricks/middleware/middleware'
-require 'gooddata/bricks/middleware/bench_middleware'
-require 'gooddata/bricks/middleware/gooddata_middleware'
-require 'gooddata/bricks/middleware/logger_middleware'
-require 'gooddata/bricks/middleware/stdout_middleware'
-require 'gooddata/bricks/middleware/restforce_middleware'
-require 'gooddata/bricks/middleware/bulk_salesforce_middleware.rb'
-require 'gooddata/bricks/middleware/twitter_middleware'
+require File.join(File.dirname(__FILE__), 'base_downloader')
+require File.join(File.dirname(__FILE__), 'utils')
+Dir[File.dirname(__FILE__) + '/commands/**/*_cmd.rb'].each do |file|
+ require file
+end
+
+require File.join(File.dirname(__FILE__), 'middleware/middleware')
+
module GoodData::Bricks
class Pipeline
def self.prepare(pipeline)
- pipeline.reverse.reduce(nil) {|memo, app| memo.nil? ? app.new : app.new(memo)}
+ pipeline.reverse.reduce(nil) do |memo, app|
+ if memo.nil?
+ app.respond_to?(:new) ? (app.new) : app
+ else
+ app.respond_to?(:new) ? (app.new(:app => memo)) : (app.app = memo; app)
+ end
+ end
end
end
-
+
+ # Brick base class
class Brick
def log(message)
logger = @params[:gdc_logger]
logger.info(message) unless logger.nil?