metaforce 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -75,6 +75,11 @@ feature on a new branch, then send me a pull request with a detailed
75
75
  description. Please provide applicable rspec specs.
76
76
 
77
77
  ## Version History
78
+ **0.3.3** (February 9, 2012)
79
+
80
+ * Added a logger for logging requests.
81
+ * Allow api version to be set when calling `Metaforce::Metadata::Client.describe`.
82
+
78
83
  **0.3.2** (February 3, 2012)
79
84
 
80
85
  * Improved documentation.
@@ -83,7 +88,7 @@ description. Please provide applicable rspec specs.
83
88
  **0.3.1** (February 3, 2012)
84
89
 
85
90
  * Dynamically defined helper methods for .list (e.g. `client.list_apex_classes`, `client.list_custom_objects`).
86
- * The `describe` method now caches the results to minimize latency. `describe!`
91
+ * The `Metaforce::Metadata::Client.describe` method now caches the results to minimize latency. `describe!`
87
92
  can be used to force a refresh.
88
93
 
89
94
  **0.3.0.alpha** (January 29, 2012)
@@ -1,4 +1,5 @@
1
1
  require 'metaforce/version'
2
2
  require 'metaforce/config'
3
3
  require 'metaforce/manifest'
4
- require 'metaforce/api'
4
+ require 'metaforce/services'
5
+ require 'metaforce/metadata'
@@ -1,5 +1,7 @@
1
1
  module Metaforce
2
2
  class << self
3
+ attr_writer :log
4
+
3
5
  # Returns the current Configuration
4
6
  #
5
7
  # Metaforce.configuration.username = "username"
@@ -17,6 +19,15 @@ module Metaforce
17
19
  def configure
18
20
  yield configuration
19
21
  end
22
+
23
+ def log?
24
+ @log ||= false
25
+ end
26
+
27
+ def log(message)
28
+ return unless Metaforce.log?
29
+ Metaforce.configuration.logger.send :debug, message
30
+ end
20
31
  end
21
32
 
22
33
  class Configuration
@@ -28,13 +39,19 @@ module Metaforce
28
39
  attr_accessor :password
29
40
  # The security token to use during login.
30
41
  attr_accessor :security_token
31
- # Set this to true if you're authentication with a Sandbox instance.
42
+ # Set this to true if you're authenticating with a Sandbox instance.
32
43
  # Defaults to false.
33
44
  attr_accessor :test
34
45
 
35
46
  def initialize
47
+ Savon.log = false
48
+ HTTPI.log = false
36
49
  @api_version = "23.0"
37
- @test = false
50
+ @test = false
51
+ end
52
+
53
+ def logger
54
+ @logger ||= ::Logger.new STDOUT
38
55
  end
39
56
  end
40
57
  end
@@ -0,0 +1,2 @@
1
+ require 'metaforce/metadata/transaction'
2
+ require 'metaforce/metadata/client'
@@ -81,14 +81,15 @@ module Metaforce
81
81
  # # List the names of all metedata types
82
82
  # client.describe[:metadata_objects].collect { |t| t[:xml_name] }
83
83
  # #=> ["CustomLabels", "StaticResource", "Scontrol", "ApexComponent", ... ]
84
- def describe
85
- @describe ||= describe!
84
+ def describe(version=nil)
85
+ @describe ||= describe!(version)
86
86
  end
87
87
 
88
88
  # See +describe+
89
- def describe!
89
+ def describe!(version=nil)
90
90
  response = @client.request(:describe_metadata) do |soap|
91
91
  soap.header = @header
92
+ soap.body = { :api_version => version } unless version.nil?
92
93
  end
93
94
  @describe = response.body[:describe_metadata_response][:result]
94
95
  end
@@ -105,6 +106,8 @@ module Metaforce
105
106
  request = "check_#{type.to_s}_status" unless type.nil?
106
107
  ids = [ ids ] unless ids.is_a?(Array)
107
108
 
109
+ Metaforce.log("Polling server for status on #{ids.join(', ')}")
110
+
108
111
  response = @client.request(request.to_sym) do |soap|
109
112
  soap.header = @header
110
113
  soap.body = {
@@ -148,6 +151,8 @@ module Metaforce
148
151
  zip_contents = Base64.encode64(dir.read)
149
152
  end
150
153
 
154
+ Metaforce.log('Executing deploy')
155
+
151
156
  response = @client.request(:deploy) do |soap|
152
157
  soap.header = @header
153
158
  soap.body = {
@@ -164,6 +169,8 @@ module Metaforce
164
169
  # for a list of _retrieve_request_ options. Options should be convereted from
165
170
  # camelCase to an :underscored_symbol.
166
171
  def retrieve(retrieve_request={})
172
+ Metaforce.log('Executing retrieve')
173
+
167
174
  response = @client.request(:retrieve) do |soap|
168
175
  soap.header = @header
169
176
  soap.body = {
@@ -9,9 +9,9 @@ module Metaforce
9
9
  # The type of transaction (e.g. _:deploy_, _:retrieve_)
10
10
  attr_reader :type
11
11
 
12
- def initialize(client, id, type)
13
- @id = id
12
+ def initialize(client, id, type=nil)
14
13
  @client = client
14
+ @id = id
15
15
  @type = type
16
16
  end
17
17
 
@@ -40,7 +40,7 @@ module Metaforce
40
40
 
41
41
  # Returns the decoded content of the returned zip file.
42
42
  def zip_file
43
- raise "Request was not a retrieve." if @type != :retrieve
43
+ raise "Request was not a retrieve." unless @type == :retrieve
44
44
  Base64.decode64(@result[:zip_file])
45
45
  end
46
46
 
@@ -0,0 +1 @@
1
+ require 'metaforce/services/client'
@@ -1,3 +1,3 @@
1
1
  module Metaforce
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metaforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-03 00:00:00.000000000 Z
12
+ date: 2012-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &8411610 !ruby/object:Gem::Requirement
16
+ requirement: &2164921800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.5.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8411610
24
+ version_requirements: *2164921800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: savon
27
- requirement: &8409890 !ruby/object:Gem::Requirement
27
+ requirement: &2164921300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.7
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *8409890
35
+ version_requirements: *2164921300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rubyzip
38
- requirement: &8424970 !ruby/object:Gem::Requirement
38
+ requirement: &2164920840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *8424970
46
+ version_requirements: *2164920840
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &8422930 !ruby/object:Gem::Requirement
49
+ requirement: &2164920460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *8422930
57
+ version_requirements: *2164920460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &8422420 !ruby/object:Gem::Requirement
60
+ requirement: &2164920000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *8422420
68
+ version_requirements: *2164920000
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mocha
71
- requirement: &8421570 !ruby/object:Gem::Requirement
71
+ requirement: &2164919580 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *8421570
79
+ version_requirements: *2164919580
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: savon_spec
82
- requirement: &8420670 !ruby/object:Gem::Requirement
82
+ requirement: &2164919080 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 0.1.6
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *8420670
90
+ version_requirements: *2164919080
91
91
  description: A Ruby gem for interacting with the Salesforce Metadata API
92
92
  email:
93
93
  - eric@ejholmes.net
@@ -102,13 +102,14 @@ files:
102
102
  - README.md
103
103
  - Rakefile
104
104
  - lib/metaforce.rb
105
- - lib/metaforce/api.rb
106
- - lib/metaforce/api/metadata.rb
107
- - lib/metaforce/api/services.rb
108
- - lib/metaforce/api/transaction.rb
109
105
  - lib/metaforce/config.rb
110
106
  - lib/metaforce/dsl.rb
111
107
  - lib/metaforce/manifest.rb
108
+ - lib/metaforce/metadata.rb
109
+ - lib/metaforce/metadata/client.rb
110
+ - lib/metaforce/metadata/transaction.rb
111
+ - lib/metaforce/services.rb
112
+ - lib/metaforce/services/client.rb
112
113
  - lib/metaforce/types.rb
113
114
  - lib/metaforce/version.rb
114
115
  - metaforce.gemspec
@@ -128,12 +129,12 @@ files:
128
129
  - spec/fixtures/sample/src/classes/TestClass.cls
129
130
  - spec/fixtures/sample/src/classes/TestClass.cls-meta.xml
130
131
  - spec/fixtures/sample/src/package.xml
131
- - spec/lib/api/metadata_spec.rb
132
- - spec/lib/api/services_spec.rb
133
- - spec/lib/api/transaction_spec.rb
134
132
  - spec/lib/config_spec.rb
135
133
  - spec/lib/dsl_spec.rb
136
134
  - spec/lib/manifest_spec.rb
135
+ - spec/lib/metadata/metadata_spec.rb
136
+ - spec/lib/metadata/transaction_spec.rb
137
+ - spec/lib/services/services_spec.rb
137
138
  - spec/spec_helper.rb
138
139
  - wsdl/23.0/metadata.xml
139
140
  - wsdl/23.0/partner.xml
@@ -177,11 +178,11 @@ test_files:
177
178
  - spec/fixtures/sample/src/classes/TestClass.cls
178
179
  - spec/fixtures/sample/src/classes/TestClass.cls-meta.xml
179
180
  - spec/fixtures/sample/src/package.xml
180
- - spec/lib/api/metadata_spec.rb
181
- - spec/lib/api/services_spec.rb
182
- - spec/lib/api/transaction_spec.rb
183
181
  - spec/lib/config_spec.rb
184
182
  - spec/lib/dsl_spec.rb
185
183
  - spec/lib/manifest_spec.rb
184
+ - spec/lib/metadata/metadata_spec.rb
185
+ - spec/lib/metadata/transaction_spec.rb
186
+ - spec/lib/services/services_spec.rb
186
187
  - spec/spec_helper.rb
187
188
  has_rdoc:
@@ -1,3 +0,0 @@
1
- require 'metaforce/api/services'
2
- require 'metaforce/api/metadata'
3
- require 'metaforce/api/transaction'