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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29b08dffcdd6252cc066385e79ad901b2dc9134e
4
- data.tar.gz: 7201e44554b337d6be3a612beb8abae4c4440929
3
+ metadata.gz: b6804c9fe68862c98350f9701974f02cd3590eef
4
+ data.tar.gz: 58a9b0122341b63e0e1ad5367dc968b40d1797e7
5
5
  SHA512:
6
- metadata.gz: 168162550e3b7bddfb816b7b3225ed0a6dc0df679b455735fc48617e660cea3c7892fe6d6e270a220391b39596d9f794a7d45ae8ce8539a770e405f1f6301603
7
- data.tar.gz: 88e3d46d4542a3314601ae6d207edafa25c3648eeab332abe01c00c5be766041f63ccb22920d4479820b9f0b1b39f32f6b0807aa51b133108fb4c9930150f928
6
+ metadata.gz: 9c987be478f97c95416cac231f256b5d20c31ff10547c7a591205146c179ae1778a40dc2a683abbc053b683c3f62190b7624650dec1bdfcf9f96881c4ae93631
7
+ data.tar.gz: 412fac6b70a39ab2af75b019e05f5a30ba65b6204b6b1a5ba881ed3e27a803abbd1e6d359e99377f5d4e0d7cb0452605f04fe5adc22dd8998e22723522d327d1
@@ -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.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install forcer-0.4.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install forcer-0.4.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.4.0 and build and push forcer-0.4.0.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>
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>
@@ -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" />
@@ -2,4 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 2.2.0
4
4
 
5
- script: rspec spec
5
+ script: rspec spec
6
+ addons:
7
+ code_climate:
8
+ repo_token: c259bf9659d42a8b0a3f3ea1e9f16e24d4a8a30c2dff22f3900f9db758775fe0
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
- forcer is a ruby command line application and gem designed to help force.com developers who utilize git and proper development process that includes:
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. Easy integration with CI (i.e. Jenkins)
15
- 3. Commands for specific tasks (i.e. delete components or rename components)
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 forcer simpler than metaforce and let contributors understand code by reading smaller amount
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
- ruby 2.1.2 or later
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 forcer:
52
+ Call help to list all available operations for Forcer:
51
53
 
52
- $: forcer help
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
- $: forcer help deploy
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
- $: cd ~/my_workspace/TestProject/
68
- $: ls
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
- $: forcer deploy
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
- ### Configuration
82
- forcer can store information about deployment organization to avoid typing details for each deployment. Information like username,
83
- password (it is strongly recommended to avoid storing password) can be saved in "configuration.yml" file. And here is a template content:
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
- anything_as_your_org_alias:
98
+ anything_as_your_org_1_alias:
86
99
  host: login.salesforce.com
87
- username: sample_username
100
+ username: sample_username1
88
101
  password:
89
- security_token: sample_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 to put "configuration.yml"?
92
- It should be in the same directory where you call forcer. Then the app can pick it up and login properly.
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
- $: ls
114
+ $(master): ls
95
115
  ./configuration.yml
96
116
  ...
97
117
 
98
- $: forcer deploy ...
118
+ $(master): forcer deploy ...
99
119
 
100
- This allows having separate "configuration.yml" file for each project. If you are calling forcer from git repo directory
101
- with project files, please add "configuration.yml" to gitignore. This should help you avoiding committing sensitive data.
102
- For more information on setup and usage of configuration.yml please visit wiki pages of this project.
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
- forcer is a flexible tool that allows developers:
126
+ Forcer is a flexible tool that allows developers:
106
127
 
107
- - Exclude certain ncomponents (metadata files) and even whole folders from deployment. For example object Idea.object (excluded by default) usually fails deployments.
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 folders from deployment?
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-2.2.0")]/gems/forcer-0.4.1/lib/metadata_services/exclude_components.yml
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. forcer automatically removes all found nodes from document
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
- [your_ruby_version_location (like ".../rvm/gems/ruby-2.2.0")]/gems/forcer-[version]/lib/metadata_services/exclude_xml_nodes.yml
163
- forcer is released with "exclude_xml_nodes.yml". Users (developers) can modify or replace values to exclude xml elements.
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
- Currently forcer does not allow multiple "exclude_components.xml" and "exclude_xml_nodes.xml" files.I understand that
166
- working on multiple projects simultaneously can require you to exclude different files/components for each project.
167
- Support of multiple config files can be added as a new feature per request.
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
- $: forcer deploy --dest dest_alias_in_configuration_yml
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
- $: forcer deploy --dest dest_alias_in_configuration_yml --checkOnly
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
- $: forcer deploy -d dest_alias_in_configuration_yml -c
229
+ $(master): forcer deploy -d dest_alias_in_configuration_yml -c
182
230
 
183
231
 
184
- After forcer successfully starts deploy (or any other available command) the program starts printing status messages in console:
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 we tried to run forcer on ruby version 2.1.5, the app threw exception about missing library "em-http-request". If
197
- you have ruby version 2.1.5 installed and cannot resolve dependencies, I can only suggest to switch to ruby version
198
- to 2.1.2 or 2.2.0 or later.
199
- 2. openssl library version 1.0.2 has problems with ruby 2.2.0 when deploy larger zip-files. In order to fix please follow steps:
200
-
201
- $: brew update
202
- $: brew uninstall openssl
203
- $: brew install openssl
204
- $: rvm get head
205
- $: rvm remove 2.2.0
206
- $: rvm install 2.2.0 --with-openssl-dir=`brew --prefix openssl`
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Forcer
2
- VERSION = "0.4.13"
2
+ VERSION = "0.4.14"
3
3
  end
@@ -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 do not have configuration.yml in current directory, just skip the option."
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
- 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 :sourse."
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.load_config_file(old_options)
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.write
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 later
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 write
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 Exception if @input_dir_name.empty?
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
- if exclude_filename.nil? || exclude_filename.empty? || not(File.exists?(exclude_filename))
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
- if exclude_filename.nil? || exclude_filename.empty? || not(File.exists?(exclude_filename))
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 read salesforce org information from yaml
7
- def self.load_config_file(old_options = {})
8
- p "attempting to load configuration.yml"
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
- config_file_path = File.join(Dir.pwd, "/configuration.yml")
15
- return options unless File.exists?(config_file_path)
16
-
17
- dest = options[:dest]
18
- configuration = YAML.load_file(config_file_path).to_hash
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
- return options if configuration[dest].nil?
24
+ load_login_info(options)
21
25
 
22
- configuration[dest].each do |key, value|
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
- end
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.13
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-03 00:00:00.000000000 Z
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.2.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"'
Binary file