lib/assetify/dsl.rb in assetify-0.0.2 vs lib/assetify/dsl.rb in assetify-0.1.1
- old
+ new
@@ -1,22 +1,36 @@
module Assetify
-
class DSL
+ def pkg name, url, &block
+ @pkg = Pkg.new name, url
+ instance_exec(&block)
+ @pkg = nil
+ end
+
+ def group name, &block
+ @ns = name
+ instance_exec(&block)
+ @ns = nil
+ assets
+ end
+
+ def assets
+ @assets
+ end
+
+ def method_missing method, name, uri, ver=nil, params={}
+ (@assets ||= []) << Asset.new(method.to_sym, name, uri, ver, params.merge({ :ns => @ns, :pkg => @pkg}))
+ end
+
class << self
- def group name, &block
- ns = name
- def st.method_missing method, name, url
- Asset.new method.to_sym, ns + name, url
- end
- st.instance_exec(&block)
- end
- def method_missing(method, name, url, ver=nil, params={})
- Asset.new method.to_sym, name, url, ver
+ def parse io
+ new.instance_eval(io) #.assets
end
+
end
- end
+ end
end