hoopla_salesforce 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -21
- data/lib/hoopla_salesforce/deployer.rb +12 -5
- data/lib/hoopla_salesforce/info.rb +1 -1
- data/lib/hoopla_salesforce/rake/deploy_task.rb +16 -12
- data/lib/hoopla_salesforce/rake/retrieve_task.rb +8 -3
- data/lib/hoopla_salesforce/skeleton.rb +5 -7
- data/lib/hoopla_salesforce/template_processor.rb +1 -0
- data/lib/hoopla_salesforce/utils.rb +1 -1
- metadata +22 -15
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
hoopla_salesforce
|
2
2
|
=================
|
3
3
|
|
4
|
-
A
|
4
|
+
A nifty bundle of dev and deployment tools for working on the (Sales)force.com platform.
|
5
5
|
|
6
6
|
Features
|
7
7
|
========
|
@@ -14,7 +14,7 @@ Features
|
|
14
14
|
6. Undeploys your project (destructiveChanges.xml is auto-generated)
|
15
15
|
7. Pre-processes any VisualForce or Apex files with ERB
|
16
16
|
8. Generates static test pages from VisualForce pages
|
17
|
-
9. Runs tests via the Web UI (as results often differ from deploy tests)
|
17
|
+
9. Runs tests via the Web UI (as results often differ from deploy tests) [experimental]
|
18
18
|
10. Makes pancakes (pending)
|
19
19
|
|
20
20
|
Usage
|
@@ -35,18 +35,18 @@ Just run:
|
|
35
35
|
|
36
36
|
This will create an folder called myproject that looks like this:
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
myproject/
|
39
|
+
├── lib
|
40
|
+
├── Rakefile
|
41
|
+
└── src
|
42
|
+
├── applications
|
43
|
+
├── classes
|
44
|
+
├── objects
|
45
|
+
├── package.xml
|
46
|
+
├── pages
|
47
|
+
├── resources
|
48
|
+
├── tabs
|
49
|
+
└── triggers
|
50
50
|
|
51
51
|
Once this is done, drop the enterprise.xml and metadata.xml for your org into `lib/` and update the `Rakefile` to reflect your username, password and security token. Now your project is ready to deploy. Run `rake -T` to show the available rake tasks.
|
52
52
|
|
@@ -65,7 +65,7 @@ During deployment, we'll generate any missing meta.xml files for your assets. Th
|
|
65
65
|
Autopackaging of static resources
|
66
66
|
---------------------------------
|
67
67
|
|
68
|
-
As part of deployment, any folders in src/resources will get zipped up as static resources. So for example if you had a folder `src/resources/Performance` the contents of this folder will get zipped into `src/
|
68
|
+
As part of deployment, any folders in src/resources will get zipped up as static resources. So for example if you had a folder `src/resources/Performance` the contents of this folder will get zipped into `src/staticresources/Performance.resource`. This makes dealing with zipped CSS/JavaScript much easier.
|
69
69
|
|
70
70
|
Undeploying your project
|
71
71
|
------------------------
|
@@ -79,9 +79,9 @@ Pre-processing with ERB
|
|
79
79
|
|
80
80
|
If you append `.erb` to any file in your project, it will get processed through Erubis prior to deployment. This makes it possible to DRY up a lot of your XML, abstract common patterns and even write simple Apex macros.
|
81
81
|
|
82
|
-
Just before the templates are run, the deployer will look for `lib/template_helper.rb` and load that. In this file you can mix your own methods into the template processors. The following example allows you to use `<%=
|
82
|
+
Just before the templates are run, the deployer will look for `lib/template_helper.rb` and load that. In this file you can mix your own methods into the template processors. The following example allows you to use `<%= object do %>...<% end %>` in an object file to avoid writing the XML boilerplate that's required by salesforce.
|
83
83
|
|
84
|
-
|
84
|
+
class HooplaSalesforce::TemplateProcessor::Generic
|
85
85
|
def object(&block)
|
86
86
|
code = <<-XML.margin
|
87
87
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -93,22 +93,27 @@ Just before the templates are run, the deployer will look for `lib/template_help
|
|
93
93
|
XML
|
94
94
|
end
|
95
95
|
end
|
96
|
-
HooplaSalesforce::TemplateProcessor::Generic.send(:include, GenericHelper)
|
97
96
|
|
98
|
-
|
97
|
+
The currently available processors are:
|
99
98
|
|
100
99
|
* `HooplaSalesforce::TemplateProcessor::VisualForce` - used for processing page files
|
101
100
|
* `HooplaSalesforce::TemplateProcessor::TestPage` - used for generating static test pages
|
102
101
|
* `HooplaSalesforce::TemplateProcessor::Generic` - used for any other files
|
103
102
|
|
103
|
+
We'll probably start packaging a large set of default helpers with the gem once we have enough projects to demonstrate which helpers should be considered core. If you have recommendations feel free to contact us.
|
104
|
+
|
104
105
|
Generating Static Test Pages
|
105
106
|
----------------------------
|
106
107
|
|
107
|
-
|
108
|
+
We can also generate static test pages from your Visual Force pages by using:
|
109
|
+
|
110
|
+
rake hsf:testpages
|
111
|
+
|
112
|
+
This makes a `src/pages-test` folder which contains HTML versions of your VisualForce pages. We find this a useful way to do styling and client-side testing. At the moment we only support a few helpers which can generate equivalent VisualForce and HTML, but you can use the template helper technique from the previous section to make more for yourself. The currently implemented helpers are in (template_processor.rb)[http://github.com/hoopla/hoopla_salesforce/blob/master/lib/hoopla_salesforce/template_processor.rb].
|
108
113
|
|
109
114
|
Running tests
|
110
115
|
-------------
|
111
116
|
|
112
117
|
Use WEB_TEST=true to run via web ui. Default will run during deployment. Use TEST_NAMES=Test1,Test2,etc to run specific tests (or TEST_NAMES="" to skip tests).
|
113
118
|
|
114
|
-
(more documentation pending)
|
119
|
+
(more documentation pending, this feature is still experimental)
|
@@ -7,6 +7,8 @@ Savon::Request.logger.level = Logger::WARN
|
|
7
7
|
Savon::Request.log_level = :debug
|
8
8
|
|
9
9
|
module HooplaSalesforce
|
10
|
+
# Deploys and retreives zip files from salesforce using the metadata API.
|
11
|
+
# Use ENV['LOGIN_HOST'] = 'test.salesforce.com' to use this on sandbox organizations.
|
10
12
|
class Deployer
|
11
13
|
attr_accessor :client, :metaclient, :header,
|
12
14
|
:username, :password, :token
|
@@ -31,11 +33,13 @@ module HooplaSalesforce
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def set_certs
|
34
|
-
# TODO figure out how to get Savon to
|
36
|
+
# TODO figure out how to get Savon to validate SF's cert
|
35
37
|
[@client, @metaclient].each { |c| c.request.http.ssl_client_auth(:verify_mode => OpenSSL::SSL::VERIFY_NONE) }
|
36
38
|
end
|
37
39
|
|
38
40
|
def setup_metaclient_and_store_header
|
41
|
+
client.wsdl.soap_endpoint.host = ENV['LOGIN_HOST'] if ENV['LOGIN_HOST']
|
42
|
+
|
39
43
|
response = client.login do |soap, wsse|
|
40
44
|
soap.body = { "wsdl:username" => username, "wsdl:password" => password + token}
|
41
45
|
end.to_hash[:login_response][:result]
|
@@ -60,10 +64,13 @@ module HooplaSalesforce
|
|
60
64
|
|
61
65
|
puts "Deployment requested, awaiting completion of job #{response[:id]}..."
|
62
66
|
while !response[:done]
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
+
begin
|
68
|
+
response = metaclient.check_status do |soap, wsse|
|
69
|
+
soap.header = header
|
70
|
+
soap.body = { "wsdl:asyncProcessId" => response[:id] }
|
71
|
+
end.to_hash[:check_status_response][:result]
|
72
|
+
rescue Timeout::Error
|
73
|
+
end
|
67
74
|
end
|
68
75
|
|
69
76
|
response = metaclient.check_deploy_status do |soap, wsse|
|
@@ -86,11 +86,13 @@ module HooplaSalesforce
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
namespace :testpages do
|
90
|
+
desc "Renders any page templates as test pages in #{processed_src}/pages-test"
|
91
|
+
task task_name => dependencies do
|
92
|
+
mkdir_p "#{src}/pages-test"
|
93
|
+
make_pages do |template|
|
94
|
+
HooplaSalesforce::TemplateProcessor::TestPage.new(src, template)
|
95
|
+
end
|
94
96
|
end
|
95
97
|
end
|
96
98
|
end
|
@@ -112,11 +114,9 @@ module HooplaSalesforce
|
|
112
114
|
end
|
113
115
|
|
114
116
|
def test_options
|
115
|
-
|
116
|
-
{ "wsdl:runAllTests" => true }
|
117
|
-
else
|
117
|
+
unless test_names.empty?
|
118
118
|
test_names.map! { |n| "#{clean_namespace}.#{n}" } if package_namespace
|
119
|
-
{ "wsdl:runTests" =>
|
119
|
+
{ "wsdl:runTests" => test_names }
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -260,9 +260,7 @@ module HooplaSalesforce
|
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
def
|
264
|
-
rm_rf processed_src
|
265
|
-
cp_r src, processed_src
|
263
|
+
def substitute_namespaces
|
266
264
|
Dir["#{processed_src}/**/*"].each do |f|
|
267
265
|
next if File.directory?(f)
|
268
266
|
system %Q|ruby -i -n -e 'print $_.gsub("__NAMESPACE__", "#{package_namespace}")' "#{f}"|
|
@@ -271,7 +269,11 @@ module HooplaSalesforce
|
|
271
269
|
if package_namespace
|
272
270
|
system %Q|ruby -i -n -e 'print $_.gsub("#{package_namespace}", "#{clean_namespace}")' "#{processed_src}/package.xml"|
|
273
271
|
end
|
272
|
+
end
|
274
273
|
|
274
|
+
def process_source
|
275
|
+
rm_rf processed_src
|
276
|
+
cp_r src, processed_src
|
275
277
|
make_resources
|
276
278
|
make_pages do |template|
|
277
279
|
HooplaSalesforce::TemplateProcessor::VisualForce.new(processed_src, template)
|
@@ -282,6 +284,8 @@ module HooplaSalesforce
|
|
282
284
|
HooplaSalesforce::TemplateProcessor::Generic.new(processed_src, template)
|
283
285
|
rm template
|
284
286
|
end
|
287
|
+
|
288
|
+
substitute_namespaces
|
285
289
|
end
|
286
290
|
end
|
287
291
|
end
|
@@ -4,12 +4,17 @@ module HooplaSalesforce
|
|
4
4
|
module Rake
|
5
5
|
class RetrieveTask < BaseTask
|
6
6
|
# The format of the retrieve request. Defaults to:
|
7
|
-
# { "wsdl:
|
8
|
-
#
|
9
|
-
#
|
7
|
+
# { "wsdl:apiVersion" => "18.0",
|
8
|
+
# "wsdl:unpackaged" => { "wsdl:types" =>
|
9
|
+
# [{ "wsdl:members" => "*", "wsdl:name" => "ApexClass" }]
|
10
|
+
# }
|
11
|
+
# }
|
10
12
|
#
|
11
13
|
# If your code is in a salesforce package, you can specify:
|
12
14
|
# { "wsdl:packageNames" => ["Your Package Name"] }
|
15
|
+
#
|
16
|
+
# NOTE: Some components will only be available in higher API versions, so
|
17
|
+
# make sure to set your apiVersion accordingly.
|
13
18
|
attr_accessor :request
|
14
19
|
|
15
20
|
def initialize(name=:retrieve)
|
@@ -86,13 +86,11 @@ module HooplaSalesforce
|
|
86
86
|
HooplaSalesforce.enterprise_wsdl = "lib/enterprise.xml"
|
87
87
|
HooplaSalesforce.metadata_wsdl = "lib/metadata.xml"
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
t.namespace = ""
|
95
|
-
end
|
89
|
+
HooplaSalesforce::Rake::DeployTask.new(:development) do |t|
|
90
|
+
t.username = "you@development.org"
|
91
|
+
t.password = "yourpassword"
|
92
|
+
t.token = "your security token"
|
93
|
+
t.namespace = ""
|
96
94
|
end
|
97
95
|
EOS
|
98
96
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Trotter Cashion
|
@@ -15,13 +15,14 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-31 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: hoopla-savon
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
@@ -36,6 +37,7 @@ dependencies:
|
|
36
37
|
name: rubyzip
|
37
38
|
prerelease: false
|
38
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
39
41
|
requirements:
|
40
42
|
- - ">="
|
41
43
|
- !ruby/object:Gem::Version
|
@@ -50,6 +52,7 @@ dependencies:
|
|
50
52
|
name: commander
|
51
53
|
prerelease: false
|
52
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
53
56
|
requirements:
|
54
57
|
- - ">="
|
55
58
|
- !ruby/object:Gem::Version
|
@@ -64,6 +67,7 @@ dependencies:
|
|
64
67
|
name: erubis
|
65
68
|
prerelease: false
|
66
69
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
67
71
|
requirements:
|
68
72
|
- - ">="
|
69
73
|
- !ruby/object:Gem::Version
|
@@ -78,6 +82,7 @@ dependencies:
|
|
78
82
|
name: mechanize
|
79
83
|
prerelease: false
|
80
84
|
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
81
86
|
requirements:
|
82
87
|
- - ">="
|
83
88
|
- !ruby/object:Gem::Version
|
@@ -99,22 +104,22 @@ extra_rdoc_files: []
|
|
99
104
|
files:
|
100
105
|
- README.md
|
101
106
|
- bin/hoopla_salesforce
|
102
|
-
- lib/hoopla_salesforce/
|
107
|
+
- lib/hoopla_salesforce/commands.rb
|
108
|
+
- lib/hoopla_salesforce/deployer.rb
|
109
|
+
- lib/hoopla_salesforce/eruby.rb
|
110
|
+
- lib/hoopla_salesforce/ext/commander.rb
|
111
|
+
- lib/hoopla_salesforce/ext/string.rb
|
112
|
+
- lib/hoopla_salesforce/info.rb
|
113
|
+
- lib/hoopla_salesforce/package_generator.rb
|
103
114
|
- lib/hoopla_salesforce/rake/base_task.rb
|
104
115
|
- lib/hoopla_salesforce/rake/deploy_task.rb
|
105
116
|
- lib/hoopla_salesforce/rake/retrieve_task.rb
|
106
|
-
- lib/hoopla_salesforce/
|
107
|
-
- lib/hoopla_salesforce/web_agent.rb
|
108
|
-
- lib/hoopla_salesforce/utils.rb
|
109
|
-
- lib/hoopla_salesforce/text_reporter.rb
|
117
|
+
- lib/hoopla_salesforce/rake.rb
|
110
118
|
- lib/hoopla_salesforce/skeleton.rb
|
111
119
|
- lib/hoopla_salesforce/template_processor.rb
|
112
|
-
- lib/hoopla_salesforce/
|
113
|
-
- lib/hoopla_salesforce/
|
114
|
-
- lib/hoopla_salesforce/
|
115
|
-
- lib/hoopla_salesforce/ext/string.rb
|
116
|
-
- lib/hoopla_salesforce/ext/commander.rb
|
117
|
-
- lib/hoopla_salesforce/deployer.rb
|
120
|
+
- lib/hoopla_salesforce/text_reporter.rb
|
121
|
+
- lib/hoopla_salesforce/utils.rb
|
122
|
+
- lib/hoopla_salesforce/web_agent.rb
|
118
123
|
- lib/hoopla_salesforce.rb
|
119
124
|
has_rdoc: true
|
120
125
|
homepage: http://hoopla.net
|
@@ -126,6 +131,7 @@ rdoc_options: []
|
|
126
131
|
require_paths:
|
127
132
|
- lib
|
128
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
129
135
|
requirements:
|
130
136
|
- - ">="
|
131
137
|
- !ruby/object:Gem::Version
|
@@ -133,6 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
139
|
- 0
|
134
140
|
version: "0"
|
135
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
136
143
|
requirements:
|
137
144
|
- - ">="
|
138
145
|
- !ruby/object:Gem::Version
|
@@ -142,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
149
|
requirements: []
|
143
150
|
|
144
151
|
rubyforge_project: nowarning
|
145
|
-
rubygems_version: 1.3.
|
152
|
+
rubygems_version: 1.3.7
|
146
153
|
signing_key:
|
147
154
|
specification_version: 3
|
148
155
|
summary: Helpers for building Salesforce.com projects
|