salesforce-dcgen 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d187846cb6f8af75fb15532ef2eb11b02fbd811
4
- data.tar.gz: b278c6a6d9748ba52b869d49d497254cb89d7838
3
+ metadata.gz: f3355f8b878e2babaed9dca52bef60c9bdee6c85
4
+ data.tar.gz: ca467a14226ef724097eeb6dc8a6a2423fcb8a22
5
5
  SHA512:
6
- metadata.gz: 8c7a5e6f2101a4dd06f12fcd64fbf78105ec871f3ab66816c11d3f743c130c354babfca70b1fb36b21446342b27922e32fa9071c91a0b5008dc4a6ed268c38ad
7
- data.tar.gz: 9976c94447cf2b238a77be46f28c179b8930a2d1e6845e5a4722af70596abd0ffa870e3227e875b52d321ce71e276f9df49848403764701e1a3ede247a240cb1
6
+ metadata.gz: 48a65550b24befa6c037ad3f7ccf92955d8a1477491174e91bdee7aeb103663bf23e040c72b7e0897641971dbc1f4b6a30c9eaf6d89a6a29e3ea8e3b944e8c78
7
+ data.tar.gz: a9c73b0ced60500efd94ce7f0f949caaf530c92030f3e79abb99e08103f6d9c22fc9e508465c09ae35dab0ca5d282937759d47b7497ef995f74a26767e761d94
@@ -1,12 +1,38 @@
1
+ require 'nokogiri'
2
+
1
3
  module Dcgen
2
4
 
3
5
  def self.workflow master , destination
4
6
 
5
- master_workflow = Dir.glob(master + '/workflows/*workflow').map {|c| c.match(/^.*\/(.*).workflow$/)[1] }
6
- destination_workflow = Dir.glob(destination + '/workflows/*workflow').map {|c| c.match(/^.*\/(.*).workflow$/)[1] }
7
+ remove_workflows = []
7
8
 
8
- destination_workflow - master_workflow
9
+ master_workflows = Dir.glob(master + '/workflows/*workflow').map {|c| c.match(/^.*\/(.*).workflow$/)[1] }
9
10
 
10
- end
11
+ master_workflows.each do |workflow|
12
+
13
+ master_workflows_file = File.join(master,'workflows',workflow + '.workflow')
14
+ destination_workflows_file = File.join(destination,'workflows',workflow + '.workflow')
15
+
16
+ if File.exists? destination_workflows_file
17
+
18
+ master_workflows_xml = File.open(master_workflows_file).read
19
+ destination_workflows_xml = File.open(destination_workflows_file).read
20
+
21
+ master_doc = Nokogiri::XML(master_workflows_xml).remove_namespaces!
22
+ destination_doc = Nokogiri::XML(destination_workflows_xml).remove_namespaces!
11
23
 
24
+ # Find all the customfields that are in destination, if they are not present in
25
+ # master, then they have to be in the remove list
26
+ destination_doc.xpath('//rules/fullName').each do |rule|
27
+ remove_workflows << "#{workflow}.#{rule.text}" if master_doc.xpath("//rules[fullName=\"#{rule.text}\"]").empty?
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ remove_workflows
35
+
36
+ end
12
37
  end
38
+
data/lib/dcgen/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dcgen
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce-dcgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger