salesforce-dcgen 0.5.0 → 0.6.0

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: ef8b1bc1ca57044ed135f3cd18b054e6768d2a81
4
- data.tar.gz: a7339f292363c457d641aa7716fe77f499aa4a9d
3
+ metadata.gz: 686ce608e7d06544dda1e2547578f930ef572215
4
+ data.tar.gz: df46fd772d024595c3ae6d5c0c95b1804ac20017
5
5
  SHA512:
6
- metadata.gz: 308293912d757e186b7d771e30b1db30b0c3e4cc68535612ce42447b0f70950633047205fc0e7ff41594e011b3b15d4fa043a4795b0997178d84ff1662677a31
7
- data.tar.gz: 223dc09830fe89f7b0338e0cbefea3d5f8411210cb765fd5b8e7e0eac34f2895cfdc432dfee8bde2a59a575a0f4f9dfcfa81370f3662de30a72a8d3b5d3b415a
6
+ metadata.gz: 3490e33b42da93499da6b6f97974a886abd09f7d127fbb04fb2d1b6f9785c64daec937300412ed067789d0758d7d250518f9ceb5109e33de452b95e5b8592af3
7
+ data.tar.gz: 773cf02f3fcc331ba4e131ebee6900e084d8d6f89671d1e4f704e07f0eab7ecad9cca7a9e4b877fd59f7bcdad747c924093678489c59cf2f59524da8d44a08e9
data/.gitignore CHANGED
@@ -23,5 +23,5 @@ mkmf.log
23
23
  src
24
24
  destructiveChanges.xml
25
25
  *.swp
26
- test.rb
26
+ test.sh
27
27
  test_data
data/README.md CHANGED
@@ -37,6 +37,7 @@ Labels
37
37
  Workflow field update
38
38
  Layouts
39
39
  CustomObjects
40
+ ValidationRules
40
41
 
41
42
  More to come...
42
43
 
data/bin/dcgen CHANGED
@@ -10,6 +10,10 @@ parser = OptionParser.new do |opts|
10
10
 
11
11
  opts.banner = 'Usage: dcgen [options]'
12
12
 
13
+ opts.on('-q', '--quiet', 'Disable verbose output') do |dir|
14
+ options[:quiet] = dir
15
+ end
16
+
13
17
  opts.on('-m', '--master dir', 'Source dir') do |dir|
14
18
  options[:master] = dir
15
19
  end
@@ -64,6 +68,7 @@ end
64
68
  begin
65
69
  dcgen = Dcgen::App.new
66
70
 
71
+ dcgen.verbose = ! options[:quiet]
67
72
  dcgen.master = options[:master]
68
73
  dcgen.destination = options[:destination]
69
74
  dcgen.output = options[:output] if not options[:output].nil?
data/lib/dcgen/app.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  module Dcgen
2
2
  class App
3
3
 
4
- attr_accessor :master, :destination, :output, :exclude
4
+ attr_accessor :master, :destination, :output, :exclude, :verbose
5
5
 
6
6
  def initialize
7
7
 
8
+ @verbose = true
8
9
  @metadata = {}
9
10
  @exclude = []
10
11
 
@@ -36,8 +37,8 @@ File generated:
36
37
  ===============
37
38
 
38
39
  #{out_file}
39
-
40
- "
40
+
41
+ " if @verbose
41
42
 
42
43
  end
43
44
 
@@ -64,16 +65,17 @@ Changes detected:
64
65
  validate_directories
65
66
 
66
67
  # header output
67
- print_header
68
+ print_header if @verbose
68
69
 
69
70
  # Load plugins and build metadata variables
70
71
  plugins = Dir.glob(File.dirname(__FILE__) + "/plugins/*" )
71
72
 
72
73
  plugins.each do |plugin|
74
+
73
75
  require_relative plugin
74
76
 
75
77
  plugin_name = plugin.match(/^.*\/(.*).rb$/)[1]
76
- plugin_metadata = eval "Dcgen::#{plugin_name} @master, @destination"
78
+ plugin_metadata = eval "Dcgen::#{plugin_name} @master, @destination, @verbose"
77
79
  @metadata[plugin_name.to_sym] = plugin_metadata - @exclude unless plugin_metadata.nil?
78
80
 
79
81
  end
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.apexclass master , destination
3
+ def self.apexclass master , destination, output = true
4
4
 
5
5
  master_classes = Dir.glob(master + '/classes/*cls').map {|c| c.match(/^.*\/(.*).cls$/)[1] }
6
6
  destination_classes = Dir.glob(destination + '/classes/*cls').map {|c| c.match(/^.*\/(.*).cls$/)[1] }
7
7
 
8
8
  remove_classes = destination_classes - master_classes
9
9
 
10
- puts "ApexClasses:" if not remove_classes.empty?
11
- remove_classes.each do |apexclass|
12
- puts " #{apexclass}"
10
+ if output
11
+ puts "ApexClasses:" if not remove_classes.empty?
12
+ remove_classes.each do |apexclass|
13
+ puts " #{apexclass}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_classes
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.apexpage master , destination
3
+ def self.apexpage master , destination, output = true
4
4
 
5
5
  master_pages = Dir.glob(master + '/pages/*page').map {|c| c.match(/^.*\/(.*).page$/)[1] }
6
6
  destination_pages = Dir.glob(destination + '/pages/*page').map {|c| c.match(/^.*\/(.*).page$/)[1] }
7
7
 
8
8
  remove_pages = destination_pages - master_pages
9
9
 
10
- puts "ApexPages:" if not remove_pages.empty?
11
- remove_pages.each do |aplexpage|
12
- puts " #{aplexpage}"
10
+ if output
11
+ puts "ApexPages:" if not remove_pages.empty?
12
+ remove_pages.each do |aplexpage|
13
+ puts " #{aplexpage}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_pages
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.apextrigger master , destination
3
+ def self.apextrigger master , destination, output = true
4
4
 
5
5
  master_triggers = Dir.glob(master + '/triggers/*trigger').map {|c| c.match(/^.*\/(.*).trigger$/)[1] }
6
6
  destination_triggers = Dir.glob(destination + '/triggers/*trigger').map {|c| c.match(/^.*\/(.*).trigger$/)[1] }
7
7
 
8
8
  remove_triggers = destination_triggers - master_triggers
9
9
 
10
- puts "ApexTriggers:" if not remove_triggers.empty?
11
- remove_triggers.each do |apextrigger|
12
- puts " #{apextrigger}"
10
+ if output
11
+ puts "ApexTriggers:" if not remove_triggers.empty?
12
+ remove_triggers.each do |apextrigger|
13
+ puts " #{apextrigger}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_triggers
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.approvalprocess master , destination
3
+ def self.approvalprocess master , destination, output = true
4
4
 
5
5
  master_approvalprocess = Dir.glob(master + '/approvalProcesses/*approvalProcess').map {|c| c.match(/^.*\/(.*).approvalProcess$/)[1] }
6
6
  destination_approvalprocess = Dir.glob(destination + '/approvalProcesses/*approvalProcess').map {|c| c.match(/^.*\/(.*).approvalProcess$/)[1] }
7
7
 
8
8
  remove_approvalprocess = destination_approvalprocess - master_approvalprocess
9
9
 
10
- puts "ApprovalProcesses:" if not remove_approvalprocess.empty?
11
- remove_approvalprocess.each do |approvalprocess|
12
- puts " #{approvalprocess}"
10
+ if output
11
+ puts "ApprovalProcesses:" if not remove_approvalprocess.empty?
12
+ remove_approvalprocess.each do |approvalprocess|
13
+ puts " #{approvalprocess}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_approvalprocess
@@ -2,7 +2,7 @@ require 'nokogiri'
2
2
 
3
3
  module Dcgen
4
4
 
5
- def self.customfield master , destination
5
+ def self.customfield master , destination, output = true
6
6
 
7
7
  remove_customfields = []
8
8
 
@@ -31,9 +31,12 @@ module Dcgen
31
31
 
32
32
  end
33
33
 
34
- puts "CustomFields:" if not remove_customfields.empty?
35
- remove_customfields.each do |customfield|
36
- puts " #{customfield}"
34
+
35
+ if output
36
+ puts "CustomFields:" if not remove_customfields.empty?
37
+ remove_customfields.each do |customfield|
38
+ puts " #{customfield}"
39
+ end
37
40
  end
38
41
 
39
42
  remove_customfields
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.customobject master , destination
3
+ def self.customobject master , destination, output = true
4
4
 
5
5
  master_customobject = Dir.glob(master + '/objects/*object').map {|c| c.match(/^.*\/(.*).object$/)[1] }
6
6
  destination_customobject = Dir.glob(destination + '/objects/*object').map {|c| c.match(/^.*\/(.*).object$/)[1] }
7
7
 
8
8
  remove_customobject = destination_customobject - master_customobject
9
9
 
10
- puts "CustomObjects:" if not remove_customobject.empty?
11
- remove_customobject.each do |customobject|
12
- puts " #{customobject}"
10
+ if output
11
+ puts "CustomObjects:" if not remove_customobject.empty?
12
+ remove_customobject.each do |customobject|
13
+ puts " #{customobject}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_customobject
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.group master , destination
3
+ def self.group master , destination, output = true
4
4
 
5
5
  master_groups = Dir.glob(master + '/groups/*group').map {|c| c.match(/^.*\/(.*).group$/)[1] }
6
6
  destination_groups = Dir.glob(destination + '/groups/*group').map {|c| c.match(/^.*\/(.*).group$/)[1] }
7
7
 
8
8
  remove_groups = destination_groups - master_groups
9
9
 
10
- puts "Groups:" if not remove_groups.empty?
11
- remove_groups.each do |group|
12
- puts " #{group}"
10
+ if output
11
+ puts "Groups:" if not remove_groups.empty?
12
+ remove_groups.each do |group|
13
+ puts " #{group}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_groups
@@ -2,7 +2,7 @@ require 'nokogiri'
2
2
 
3
3
  module Dcgen
4
4
 
5
- def self.label master , destination
5
+ def self.label master , destination, output = true
6
6
 
7
7
  remove_labels = []
8
8
 
@@ -31,9 +31,12 @@ module Dcgen
31
31
 
32
32
  end
33
33
 
34
- puts "Labels:" if not remove_labels.empty?
35
- remove_labels.each do |label|
36
- puts " #{label}"
34
+
35
+ if output
36
+ puts "Labels:" if not remove_labels.empty?
37
+ remove_labels.each do |label|
38
+ puts " #{label}"
39
+ end
37
40
  end
38
41
 
39
42
  remove_labels
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.layout master , destination
3
+ def self.layout master , destination, output = true
4
4
 
5
5
  master_layout = Dir.glob(master + '/layouts/*layout').map {|c| c.match(/^.*\/(.*).layout$/)[1] }
6
6
  destination_layout = Dir.glob(destination + '/layouts/*layout').map {|c| c.match(/^.*\/(.*).layout$/)[1] }
7
7
 
8
8
  remove_layout = destination_layout - master_layout
9
9
 
10
- puts "Layouts:" if not remove_layout.empty?
11
- remove_layout.each do |layout|
12
- puts " #{layout}"
10
+ if output
11
+ puts "Layouts:" if not remove_layout.empty?
12
+ remove_layout.each do |layout|
13
+ puts " #{layout}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_layout
@@ -1,15 +1,17 @@
1
1
  module Dcgen
2
2
 
3
- def self.permissionset master , destination
3
+ def self.permissionset master , destination, output = true
4
4
 
5
5
  master_permissionset = Dir.glob(master + '/permissionsets/*permissionset').map {|c| c.match(/^.*\/(.*).permissionset$/)[1] }
6
6
  destination_permissionset = Dir.glob(destination + '/permissionsets/*permissionset').map {|c| c.match(/^.*\/(.*).permissionset$/)[1] }
7
7
 
8
8
  remove_permissionset = destination_permissionset - master_permissionset
9
9
 
10
- puts "PermissionSets:" if not remove_permissionset.empty?
11
- remove_permissionset.each do |permissionset|
12
- puts " #{permissionset}"
10
+ if output
11
+ puts "PermissionSets:" if not remove_permissionset.empty?
12
+ remove_permissionset.each do |permissionset|
13
+ puts " #{permissionset}"
14
+ end
13
15
  end
14
16
 
15
17
  remove_permissionset
@@ -0,0 +1,46 @@
1
+ require 'nokogiri'
2
+
3
+ module Dcgen
4
+
5
+ def self.validationrule master , destination, output = true
6
+
7
+ remove_validationrules = []
8
+
9
+ master_obj = Dir.glob(master + '/objects/*object').map {|c| c.match(/^.*\/(.*).object$/)[1] }
10
+
11
+ master_obj.each do |obj|
12
+
13
+ master_obj_file = File.join(master,'objects',obj + '.object')
14
+ destination_obj_file = File.join(destination,'objects',obj + '.object')
15
+
16
+ if File.exists? destination_obj_file
17
+
18
+ master_obj_xml = File.open(master_obj_file).read
19
+ destination_obj_xml = File.open(destination_obj_file).read
20
+
21
+ master_obj_xml = Nokogiri::XML(master_obj_xml).remove_namespaces!
22
+ destination_obj_xml = Nokogiri::XML(destination_obj_xml).remove_namespaces!
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_obj_xml.xpath('//validationRules/fullName').each do |vr|
27
+ remove_validationrules << "#{obj}.#{vr.text}" if master_obj_xml.xpath("//validationRules[fullName=\"#{vr.text}\"]").empty?
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+
35
+ if output
36
+ puts "ValidationRules:" if not remove_validationrules.empty?
37
+ remove_validationrules.each do |obj|
38
+ puts " #{obj}"
39
+ end
40
+ end
41
+
42
+ remove_validationrules
43
+
44
+ end
45
+ end
46
+
@@ -2,7 +2,7 @@ require 'nokogiri'
2
2
 
3
3
  module Dcgen
4
4
 
5
- def self.workflowfieldupdate master , destination
5
+ def self.workflowfieldupdate master , destination, output = true
6
6
 
7
7
  remove_fieldupdates = []
8
8
 
@@ -31,9 +31,11 @@ module Dcgen
31
31
 
32
32
  end
33
33
 
34
- puts "FieldUpdates:" if not remove_fieldupdates.empty?
35
- remove_fieldupdates.each do |fieldupdate|
36
- puts " #{fieldupdate}"
34
+ if output
35
+ puts "FieldUpdates:" if not remove_fieldupdates.empty?
36
+ remove_fieldupdates.each do |fieldupdate|
37
+ puts " #{fieldupdate}"
38
+ end
37
39
  end
38
40
 
39
41
  remove_fieldupdates
@@ -2,7 +2,7 @@ require 'nokogiri'
2
2
 
3
3
  module Dcgen
4
4
 
5
- def self.workflowrule master , destination
5
+ def self.workflowrule master , destination, output = true
6
6
 
7
7
  remove_workflowrules = []
8
8
 
@@ -31,9 +31,11 @@ module Dcgen
31
31
 
32
32
  end
33
33
 
34
- puts "WorkflowRules:" if not remove_workflowrules.empty?
35
- remove_workflowrules.each do |workflowrule|
36
- puts " #{workflowrule}"
34
+ if output
35
+ puts "WorkflowRules:" if not remove_workflowrules.empty?
36
+ remove_workflowrules.each do |workflowrule|
37
+ puts " #{workflowrule}"
38
+ end
37
39
  end
38
40
 
39
41
  remove_workflowrules
data/lib/dcgen/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dcgen
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -88,6 +88,14 @@
88
88
  <name>Layout</name>
89
89
  </types>
90
90
  <% end %>
91
+ <% if not @metadata[:validationrule].empty? %>
92
+ <types>
93
+ <% for @validationrule in @metadata[:validationrule] %>
94
+ <members><%= @validationrule %></members>
95
+ <% end %>
96
+ <name>ValidationRule</name>
97
+ </types>
98
+ <% end %>
91
99
  <% if not @metadata[:customobject].empty? %>
92
100
  <types>
93
101
  <% for @customobject in @metadata[:customobject] %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce-dcgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2015-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ files:
78
78
  - lib/dcgen/plugins/label.rb
79
79
  - lib/dcgen/plugins/layout.rb
80
80
  - lib/dcgen/plugins/permissionset.rb
81
+ - lib/dcgen/plugins/validationrule.rb
81
82
  - lib/dcgen/plugins/workflowfieldupdate.rb
82
83
  - lib/dcgen/plugins/workflowrule.rb
83
84
  - lib/dcgen/version.rb
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  version: '0'
104
105
  requirements: []
105
106
  rubyforge_project:
106
- rubygems_version: 2.2.2
107
+ rubygems_version: 2.4.3
107
108
  signing_key:
108
109
  specification_version: 4
109
110
  summary: dcgen will generate a destructiveChanges.xml by comparing two source directories