forcer 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/.rakeTasks +1 -1
- data/.idea/forcer.iml +0 -2
- data/.travis.yml +4 -1
- data/README.md +125 -54
- data/forcer.gemspec +1 -0
- data/lib/forcer/version.rb +1 -1
- data/lib/forcer_main.rb +10 -3
- data/lib/metadata_services/metadata_service.rb +3 -2
- data/lib/metadata_services/sfdc_directory_service.rb +19 -9
- data/lib/utilities/action_options_service.rb +60 -14
- metadata +17 -4
- data/forcer-0.4.12.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6804c9fe68862c98350f9701974f02cd3590eef
|
4
|
+
data.tar.gz: 58a9b0122341b63e0e1ad5367dc968b40d1797e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c987be478f97c95416cac231f256b5d20c31ff10547c7a591205146c179ae1778a40dc2a683abbc053b683c3f62190b7624650dec1bdfcf9f96881c4ae93631
|
7
|
+
data.tar.gz: 412fac6b70a39ab2af75b019e05f5a30ba65b6204b6b1a5ba881ed3e27a803abbd1e6d359e99377f5d4e0d7cb0452605f04fe5adc22dd8998e22723522d327d1
|
data/.idea/.rakeTasks
CHANGED
@@ -4,4 +4,4 @@ You are allowed to:
|
|
4
4
|
1. Remove rake task
|
5
5
|
2. Add existing rake tasks
|
6
6
|
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build forcer-0.4.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build forcer-0.4.13.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install forcer-0.4.13.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install forcer-0.4.13.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.4.13 and build and push forcer-0.4.13.gem to Rubygems" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/forcer.iml
CHANGED
@@ -22,8 +22,6 @@
|
|
22
22
|
<orderEntry type="library" scope="PROVIDED" name="macaddr (v1.7.1, RVM: ruby-2.2.0) [gem]" level="application" />
|
23
23
|
<orderEntry type="library" scope="PROVIDED" name="mini_portile (v0.6.2, RVM: ruby-2.2.0) [gem]" level="application" />
|
24
24
|
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.6.2, RVM: ruby-2.2.0) [gem]" level="application" />
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="nori (v2.5.0, RVM: ruby-2.2.0) [gem]" level="application" />
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="rack (v1.6.0, RVM: ruby-2.2.0) [gem]" level="application" />
|
27
25
|
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, RVM: ruby-2.2.0) [gem]" level="application" />
|
28
26
|
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.2.0, RVM: ruby-2.2.0) [gem]" level="application" />
|
29
27
|
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.2.3, RVM: ruby-2.2.0) [gem]" level="application" />
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Forcer
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/forcer.svg)](http://badge.fury.io/rb/forcer)
|
3
3
|
[![Build Status](https://travis-ci.org/gazazello/forcer.svg?branch=master)](https://travis-ci.org/gazazello/forcer)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/gazazello/forcer/badges/gpa.svg)](https://codeclimate.com/github/gazazello/forcer)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/gazazello/forcer/badges/coverage.svg)](https://codeclimate.com/github/gazazello/forcer/coverage)
|
4
6
|
|
5
|
-
|
7
|
+
Forcer is a ruby command line application and gem designed to help force.com developers who utilize git and proper development process that includes:
|
6
8
|
|
7
9
|
1. every developer should have a separate dev_org\dev_sandbox
|
8
10
|
2. code reviews
|
@@ -11,21 +13,21 @@ forcer is a ruby command line application and gem designed to help force.com dev
|
|
11
13
|
advantages over traditional ant scripts:
|
12
14
|
|
13
15
|
1. Configurability
|
14
|
-
2.
|
15
|
-
3.
|
16
|
-
4. Easily add REST Api functionality (i.e. load initial data after new org created)
|
16
|
+
2. Commands for specific tasks (i.e. delete components or rename components)
|
17
|
+
3. Easily add REST Api functionality (i.e. load initial data after new org created)
|
17
18
|
|
18
19
|
|
19
20
|
This project is inspired by metaforce. It turned out to be easier to start my own project after trying to understand how metaforce
|
20
21
|
is written and attempting to contribute into it. So after days of reading metaforces code and trying to understand, how
|
21
22
|
SOAP api calls are done to salesforce and how 'thor' is used to create command line app, I was ready to write my own tool.
|
22
|
-
The idea is to make structure of
|
23
|
+
The idea is to make structure of Forcer simpler than metaforce and let contributors understand code by reading smaller amount
|
23
24
|
of files. I admit that my code is not perfect and far from professional ruby styles, so I will be glad if you help me.
|
24
25
|
But please lets keep this tool simple with only necessary commands and functionality.
|
25
26
|
|
26
27
|
## System Requirements
|
27
|
-
Mac OS or Linux
|
28
|
-
|
28
|
+
OS: Mac OS or Linux
|
29
|
+
|
30
|
+
Ruby version: 2.1.2 or later
|
29
31
|
|
30
32
|
## Installation
|
31
33
|
|
@@ -47,16 +49,16 @@ Or install it yourself as:
|
|
47
49
|
Currently the app is tested and being used only on Mac OS and Linux (I used Ubuntu). I have NOT tested on Windows yet, but
|
48
50
|
if you try and report results on Windows, other developers would be thankful.
|
49
51
|
|
50
|
-
Call help to list all available operations for
|
52
|
+
Call help to list all available operations for Forcer:
|
51
53
|
|
52
|
-
|
54
|
+
$(master): forcer help
|
53
55
|
deploy ...
|
54
56
|
list ...
|
55
57
|
...
|
56
58
|
|
57
59
|
To list options and flags available for each command call help for each operation separately:
|
58
60
|
|
59
|
-
|
61
|
+
$(master): forcer help deploy
|
60
62
|
--dest ...
|
61
63
|
--checkOnly ...
|
62
64
|
...
|
@@ -64,49 +66,68 @@ To list options and flags available for each command call help for each operatio
|
|
64
66
|
To deploy your project (stored in local filesystem) to destination org first from terminal you need to change directory
|
65
67
|
to project folder that somewhere inside contains folder "src" with all metadata to deploy:
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
+
$(master): cd ~/my_workspace/TestProject/
|
70
|
+
$(master): ls
|
69
71
|
src
|
70
72
|
config
|
71
73
|
...
|
72
74
|
|
73
75
|
Here is a very simple deploy command:
|
74
76
|
|
75
|
-
|
77
|
+
$(master): forcer deploy
|
76
78
|
|
77
79
|
This command will start deployment recursively searching for sfdc project source folder "src" and using the first found for deployment.
|
78
80
|
Please note that "src" folder must contain a valid package.xml file that you intend to use for deployment.
|
79
81
|
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
83
|
+
## Configuration
|
84
|
+
|
85
|
+
Users of Forcer gem can configure:
|
86
|
+
|
87
|
+
* Salesforce org authorization details with file "configuration.yml"
|
88
|
+
* Components/files/directories to exclude from deployment "exclude_components.yml"
|
89
|
+
* XML elements and snippets to exclude from deployment "exclude_xml_nodes.yml"
|
90
|
+
|
91
|
+
### Salesforce org authorization details
|
92
|
+
Forcer can store information about deployment organization to avoid typing details for each deployment. Information like username,
|
93
|
+
password (it is strongly recommended to avoid storing password) can be saved in "configuration.yml" file. Best practice
|
94
|
+
is to keep multiple org information in the same "configuration.yml" (assuming all listed orgs belong to the same project).
|
95
|
+
This will allow to deploy project directory to any org (of current project) without reentering information. And here is
|
96
|
+
a template content:
|
84
97
|
|
85
|
-
|
98
|
+
anything_as_your_org_1_alias:
|
86
99
|
host: login.salesforce.com
|
87
|
-
username:
|
100
|
+
username: sample_username1
|
88
101
|
password:
|
89
|
-
security_token:
|
102
|
+
security_token: sample_token1
|
103
|
+
anything_as_your_org_2_alias:
|
104
|
+
host: login.salesforce.com
|
105
|
+
username: sample_username2
|
106
|
+
password:
|
107
|
+
security_token: sample_token2
|
90
108
|
|
91
|
-
#### Where
|
92
|
-
It should be in the same directory where you call
|
109
|
+
#### Where should I place "configuration.yml"?
|
110
|
+
It should be in the same directory where you call Forcer or inside "forcer_config" folder. First "forcer_config" folder
|
111
|
+
is scanned for configuration.yml file, then current directory (if not found in "forcer_config" folder). More about folder
|
112
|
+
"forcer_config" at the end of Configuration section.
|
93
113
|
|
94
|
-
|
114
|
+
$(master): ls
|
95
115
|
./configuration.yml
|
96
116
|
...
|
97
117
|
|
98
|
-
|
118
|
+
$(master): forcer deploy ...
|
99
119
|
|
100
|
-
This allows having separate "configuration.yml" file for each project. If you are calling
|
101
|
-
with project files, please add "configuration.yml" to gitignore. This
|
102
|
-
For more information on setup and usage of configuration.yml please
|
120
|
+
This allows having separate "configuration.yml" file for each project. If you are calling Forcer from git repo directory
|
121
|
+
with project files and keeping the file outside "forcer_config", please add "configuration.yml" to gitignore. This
|
122
|
+
should help you avoiding committing sensitive data. For more information on setup and usage of configuration.yml please
|
123
|
+
visit wiki pages of this project.
|
103
124
|
|
104
125
|
### Excluding certain metadata from deployment
|
105
|
-
|
126
|
+
Forcer is a flexible tool that allows developers:
|
106
127
|
|
107
|
-
- Exclude certain
|
128
|
+
- Exclude certain components (metadata files) and even whole folders from deployment. For example object Idea.object (excluded by default) usually fails deployments.
|
108
129
|
|
109
|
-
#### How to exclude components and
|
130
|
+
#### How to exclude components and and whole directories from deployment?
|
110
131
|
Name of the file is "exclude_components.yml".
|
111
132
|
|
112
133
|
#### "exclude_components.yml" contains:
|
@@ -117,16 +138,20 @@ forcer is a flexible tool that allows developers:
|
|
117
138
|
- profiles # excludes whole profiles directory
|
118
139
|
|
119
140
|
#### Where should I place "exclude_components.yml"?
|
141
|
+
Users should use separate "exclude_components.yml" for each project. So best practice is to keep it in folder
|
142
|
+
"forcer_config". Read more about it at the end of Configuration section.
|
143
|
+
|
144
|
+
Forcer is released with default "exclude_components.yml". If "forcer_config" is not specified, then Forcer will use the
|
145
|
+
default file. Users (developers) can modify or replace values to exclude certain components or folders:
|
120
146
|
|
121
|
-
[your_ruby_version_location (like ".../rvm/gems/ruby-
|
122
|
-
forcer is released with default "exclude_components.yml". Users (developers) can modify or replace values to exclude
|
123
|
-
certain components or folders.
|
147
|
+
[your_ruby_version_location (like ".../rvm/gems/ruby-[version]")]/gems/forcer-[version]/lib/metadata_services/exclude_components.yml
|
124
148
|
|
125
149
|
|
126
150
|
- Exclude certain XML elements from deployment. For example all references to "Social..." layouts (excluded by default) in profiles fail deployments.
|
127
151
|
|
128
152
|
#### How to exclude XML elements (snippets) from deployment?
|
129
|
-
Name of the file is "exclude_xml_nodes.yml".
|
153
|
+
Name of the file is "exclude_xml_nodes.yml". Goal is to deploy the file/component but filter certain known XML elements
|
154
|
+
from teh file.
|
130
155
|
|
131
156
|
#### Sample "exclude_xml_nodes.yml":
|
132
157
|
|
@@ -142,7 +167,7 @@ forcer is a flexible tool that allows developers:
|
|
142
167
|
<layout>Social blah blah blah</layout>
|
143
168
|
</layoutAsignments>
|
144
169
|
|
145
|
-
Then take the first parameter which is nokogiri expression.
|
170
|
+
Then take the first parameter which is nokogiri expression. Forcer automatically removes all found nodes from document
|
146
171
|
|
147
172
|
<layout>Social blah blah blah</layout>
|
148
173
|
|
@@ -158,30 +183,54 @@ forcer is a flexible tool that allows developers:
|
|
158
183
|
- [ "*//tabVisibilities/tab[starts-with('standard-Social')]" , true ]
|
159
184
|
|
160
185
|
#### Where should I place "exclude_xml_nodes.yml"?
|
186
|
+
Users should use separate "exclude_xml_nodes.yml" for each project. So best practice is to keep it in folder
|
187
|
+
"forcer_config". Read more about it at the end of Configuration section.
|
161
188
|
|
162
|
-
|
163
|
-
|
189
|
+
Forcer is released with "exclude_xml_nodes.yml". If "forcer_config" is not specified, then Forcer will use the
|
190
|
+
default file. Users (developers) can modify or replace values to exclude xml elements:
|
191
|
+
|
192
|
+
[your_ruby_version_location (like ".../rvm/gems/ruby-[version]")]/gems/forcer-[version]/lib/metadata_services/exclude_xml_nodes.yml
|
193
|
+
|
164
194
|
|
165
|
-
|
166
|
-
|
167
|
-
|
195
|
+
|
196
|
+
All configuration files (configuration.yml, exclude_components.yml, exclude_xml_nodes.yml) for specific project should be
|
197
|
+
stored in folder "forcer_config" and the folder itself can be specified with command line option "--config":
|
198
|
+
|
199
|
+
$(master): forcer deploy --dest my_org_alias --config path_to_forcer_config_folder
|
200
|
+
|
201
|
+
**Please note the preferred way is to store folder "forcer_config" inside project directory**. In this case it is always
|
202
|
+
apparent what "forcer_config" belongs to what project:
|
203
|
+
|
204
|
+
$(master): ls -R
|
205
|
+
forcer_config
|
206
|
+
forcer_config/configuration.yml
|
207
|
+
forcer_config/exclude_components.yml
|
208
|
+
forcer_config/exclude_xml_nodes.yml
|
209
|
+
project
|
210
|
+
project/src
|
211
|
+
...
|
212
|
+
|
213
|
+
Forcer is designed to be used with git. So considering a project directory is git, folder "forcer_config" should be added
|
214
|
+
to gitignore. Then it can be reused for any branch or salesforce project. The idea is to switch to any branch and be able
|
215
|
+
to deploy it using "forcer_config" in current project git directory.
|
168
216
|
|
169
217
|
### Command line examples
|
170
218
|
If you already filled configuration.yml correctly then deployments are much faster. Here is a sample command to start deployment of a project in current folder:
|
171
219
|
|
172
|
-
|
220
|
+
$(master): forcer deploy --dest dest_alias_in_configuration_yml
|
173
221
|
|
174
222
|
If you want to call validation-only request then, since it is part of "deploy" soap call, you need to just add flag --checkOnly :
|
175
223
|
|
176
|
-
|
224
|
+
$(master): forcer deploy --dest dest_alias_in_configuration_yml --checkOnly
|
177
225
|
|
178
226
|
|
179
227
|
Please note almost all options support short aliases. So the same validation-only command will look like:
|
180
228
|
|
181
|
-
|
229
|
+
$(master): forcer deploy -d dest_alias_in_configuration_yml -c
|
182
230
|
|
183
231
|
|
184
|
-
After
|
232
|
+
After Forcer successfully starts deployment (or any other available command) the program also starts printing status
|
233
|
+
messages in console:
|
185
234
|
|
186
235
|
"initiating DEPLOYMENT"
|
187
236
|
"DEPLOYMENT STARTED. YOU CAN ALSO CHECK DEPLOYMENT STATUS IN SALESFORCE ORG."
|
@@ -193,17 +242,39 @@ Please note that messages and language can and will change because the app devel
|
|
193
242
|
|
194
243
|
## Possible problems
|
195
244
|
|
196
|
-
1. When
|
197
|
-
you have ruby version 2.1.5 installed and cannot resolve dependencies,
|
198
|
-
to 2.1.2 or 2.2.0 or later.
|
199
|
-
2.
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
245
|
+
1. When my friend tried to run Forcer on ruby version 2.1.5 on Ubuntu, the app threw exception about missing library
|
246
|
+
"em-http-request". If you have ruby version 2.1.5 installed and cannot resolve dependencies, probably the simplest
|
247
|
+
solution is switching to ruby version to 2.1.2 or 2.2.0 or later.
|
248
|
+
2. openssl library version 1.0.2 on Mac OS (maybe other platforms too) has problems with ruby 2.2.0 when deploy larger
|
249
|
+
zip-files. In order to fix please follow steps:
|
250
|
+
|
251
|
+
$(master): brew update
|
252
|
+
$(master): brew uninstall openssl
|
253
|
+
$(master): brew install openssl
|
254
|
+
$(master): rvm get head
|
255
|
+
$(master): rvm remove 2.2.0
|
256
|
+
$(master): rvm install 2.2.0 --with-openssl-dir=`brew --prefix openssl`
|
257
|
+
|
258
|
+
3. Most probably users will make multiple attempts before the very first deployment succeeds. The reason is Salesforce has
|
259
|
+
numerous specific features in metadata deployment. And users of Forcer gem will have to:
|
260
|
+
|
261
|
+
* skip/remove certain components from deployment (manually or using exclude_components.xml)
|
262
|
+
* filter out certain XML elements from deployment (manually or using exclude_xml_nodes.xml)
|
263
|
+
* "username not exist" errors. There are various possible solutions including *sed* program. Example for profiles:
|
264
|
+
|
265
|
+
find . -type f -name '*.profile' -exec sed -i '' s/username_org1/username_org2/ {} +
|
266
|
+
|
267
|
+
* API version differences between orgs can create issues
|
268
|
+
* Salesforce updates can make your current project folder undeployable sometimes
|
269
|
+
* other problems requiring modification of XML files
|
270
|
+
|
271
|
+
4. Contributors may encounter problems with bundler and code-climate if run rspec. The easiest solution is to comment out
|
272
|
+
these lines in file spec_helper.rb :
|
273
|
+
|
274
|
+
if Gem.available?("codeclimate-test-reporter")
|
275
|
+
require "codeclimate-test-reporter"
|
276
|
+
CodeClimate::TestReporter.start
|
277
|
+
end
|
207
278
|
|
208
279
|
|
209
280
|
## Contributing
|
data/forcer.gemspec
CHANGED
@@ -35,5 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
36
36
|
spec.add_development_dependency "rspec", "~>3.2"
|
37
37
|
spec.add_development_dependency "bundler", "~> 1.7"
|
38
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4.7"
|
38
39
|
spec.required_ruby_version = ">2.0.0"
|
39
40
|
end
|
data/lib/forcer/version.rb
CHANGED
data/lib/forcer_main.rb
CHANGED
@@ -5,9 +5,16 @@ require_relative "./metadata_services/metadata_service"
|
|
5
5
|
|
6
6
|
module Forcer
|
7
7
|
class ForcerMain < Thor
|
8
|
-
class_option :dest, :aliases => :d, :desc => "Alias of destination sfdc org in your configuration.yml file. If you
|
8
|
+
class_option :dest, :aliases => :d, :desc => "Alias of destination sfdc org in your configuration.yml file. If you "\
|
9
|
+
"do not have configuration.yml in current directory, just skip the option."
|
9
10
|
|
10
|
-
|
11
|
+
class_option :configs, :desc => "Path to configuration directory named 'forcer_config'. Directory must contain "\
|
12
|
+
"files 'exclude_components.yml' and 'exclude_xml_nodes.yml'. Optional file is 'configuration.yml' which, if missing "\
|
13
|
+
"in 'forcer_config', will be loaded from current directory. By default (or if not found in specified location) "\
|
14
|
+
"folder 'forcer_config' is assumed to be in the current directory. And it is best practice to keep the folder in "\
|
15
|
+
"current project directory. Please read project documentation on github for more information."
|
16
|
+
|
17
|
+
option :source, :aliases => :s, :desc => "Path to folder that contains 'src' directory somewhere. No restriction on exact 'src' location, except it should be somewhere in :source."
|
11
18
|
option :checkOnly, :type => :boolean, :aliases => :c, :desc => "Only validates without actual deployment. Default is FALSE."
|
12
19
|
option :rollbackOnError, :type => :boolean, :aliases => :b, :desc => "Rolls back whole deployment if error occurs. Default is TRUE."
|
13
20
|
option :runAllTests, :type => :boolean, :aliases => :t, :desc => "Make all unit tests run. Default if FALSE. For production deployment it is always true."
|
@@ -25,7 +32,7 @@ module Forcer
|
|
25
32
|
no_commands do
|
26
33
|
def verify_options(old_options = {})
|
27
34
|
p "verifying deployment information"
|
28
|
-
new_options = ActionOptionsService.
|
35
|
+
new_options = ActionOptionsService.load_config(old_options)
|
29
36
|
new_options[:host] ||= "https://" + ask("Enter org url (test.salesforce.org or login.salesforce.org): ")
|
30
37
|
new_options[:username] ||= ask("Enter username: ")
|
31
38
|
new_options[:password] ||= ask("Enter password: ", :echo => false)
|
@@ -59,7 +59,7 @@ module Metadata
|
|
59
59
|
def deploy
|
60
60
|
begin
|
61
61
|
dir_zip_service = SfdcDirectoryService.new(@args)
|
62
|
-
@zip_name = dir_zip_service.
|
62
|
+
@zip_name = dir_zip_service.make_project_zip
|
63
63
|
blob_zip = Base64.encode64(File.open(@zip_name, "rb").read)
|
64
64
|
|
65
65
|
# todo read options from console arguments
|
@@ -110,7 +110,7 @@ module Metadata
|
|
110
110
|
private
|
111
111
|
# login to salesforce and obtain session information
|
112
112
|
def login
|
113
|
-
"login request to #{@args[:host]}"
|
113
|
+
p "login request to #{@args[:host]}"
|
114
114
|
endpoint_url = @args[:host]
|
115
115
|
options = {
|
116
116
|
endpoint: "#{endpoint_url}/services/Soap/c/#{API_VERSION}",
|
@@ -128,6 +128,7 @@ module Metadata
|
|
128
128
|
|
129
129
|
# === login
|
130
130
|
response = enterprise_client.call(:login, message: message)
|
131
|
+
p "LOGIN SUCCESSFUL" unless response.body[:login_response][:result][:session_id].nil?
|
131
132
|
# todo catch exceptions
|
132
133
|
@current_session_id = response.body[:login_response][:result][:session_id]
|
133
134
|
@metadata_server_url = response.body[:login_response][:result][:metadata_server_url]
|
@@ -20,10 +20,10 @@ module Metadata
|
|
20
20
|
prepare_xml_nodes_to_exclude
|
21
21
|
end
|
22
22
|
|
23
|
-
# copy files from original directory to be xml_filtered
|
23
|
+
# copy files from original directory to be xml_filtered when creating zip
|
24
24
|
# Create zip file with contents of force.com project
|
25
25
|
# Return absolute path to the file
|
26
|
-
def
|
26
|
+
def make_project_zip
|
27
27
|
begin
|
28
28
|
@zip_io = Zip::File.open(@output_file_name, Zip::File::CREATE)
|
29
29
|
raise "package.xml NOT FOUND" unless verify_package_xml
|
@@ -39,8 +39,8 @@ module Metadata
|
|
39
39
|
write_entries(entries, "")
|
40
40
|
ensure
|
41
41
|
@zip_io.close # close before deleting tmpdir, or NOT_FOUND exception
|
42
|
-
p "deleting temporary copy of project folder"
|
43
42
|
FileUtils.remove_entry(tmpdir)
|
43
|
+
p "deleted temporary copy of project folder"
|
44
44
|
end
|
45
45
|
|
46
46
|
return @output_file_name
|
@@ -58,25 +58,35 @@ module Metadata
|
|
58
58
|
break
|
59
59
|
end
|
60
60
|
end
|
61
|
-
raise
|
61
|
+
raise "'src' directory NOT FOUND" if @input_dir_name.empty?
|
62
62
|
end
|
63
63
|
|
64
|
-
def prepare_files_to_exclude
|
64
|
+
def prepare_files_to_exclude
|
65
65
|
exclude_filename = @args[:exclude_components]
|
66
|
-
|
66
|
+
|
67
|
+
# if not specified, load default exclude_components.yml
|
68
|
+
if exclude_filename.nil? || !(File.exists?(exclude_filename))
|
69
|
+
p "using default exclude_components.yml"
|
67
70
|
exclude_filename = File.expand_path("../exclude_components.yml", __FILE__)
|
71
|
+
else
|
72
|
+
p "using exclude_components.yml from forcer_config"
|
68
73
|
end
|
69
74
|
|
70
|
-
@files_to_exclude = Set.new
|
75
|
+
@files_to_exclude = Set.new
|
71
76
|
YAML.load_file(exclude_filename).each do |name|
|
72
77
|
@files_to_exclude.add(name.to_s.downcase)
|
73
78
|
end
|
74
79
|
end
|
75
80
|
|
76
|
-
def prepare_xml_nodes_to_exclude
|
81
|
+
def prepare_xml_nodes_to_exclude
|
77
82
|
exclude_filename = @args[:exclude_xml]
|
78
|
-
|
83
|
+
|
84
|
+
# if not specified, load default exclude_xml_nodes.yml
|
85
|
+
if exclude_filename.nil? || !(File.exists?(exclude_filename))
|
86
|
+
p "using default exclude_xml_nodes.yml"
|
79
87
|
exclude_filename = File.expand_path("../exclude_xml_nodes.yml", __FILE__)
|
88
|
+
else
|
89
|
+
p "using exclude_xml_nodes.yml from forcer_config"
|
80
90
|
end
|
81
91
|
|
82
92
|
@snippets_to_exclude = YAML.load_file(exclude_filename)
|
@@ -3,29 +3,75 @@ require "yaml"
|
|
3
3
|
module Forcer
|
4
4
|
class ActionOptionsService
|
5
5
|
|
6
|
-
# attempts to
|
7
|
-
|
8
|
-
|
6
|
+
# attempts to load configuration files from directory 'forcer_config'
|
7
|
+
# directory can include 'configuration.yml', 'exclude_components.yml', 'exclude_xml_nodes.yml'
|
8
|
+
# if directory not found tries to load only configuration.yml from local directory
|
9
|
+
def self.load_config(old_options = {})
|
9
10
|
options = {}
|
10
11
|
old_options.each do |k, v|
|
11
12
|
options.store(k.to_sym, v)
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
if options[:configs].nil? || !(Dir.exists?(File.expand_path(options[:configs], __FILE__)))
|
16
|
+
p "config folder not specified or not found"
|
17
|
+
options[:configs] = Dir.pwd + "/forcer_config"
|
18
|
+
p "config folder in CURRENT DIRECTORY ? => #{Dir.exists?(options[:configs])}"
|
19
|
+
else
|
20
|
+
p "specified config folder FOUND"
|
21
|
+
options[:configs] = File.expand_path(options[:configs], __FILE__)
|
22
|
+
end
|
19
23
|
|
20
|
-
|
24
|
+
load_login_info(options)
|
21
25
|
|
22
|
-
|
23
|
-
options.store(key.to_sym, value.to_s) unless value.to_s.empty?
|
24
|
-
end
|
25
|
-
options[:host] = "https://#{options[:host]}" unless options[:host].include?("http")
|
26
|
+
add_exclude_paths(options)
|
26
27
|
|
27
28
|
return options
|
28
29
|
end
|
29
30
|
|
30
|
-
|
31
|
+
private
|
32
|
+
|
33
|
+
class << self
|
34
|
+
|
35
|
+
# attempts to read salesforce org information from forcer_config/configuration.yml
|
36
|
+
# if forcer_config/configuration.yml not found, then try configuration.yml in current directory
|
37
|
+
def load_login_info(options = {})
|
38
|
+
|
39
|
+
if !(options[:configs].nil?) && File.exists?(File.join(options[:configs], "/configuration.yml"))
|
40
|
+
p "CONFIGURATION.YML with org details FOUND in CONFIG FOLDER"
|
41
|
+
config_file_path = File.join(options[:configs], "/configuration.yml")
|
42
|
+
options[:login_info_path] = config_file_path
|
43
|
+
else
|
44
|
+
p "loading CONFIGURATION.YML from CURRENT DIRECTORY"
|
45
|
+
config_file_path = File.join(Dir.pwd, "/configuration.yml")
|
46
|
+
end
|
47
|
+
|
48
|
+
return options unless File.exists?(config_file_path)
|
49
|
+
|
50
|
+
dest = options[:dest]
|
51
|
+
configuration = YAML.load_file(config_file_path).to_hash
|
52
|
+
|
53
|
+
return options if configuration[dest].nil?
|
54
|
+
|
55
|
+
configuration[dest].each do |key, value|
|
56
|
+
options.store(key.to_sym, value.to_s) unless value.to_s.empty?
|
57
|
+
end
|
58
|
+
options[:host] = "https://#{options[:host]}" unless options[:host].include?("http")
|
59
|
+
end # load_login_info
|
60
|
+
|
61
|
+
|
62
|
+
# add absolute paths to exclude_... files from focer_config directory
|
63
|
+
def add_exclude_paths(options = {})
|
64
|
+
|
65
|
+
if !(options[:configs].nil?) && File.exists?(File.join(options[:configs], "/exclude_components.yml"))
|
66
|
+
options[:exclude_components] = File.join(options[:configs], "/exclude_components.yml")
|
67
|
+
end
|
68
|
+
|
69
|
+
if !(options[:configs].nil?) && File.exists?(File.join(options[:configs], "/exclude_xml_nodes.yml"))
|
70
|
+
options[:exclude_xml] = File.join(options[:configs], "/exclude_xml_nodes.yml")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end # class << self
|
75
|
+
|
76
|
+
end # class ActionOptionsService
|
31
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forcer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gaziz tazhenov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codeclimate-test-reporter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.4.7
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.4.7
|
111
125
|
description: '"command line tool written in ruby that performs metadata deployment,
|
112
126
|
list of components in salesforce org"'
|
113
127
|
email:
|
@@ -133,7 +147,6 @@ files:
|
|
133
147
|
- README.md
|
134
148
|
- Rakefile
|
135
149
|
- bin/forcer
|
136
|
-
- forcer-0.4.12.gem
|
137
150
|
- forcer.gemspec
|
138
151
|
- lib/forcer/version.rb
|
139
152
|
- lib/forcer_main.rb
|
@@ -168,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
181
|
version: '0'
|
169
182
|
requirements: []
|
170
183
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.4.5
|
172
185
|
signing_key:
|
173
186
|
specification_version: 4
|
174
187
|
summary: '"facilitates change management for dev teams who use force.com and git"'
|
data/forcer-0.4.12.gem
DELETED
Binary file
|