metaforce 0.2.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/.gitignore +7 -0
  2. data/.rvmrc +55 -0
  3. data/Gemfile +10 -0
  4. data/Guardfile +9 -0
  5. data/README.md +59 -0
  6. data/Rakefile +6 -0
  7. data/lib/metaforce.rb +4 -0
  8. data/lib/metaforce/api.rb +3 -0
  9. data/lib/metaforce/api/metadata.rb +117 -0
  10. data/lib/metaforce/api/services.rb +33 -0
  11. data/lib/metaforce/api/transaction.rb +53 -0
  12. data/lib/metaforce/config.rb +24 -0
  13. data/lib/metaforce/manifest.rb +313 -0
  14. data/lib/metaforce/version.rb +3 -0
  15. data/metaforce.gemspec +28 -0
  16. data/spec/.gitignore +1 -0
  17. data/spec/fixtures/package.xml +17 -0
  18. data/spec/fixtures/requests/check_deploy_status/done.xml +33 -0
  19. data/spec/fixtures/requests/check_deploy_status/error.xml +26 -0
  20. data/spec/fixtures/requests/check_status/done.xml +19 -0
  21. data/spec/fixtures/requests/check_status/not_done.xml +19 -0
  22. data/spec/fixtures/requests/deploy/in_progress.xml +13 -0
  23. data/spec/fixtures/requests/describe_metadata/success.xml +230 -0
  24. data/spec/fixtures/requests/list_metadata/objects.xml +33 -0
  25. data/spec/fixtures/requests/login/failure.xml +15 -0
  26. data/spec/fixtures/requests/login/success.xml +39 -0
  27. data/spec/fixtures/sample/src/classes/TestClass.cls +2 -0
  28. data/spec/fixtures/sample/src/classes/TestClass.cls-meta.xml +5 -0
  29. data/spec/fixtures/sample/src/package.xml +8 -0
  30. data/spec/lib/api/metadata_spec.rb +139 -0
  31. data/spec/lib/api/services_spec.rb +24 -0
  32. data/spec/lib/api/transaction_spec.rb +62 -0
  33. data/spec/lib/config_spec.rb +53 -0
  34. data/spec/lib/manifest_spec.rb +181 -0
  35. data/spec/spec_helper.rb +11 -0
  36. data/wsdl/23.0/metadata.xml +3520 -0
  37. data/wsdl/23.0/partner.xml +3190 -0
  38. metadata +167 -0
@@ -0,0 +1,3 @@
1
+ module Metaforce
2
+ VERSION = "0.2.0.alpha"
3
+ end
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "metaforce/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "metaforce"
7
+ s.version = Metaforce::VERSION
8
+ s.authors = ["Eric J. Holmes"]
9
+ s.email = ["eric@ejholmes.net"]
10
+ s.homepage = "https://github.com/ejholmes/metaforce"
11
+ s.summary = %q{A Ruby gem for interacting with the Salesforce Metadata API}
12
+ s.description = %q{A Ruby gem for interacting with the Salesforce Metadata API}
13
+
14
+ s.rubyforge_project = "metaforce"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "nokogiri"
22
+ s.add_dependency "savon"
23
+ s.add_dependency "rubyzip"
24
+
25
+ s.add_development_dependency "rspec"
26
+ s.add_development_dependency "mocha"
27
+ s.add_development_dependency "savon_spec"
28
+ end
@@ -0,0 +1 @@
1
+ test_spec.rb
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0"?>
2
+ <Package xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <types>
4
+ <members>TestClass</members>
5
+ <members>AnotherClass</members>
6
+ <name>ApexClass</name>
7
+ </types>
8
+ <types>
9
+ <members>Component</members>
10
+ <name>ApexComponent</name>
11
+ </types>
12
+ <types>
13
+ <members>Assets</members>
14
+ <name>StaticResource</name>
15
+ </types>
16
+ <version>23.0</version>
17
+ </Package>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <soapenv:Body>
4
+ <checkDeployStatusResponse>
5
+ <result>
6
+ <id>04sU0000000WRCXIA4</id>
7
+ <messages>
8
+ <changed>true</changed>
9
+ <created>true</created>
10
+ <deleted>false</deleted>
11
+ <fileName>src/classes/TestClass.cls</fileName>
12
+ <fullName>TestClass</fullName>
13
+ <id>01pU0000000pDrtIAE</id>
14
+ <success>true</success>
15
+ </messages>
16
+ <messages>
17
+ <changed>true</changed>
18
+ <created>false</created>
19
+ <deleted>false</deleted>
20
+ <fileName>src/package.xml</fileName>
21
+ <fullName>package.xml</fullName>
22
+ <success>true</success>
23
+ </messages>
24
+ <runTestResult>
25
+ <numFailures>0</numFailures>
26
+ <numTestsRun>0</numTestsRun>
27
+ <totalTime>-1.0</totalTime>
28
+ </runTestResult>
29
+ <success>true</success>
30
+ </result>
31
+ </checkDeployStatusResponse>
32
+ </soapenv:Body>
33
+ </soapenv:Envelope>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <soapenv:Body>
4
+ <checkDeployStatusResponse>
5
+ <result>
6
+ <id>04sU0000000WRBLIA4</id>
7
+ <messages>
8
+ <changed>false</changed>
9
+ <created>false</created>
10
+ <deleted>false</deleted>
11
+ <fileName>classes/package.xml</fileName>
12
+ <fullName>package.xml</fullName>
13
+ <problem>No package.xml found</problem>
14
+ <problemType>Error</problemType>
15
+ <success>false</success>
16
+ </messages>
17
+ <runTestResult>
18
+ <numFailures>0</numFailures>
19
+ <numTestsRun>0</numTestsRun>
20
+ <totalTime>0.0</totalTime>
21
+ </runTestResult>
22
+ <success>false</success>
23
+ </result>
24
+ </checkDeployStatusResponse>
25
+ </soapenv:Body>
26
+ </soapenv:Envelope>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <soapenv:Body>
4
+ <checkStatusResponse>
5
+ <result>
6
+ <done>true</done>
7
+ <id>04sU0000000WNWoIAO</id>
8
+ <numberComponentErrors>0</numberComponentErrors>
9
+ <numberComponentsDeployed>0</numberComponentsDeployed>
10
+ <numberComponentsTotal>1</numberComponentsTotal>
11
+ <numberTestErrors>0</numberTestErrors>
12
+ <numberTestsCompleted>0</numberTestsCompleted>
13
+ <numberTestsTotal>0</numberTestsTotal>
14
+ <state>Completed</state>
15
+ <stateDetailLastModifiedDate>2012-01-12T06:42:54.000Z</stateDetailLastModifiedDate>
16
+ </result>
17
+ </checkStatusResponse>
18
+ </soapenv:Body>
19
+ </soapenv:Envelope>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <soapenv:Body>
4
+ <checkStatusResponse>
5
+ <result>
6
+ <done>false</done>
7
+ <id>04sU0000000WNWoIAo</id>
8
+ <numberComponentErrors>0</numberComponentErrors>
9
+ <numberComponentsDeployed>0</numberComponentsDeployed>
10
+ <numberComponentsTotal>1</numberComponentsTotal>
11
+ <numberTestErrors>0</numberTestErrors>
12
+ <numberTestsCompleted>0</numberTestsCompleted>
13
+ <numberTestsTotal>0</numberTestsTotal>
14
+ <state>Completed</state>
15
+ <stateDetailLastModifiedDate>2012-01-12T06:42:54.000Z</stateDetailLastModifiedDate>
16
+ </result>
17
+ </checkStatusResponse>
18
+ </soapenv:Body>
19
+ </soapenv:Envelope>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <soapenv:Body>
4
+ <deployResponse>
5
+ <result>
6
+ <done>false</done>
7
+ <id>04sU0000000WNWoIAO</id>
8
+ <state>InProgress</state>
9
+ <stateDetailLastModifiedDate>2012-01-12T06:42:54.000Z</stateDetailLastModifiedDate>
10
+ </result>
11
+ </deployResponse>
12
+ </soapenv:Body>
13
+ </soapenv:Envelope>
@@ -0,0 +1,230 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <soapenv:Body>
4
+ <describeMetadataResponse>
5
+ <result>
6
+ <metadataObjects>
7
+ <childXmlNames>CustomLabel</childXmlNames>
8
+ <directoryName>labels</directoryName>
9
+ <inFolder>false</inFolder>
10
+ <metaFile>false</metaFile>
11
+ <suffix>labels</suffix>
12
+ <xmlName>CustomLabels</xmlName>
13
+ </metadataObjects>
14
+ <metadataObjects>
15
+ <directoryName>staticresources</directoryName>
16
+ <inFolder>false</inFolder>
17
+ <metaFile>true</metaFile>
18
+ <suffix>resource</suffix>
19
+ <xmlName>StaticResource</xmlName>
20
+ </metadataObjects>
21
+ <metadataObjects>
22
+ <directoryName>scontrols</directoryName>
23
+ <inFolder>false</inFolder>
24
+ <metaFile>true</metaFile>
25
+ <suffix>scf</suffix>
26
+ <xmlName>Scontrol</xmlName>
27
+ </metadataObjects>
28
+ <metadataObjects>
29
+ <directoryName>components</directoryName>
30
+ <inFolder>false</inFolder>
31
+ <metaFile>true</metaFile>
32
+ <suffix>component</suffix>
33
+ <xmlName>ApexComponent</xmlName>
34
+ </metadataObjects>
35
+ <metadataObjects>
36
+ <directoryName>pages</directoryName>
37
+ <inFolder>false</inFolder>
38
+ <metaFile>true</metaFile>
39
+ <suffix>page</suffix>
40
+ <xmlName>ApexPage</xmlName>
41
+ </metadataObjects>
42
+ <metadataObjects>
43
+ <childXmlNames>CustomField</childXmlNames>
44
+ <childXmlNames>BusinessProcess</childXmlNames>
45
+ <childXmlNames>RecordType</childXmlNames>
46
+ <childXmlNames>WebLink</childXmlNames>
47
+ <childXmlNames>ValidationRule</childXmlNames>
48
+ <childXmlNames>NamedFilter</childXmlNames>
49
+ <childXmlNames>SharingReason</childXmlNames>
50
+ <childXmlNames>ListView</childXmlNames>
51
+ <childXmlNames>FieldSet</childXmlNames>
52
+ <directoryName>objects</directoryName>
53
+ <inFolder>false</inFolder>
54
+ <metaFile>false</metaFile>
55
+ <suffix>object</suffix>
56
+ <xmlName>CustomObject</xmlName>
57
+ </metadataObjects>
58
+ <metadataObjects>
59
+ <directoryName>reportTypes</directoryName>
60
+ <inFolder>false</inFolder>
61
+ <metaFile>false</metaFile>
62
+ <suffix>reportType</suffix>
63
+ <xmlName>ReportType</xmlName>
64
+ </metadataObjects>
65
+ <metadataObjects>
66
+ <directoryName>reports</directoryName>
67
+ <inFolder>true</inFolder>
68
+ <metaFile>false</metaFile>
69
+ <suffix>report</suffix>
70
+ <xmlName>Report</xmlName>
71
+ </metadataObjects>
72
+ <metadataObjects>
73
+ <directoryName>dashboards</directoryName>
74
+ <inFolder>true</inFolder>
75
+ <metaFile>false</metaFile>
76
+ <suffix>dashboard</suffix>
77
+ <xmlName>Dashboard</xmlName>
78
+ </metadataObjects>
79
+ <metadataObjects>
80
+ <directoryName>layouts</directoryName>
81
+ <inFolder>false</inFolder>
82
+ <metaFile>false</metaFile>
83
+ <suffix>layout</suffix>
84
+ <xmlName>Layout</xmlName>
85
+ </metadataObjects>
86
+ <metadataObjects>
87
+ <directoryName>documents</directoryName>
88
+ <inFolder>true</inFolder>
89
+ <metaFile>true</metaFile>
90
+ <xmlName>Document</xmlName>
91
+ </metadataObjects>
92
+ <metadataObjects>
93
+ <directoryName>weblinks</directoryName>
94
+ <inFolder>false</inFolder>
95
+ <metaFile>false</metaFile>
96
+ <suffix>weblink</suffix>
97
+ <xmlName>CustomPageWebLink</xmlName>
98
+ </metadataObjects>
99
+ <metadataObjects>
100
+ <directoryName>tabs</directoryName>
101
+ <inFolder>false</inFolder>
102
+ <metaFile>false</metaFile>
103
+ <suffix>tab</suffix>
104
+ <xmlName>CustomTab</xmlName>
105
+ </metadataObjects>
106
+ <metadataObjects>
107
+ <directoryName>applications</directoryName>
108
+ <inFolder>false</inFolder>
109
+ <metaFile>false</metaFile>
110
+ <suffix>app</suffix>
111
+ <xmlName>CustomApplication</xmlName>
112
+ </metadataObjects>
113
+ <metadataObjects>
114
+ <directoryName>portals</directoryName>
115
+ <inFolder>false</inFolder>
116
+ <metaFile>false</metaFile>
117
+ <suffix>portal</suffix>
118
+ <xmlName>Portal</xmlName>
119
+ </metadataObjects>
120
+ <metadataObjects>
121
+ <directoryName>letterhead</directoryName>
122
+ <inFolder>false</inFolder>
123
+ <metaFile>false</metaFile>
124
+ <suffix>letter</suffix>
125
+ <xmlName>Letterhead</xmlName>
126
+ </metadataObjects>
127
+ <metadataObjects>
128
+ <directoryName>email</directoryName>
129
+ <inFolder>true</inFolder>
130
+ <metaFile>true</metaFile>
131
+ <suffix>email</suffix>
132
+ <xmlName>EmailTemplate</xmlName>
133
+ </metadataObjects>
134
+ <metadataObjects>
135
+ <childXmlNames>WorkflowAlert</childXmlNames>
136
+ <childXmlNames>WorkflowTask</childXmlNames>
137
+ <childXmlNames>WorkflowOutboundMessage</childXmlNames>
138
+ <childXmlNames>WorkflowFieldUpdate</childXmlNames>
139
+ <childXmlNames>WorkflowRule</childXmlNames>
140
+ <childXmlNames xsi:nil="true"/>
141
+ <directoryName>workflows</directoryName>
142
+ <inFolder>false</inFolder>
143
+ <metaFile>false</metaFile>
144
+ <suffix>workflow</suffix>
145
+ <xmlName>Workflow</xmlName>
146
+ </metadataObjects>
147
+ <metadataObjects>
148
+ <directoryName>homePageComponents</directoryName>
149
+ <inFolder>false</inFolder>
150
+ <metaFile>false</metaFile>
151
+ <suffix>homePageComponent</suffix>
152
+ <xmlName>HomePageComponent</xmlName>
153
+ </metadataObjects>
154
+ <metadataObjects>
155
+ <directoryName>homePageLayouts</directoryName>
156
+ <inFolder>false</inFolder>
157
+ <metaFile>false</metaFile>
158
+ <suffix>homePageLayout</suffix>
159
+ <xmlName>HomePageLayout</xmlName>
160
+ </metadataObjects>
161
+ <metadataObjects>
162
+ <directoryName>objectTranslations</directoryName>
163
+ <inFolder>false</inFolder>
164
+ <metaFile>false</metaFile>
165
+ <suffix>objectTranslation</suffix>
166
+ <xmlName>CustomObjectTranslation</xmlName>
167
+ </metadataObjects>
168
+ <metadataObjects>
169
+ <directoryName>classes</directoryName>
170
+ <inFolder>false</inFolder>
171
+ <metaFile>true</metaFile>
172
+ <suffix>cls</suffix>
173
+ <xmlName>ApexClass</xmlName>
174
+ </metadataObjects>
175
+ <metadataObjects>
176
+ <directoryName>triggers</directoryName>
177
+ <inFolder>false</inFolder>
178
+ <metaFile>true</metaFile>
179
+ <suffix>trigger</suffix>
180
+ <xmlName>ApexTrigger</xmlName>
181
+ </metadataObjects>
182
+ <metadataObjects>
183
+ <directoryName>profiles</directoryName>
184
+ <inFolder>false</inFolder>
185
+ <metaFile>false</metaFile>
186
+ <suffix>profile</suffix>
187
+ <xmlName>Profile</xmlName>
188
+ </metadataObjects>
189
+ <metadataObjects>
190
+ <directoryName>permissionsets</directoryName>
191
+ <inFolder>false</inFolder>
192
+ <metaFile>false</metaFile>
193
+ <suffix>permissionset</suffix>
194
+ <xmlName>PermissionSet</xmlName>
195
+ </metadataObjects>
196
+ <metadataObjects>
197
+ <directoryName>datacategorygroups</directoryName>
198
+ <inFolder>false</inFolder>
199
+ <metaFile>false</metaFile>
200
+ <suffix>datacategorygroup</suffix>
201
+ <xmlName>DataCategoryGroup</xmlName>
202
+ </metadataObjects>
203
+ <metadataObjects>
204
+ <directoryName>analyticSnapshots</directoryName>
205
+ <inFolder>false</inFolder>
206
+ <metaFile>false</metaFile>
207
+ <suffix>snapshot</suffix>
208
+ <xmlName>AnalyticSnapshot</xmlName>
209
+ </metadataObjects>
210
+ <metadataObjects>
211
+ <directoryName>remoteSiteSettings</directoryName>
212
+ <inFolder>false</inFolder>
213
+ <metaFile>false</metaFile>
214
+ <suffix>remoteSite</suffix>
215
+ <xmlName>RemoteSiteSetting</xmlName>
216
+ </metadataObjects>
217
+ <metadataObjects>
218
+ <directoryName>sites</directoryName>
219
+ <inFolder>false</inFolder>
220
+ <metaFile>false</metaFile>
221
+ <suffix>site</suffix>
222
+ <xmlName>CustomSite</xmlName>
223
+ </metadataObjects>
224
+ <organizationNamespace/>
225
+ <partialSaveAllowed>true</partialSaveAllowed>
226
+ <testRequired>false</testRequired>
227
+ </result>
228
+ </describeMetadataResponse>
229
+ </soapenv:Body>
230
+ </soapenv:Envelope>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <soapenv:Body>
4
+ <listMetadataResponse>
5
+ <result>
6
+ <createdById>005U0000000EGpcIAG</createdById>
7
+ <createdByName>Foo Bar</createdByName>
8
+ <createdDate>1970-01-01T00:00:00.000Z</createdDate>
9
+ <fileName>objects/ContractContactRole.object</fileName>
10
+ <fullName>ContractContactRole</fullName>
11
+ <id/>
12
+ <lastModifiedById>005U0000000EGpcIAG</lastModifiedById>
13
+ <lastModifiedByName>Foo Bar</lastModifiedByName>
14
+ <lastModifiedDate>1970-01-01T00:00:00.000Z</lastModifiedDate>
15
+ <namespacePrefix/>
16
+ <type>CustomObject</type>
17
+ </result>
18
+ <result>
19
+ <createdById>005U0000000EGpcIAG</createdById>
20
+ <createdByName>Foo Bar</createdByName>
21
+ <createdDate>1970-01-01T00:00:00.000Z</createdDate>
22
+ <fileName>objects/Site.object</fileName>
23
+ <fullName>Site</fullName>
24
+ <id/>
25
+ <lastModifiedById>005U0000000EGpcIAG</lastModifiedById>
26
+ <lastModifiedByName>Foo Bar</lastModifiedByName>
27
+ <lastModifiedDate>1970-01-01T00:00:00.000Z</lastModifiedDate>
28
+ <namespacePrefix/>
29
+ <type>CustomObject</type>
30
+ </result>
31
+ </listMetadataResponse>
32
+ </soapenv:Body>
33
+ </soapenv:Envelope>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <soapenv:Body>
4
+ <soapenv:Fault>
5
+ <faultcode>sf:INVALID_LOGIN</faultcode>
6
+ <faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring>
7
+ <detail>
8
+ <sf:LoginFault xsi:type="sf:LoginFault">
9
+ <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>
10
+ <sf:exceptionMessage>Invalid username, password, security token; or user locked out.</sf:exceptionMessage>
11
+ </sf:LoginFault>
12
+ </detail>
13
+ </soapenv:Fault>
14
+ </soapenv:Body>
15
+ </soapenv:Envelope>