hoopla_salesforce 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,37 +2,96 @@ require 'hoopla_salesforce/rake/base_task'
|
|
2
2
|
|
3
3
|
module HooplaSalesforce
|
4
4
|
module Rake
|
5
|
+
|
6
|
+
# Deploys your project to salesforce.
|
7
|
+
#
|
8
|
+
# Peforms some nice processing as well including:
|
9
|
+
# - Replaces any occurance of __NAMESPACE__ in your code with the appropriate namespace
|
10
|
+
# declaration if you set a namespace on the task
|
11
|
+
# - Zips up any folders found in src/resources as src/staticresources/#{folder}.resource.
|
12
|
+
# This allows you to only keep the raw assets in your project
|
5
13
|
class DeployTask < BaseTask
|
6
14
|
# Your project root. Defaults to 'src'
|
7
15
|
attr_accessor :src
|
8
16
|
|
9
17
|
# The location of the zip file generated for deployment. Defaults to 'deploy.zip'
|
10
|
-
attr_accessor :
|
18
|
+
attr_accessor :deploy_file
|
19
|
+
|
20
|
+
# The namespace you're deploying the package to. This will convert all
|
21
|
+
# occurrences of __NAMESPACE__ in your source code to your_namespace__.
|
22
|
+
# It's helpful if you're deploying to both your production org (that has
|
23
|
+
# the namespaced package) and a dev org (that does not have one).
|
24
|
+
#
|
25
|
+
# default - nil
|
26
|
+
attr_accessor :namespace
|
27
|
+
|
28
|
+
# The directory in which to store processed source files.
|
29
|
+
# Defaults to #{src}-processed
|
30
|
+
attr_accessor :processed_src
|
11
31
|
|
12
32
|
def initialize(name=:deploy)
|
13
33
|
@deploy_file = "deploy.zip"
|
14
34
|
@src = 'src'
|
35
|
+
@namespace = nil
|
15
36
|
super
|
37
|
+
@namespace += "__" if @namespace
|
38
|
+
@processed_src ||= "#{src}-processed"
|
16
39
|
end
|
17
40
|
|
18
41
|
def define
|
19
42
|
desc "Deploy to salesforce"
|
20
43
|
task name do
|
44
|
+
process_source
|
45
|
+
make_resources
|
21
46
|
make_zipfile
|
22
47
|
require 'hoopla_salesforce/deployer'
|
23
|
-
HooplaSalesforce::Deployer.new(username, password, token, enterprise_wsdl, metadata_wsdl).deploy(
|
48
|
+
HooplaSalesforce::Deployer.new(username, password, token, enterprise_wsdl, metadata_wsdl).deploy(deploy_file)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def make_resources
|
53
|
+
require 'zip/zip'
|
54
|
+
|
55
|
+
staticresources = "#{processed_src}/staticresources"
|
56
|
+
mkdir staticresources
|
57
|
+
|
58
|
+
Dir["#{processed_src}/resources/*"].each do |f|
|
59
|
+
next unless File.directory?(f)
|
60
|
+
resourcename = File.basename(f) + ".resource"
|
61
|
+
resourcefile = "#{staticresources}/#{resourcename}"
|
62
|
+
Zip::ZipFile.open(resourcefile, Zip::ZipFile::CREATE) do |zip|
|
63
|
+
Dir["#{f}/**/*"].each do |file|
|
64
|
+
zip.add(file.sub("#{f}/", ''), file)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
cp "#{f}.resource-meta.xml", "#{resourcefile}-meta.xml"
|
24
69
|
end
|
25
70
|
end
|
26
71
|
|
27
72
|
def make_zipfile
|
28
73
|
require 'zip/zip'
|
29
|
-
rm_f
|
30
|
-
Zip::ZipFile.open(
|
31
|
-
Dir["#{
|
32
|
-
zip.add(file, file)
|
74
|
+
rm_f deploy_file
|
75
|
+
Zip::ZipFile.open(deploy_file, Zip::ZipFile::CREATE) do |zip|
|
76
|
+
Dir["#{processed_src}/**/*"].each do |file|
|
77
|
+
zip.add(file.sub(/^#{processed_src}/, src), file)
|
33
78
|
end
|
34
79
|
end
|
35
80
|
end
|
81
|
+
|
82
|
+
def process_source
|
83
|
+
rm_rf processed_src
|
84
|
+
cp_r src, processed_src
|
85
|
+
Dir["#{processed_src}/**/*"].each do |f|
|
86
|
+
next if File.directory?(f)
|
87
|
+
system %Q|ruby -i -n -e 'print $_.gsub("__NAMESPACE__", "#{namespace}")' "#{f}"|
|
88
|
+
end
|
89
|
+
|
90
|
+
if namespace
|
91
|
+
clean_namespace = namespace.sub(/__$/, '')
|
92
|
+
system %Q|ruby -i -n -e 'print $_.gsub("#{namespace}", "#{clean_namespace}")' "#{processed_src}/package.xml"|
|
93
|
+
end
|
94
|
+
end
|
36
95
|
end
|
37
96
|
end
|
38
97
|
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
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Trotter Cashion
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-05 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,20 @@ dependencies:
|
|
32
32
|
version: 0.7.6
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rubyzip
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 9
|
45
|
+
- 4
|
46
|
+
version: 0.9.4
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
35
49
|
description: No really, these helpers are awesome
|
36
50
|
email: dev@hoopla.net
|
37
51
|
executables: []
|
@@ -41,13 +55,13 @@ extensions: []
|
|
41
55
|
extra_rdoc_files: []
|
42
56
|
|
43
57
|
files:
|
44
|
-
- lib/hoopla_salesforce.rb
|
45
58
|
- lib/hoopla_salesforce/rake.rb
|
46
|
-
- lib/hoopla_salesforce/
|
59
|
+
- lib/hoopla_salesforce/rake/base_task.rb
|
47
60
|
- lib/hoopla_salesforce/rake/deploy_task.rb
|
48
61
|
- lib/hoopla_salesforce/rake/retrieve_task.rb
|
49
|
-
- lib/hoopla_salesforce/rake/base_task.rb
|
50
62
|
- lib/hoopla_salesforce/version.rb
|
63
|
+
- lib/hoopla_salesforce/deployer.rb
|
64
|
+
- lib/hoopla_salesforce.rb
|
51
65
|
has_rdoc: true
|
52
66
|
homepage: http://hoopla.net
|
53
67
|
licenses: []
|