salesforce-dcgen 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -9
- data/bin/dcgen +5 -0
- data/lib/dcgen/plugins/label.rb +38 -0
- data/lib/dcgen/version.rb +1 -1
- data/tpl/destructiveChanges.xml.erb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d6344bd52f41193c4e258fc1386491a8727c5ad
|
4
|
+
data.tar.gz: 2779839a8c80f7ad64527613cf61128c5a5110dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4033ec8664c3ae468980d448be86319cea65180b85efac7696de37e037d34c61febcaccf9fda2e730ce4bef1d4a1bc0bf9bf2cf5a86953bd152db1ec2dcf8a
|
7
|
+
data.tar.gz: 88de73796a60b3dcedc995837586beaa8cfac4ba467327cc75765e50db657a86f1f1a7ff30f592e86fc89d8e4a2be5768ff20c877b05f43bd39f77d314a32999
|
data/README.md
CHANGED
@@ -1,24 +1,42 @@
|
|
1
1
|
# Dcgen
|
2
2
|
|
3
|
-
|
3
|
+
dcgen is a simple tool that generates a destructiveChanges.xml by comparing
|
4
|
+
two salesforce source directories.
|
5
|
+
|
6
|
+
A typical usage example is if you use an SCM to manage your salesforce code and
|
7
|
+
metadata. You can compare your repository contents against what is in a sandbox.
|
8
|
+
Any element that is in you sandbox but is not on your SCM will be included in the
|
9
|
+
destructiveChange.xml.
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
7
|
-
|
13
|
+
```
|
14
|
+
# gem install salesforce-dcgen
|
15
|
+
```
|
16
|
+
## Usage
|
8
17
|
|
9
|
-
|
18
|
+
To get destructiveChanges.xml between two directories just run:
|
10
19
|
|
11
|
-
|
20
|
+
```
|
21
|
+
$ dcgen -m dir/to/scm/repo -d dir/to/sandbox/source/code
|
22
|
+
```
|
12
23
|
|
13
|
-
|
24
|
+
## Metadata API supported:
|
14
25
|
|
15
|
-
|
26
|
+
At the moment the following metadata is supported:
|
16
27
|
|
17
|
-
|
28
|
+
apexclass
|
29
|
+
apexpage
|
30
|
+
approvalprocess
|
31
|
+
customfield
|
32
|
+
group
|
33
|
+
permissionset
|
34
|
+
workflowrule
|
35
|
+
labels
|
18
36
|
|
19
|
-
|
37
|
+
More to come...
|
20
38
|
|
21
|
-
|
39
|
+
Checkout the code, at the moment is VERY easy to add more metadata
|
22
40
|
|
23
41
|
## Contributing
|
24
42
|
|
data/bin/dcgen
CHANGED
@@ -26,6 +26,11 @@ parser = OptionParser.new do |opts|
|
|
26
26
|
options[:exclude] = exclude.split(',')
|
27
27
|
end
|
28
28
|
|
29
|
+
opts.on('-v', '--version', 'Show current version') do
|
30
|
+
puts Dcgen::VERSION
|
31
|
+
exit 0
|
32
|
+
end
|
33
|
+
|
29
34
|
opts.on('-h', '--help', 'Displays Help') do
|
30
35
|
puts opts
|
31
36
|
exit
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Dcgen
|
4
|
+
|
5
|
+
def self.label master , destination
|
6
|
+
|
7
|
+
remove_labels = []
|
8
|
+
|
9
|
+
master_labels = Dir.glob(master + '/labels/*labels').map {|c| c.match(/^.*\/(.*).labels$/)[1] }
|
10
|
+
|
11
|
+
master_labels.each do |label|
|
12
|
+
|
13
|
+
master_labels_file = File.join(master,'labels',label + '.labels')
|
14
|
+
destination_labels_file = File.join(destination,'labels',label + '.labels')
|
15
|
+
|
16
|
+
if File.exists? destination_labels_file
|
17
|
+
|
18
|
+
master_labels_xml = File.open(master_labels_file).read
|
19
|
+
destination_labels_xml = File.open(destination_labels_file).read
|
20
|
+
|
21
|
+
master_doc = Nokogiri::XML(master_labels_xml).remove_namespaces!
|
22
|
+
destination_doc = Nokogiri::XML(destination_labels_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_doc.xpath('//labels/fullName').each do |lb|
|
27
|
+
remove_labels << "#{lb.text}" if master_doc.xpath("//labels[fullName=\"#{lb.text}\"]").empty?
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
remove_labels
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
data/lib/dcgen/version.rb
CHANGED
@@ -56,4 +56,12 @@
|
|
56
56
|
<name>WorkflowRule</name>
|
57
57
|
</types>
|
58
58
|
<% end %>
|
59
|
+
<% if not @metadata[:label].empty? %>
|
60
|
+
<types>
|
61
|
+
<% for @label in @metadata[:label] %>
|
62
|
+
<members><%= @label %></members>
|
63
|
+
<% end %>
|
64
|
+
<name>CustomLabel</name>
|
65
|
+
</types>
|
66
|
+
<% end %>
|
59
67
|
</Package>
|
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.0.
|
4
|
+
version: 0.0.7
|
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-10-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/dcgen/plugins/approvalprocess.rb
|
60
60
|
- lib/dcgen/plugins/customfield.rb
|
61
61
|
- lib/dcgen/plugins/group.rb
|
62
|
+
- lib/dcgen/plugins/label.rb
|
62
63
|
- lib/dcgen/plugins/permissionset.rb
|
63
64
|
- lib/dcgen/plugins/workflowrule.rb
|
64
65
|
- lib/dcgen/version.rb
|