Skip to content

Commit

Permalink
update gap:plugin and plugin elements
Browse files Browse the repository at this point in the history
  • Loading branch information
goya committed Nov 20, 2015
1 parent b4aad5d commit 9b6c2ae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
confetti (0.11.3)
confetti (0.11.5)
mustache (~> 0.11.2)
nokogiri (~> 1.6.3.1)

Expand Down
26 changes: 18 additions & 8 deletions lib/confetti/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def populate( config_doc, strict = false )
raise XMLError, "malformed config.xml"
end

config_doc = config_doc.gsub("gap:plugin", "gap_plugin") if config_doc

begin
@xml_doc = Nokogiri::XML( config_doc ) { |config|
@xml_doc = Nokogiri::XML( config_doc ) { |config|
strict ? config.nonet.strict : config.nonet.recover
}
rescue Nokogiri::XML::SyntaxError, TypeError, RuntimeError
Expand Down Expand Up @@ -165,18 +167,26 @@ def populate( config_doc, strict = false )
end
end

# parse plugins
config_doc.xpath('//plugin').each { |ele|
# parse gap:plugin
config_doc.xpath('//gap_plugin').each { |ele|
next if ele["name"].nil? or ele["name"].empty?

attrs = get_attributes(ele)

# if spec is present grab it from npm
version = attrs["spec"] || attrs["version"]
source = attrs["source"]
source = "npm" if attrs["spec"]
plugin = Plugin.new(attrs["name"], attrs["spec"] || attrs["version"], attrs["platform"], attrs["source"])
ele.search("param").each do |param|
plugin.param_set << Param.new(param["name"], param["value"])
end
@plugin_set << plugin
}

# parse plugin
config_doc.xpath('//plugin').each { |ele|
next if ele["name"].nil? or ele["name"].empty?

attrs = get_attributes(ele)

plugin = Plugin.new(attrs["name"], version, attrs["platform"], source)
plugin = Plugin.new(attrs["name"], attrs["spec"] || attrs["version"], attrs["platform"], attrs["source"] || "npm")
ele.search("param").each do |param|
plugin.param_set << Param.new(param["name"], param["value"])
end
Expand Down
2 changes: 1 addition & 1 deletion lib/confetti/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Confetti
VERSION = "0.11.3"
VERSION = "0.11.5"
end

0 comments on commit 9b6c2ae

Please sign in to comment.