sauce_whisk 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +6 -14
  2. data/.ruby-version +1 -1
  3. data/Gemfile +1 -4
  4. data/README.md +23 -8
  5. data/lib/sauce_whisk/tunnels.rb +0 -1
  6. data/lib/sauce_whisk/version.rb +1 -1
  7. data/lib/sauce_whisk.rb +7 -0
  8. metadata +19 -65
  9. data/vendor/psych/lib/psych/class_loader.rb +0 -101
  10. data/vendor/psych/lib/psych/coder.rb +0 -94
  11. data/vendor/psych/lib/psych/core_ext.rb +0 -35
  12. data/vendor/psych/lib/psych/deprecated.rb +0 -85
  13. data/vendor/psych/lib/psych/exception.rb +0 -13
  14. data/vendor/psych/lib/psych/handler.rb +0 -249
  15. data/vendor/psych/lib/psych/handlers/document_stream.rb +0 -22
  16. data/vendor/psych/lib/psych/handlers/recorder.rb +0 -39
  17. data/vendor/psych/lib/psych/json/ruby_events.rb +0 -19
  18. data/vendor/psych/lib/psych/json/stream.rb +0 -16
  19. data/vendor/psych/lib/psych/json/tree_builder.rb +0 -12
  20. data/vendor/psych/lib/psych/json/yaml_events.rb +0 -29
  21. data/vendor/psych/lib/psych/nodes/alias.rb +0 -18
  22. data/vendor/psych/lib/psych/nodes/document.rb +0 -60
  23. data/vendor/psych/lib/psych/nodes/mapping.rb +0 -56
  24. data/vendor/psych/lib/psych/nodes/node.rb +0 -55
  25. data/vendor/psych/lib/psych/nodes/scalar.rb +0 -67
  26. data/vendor/psych/lib/psych/nodes/sequence.rb +0 -81
  27. data/vendor/psych/lib/psych/nodes/stream.rb +0 -37
  28. data/vendor/psych/lib/psych/nodes.rb +0 -77
  29. data/vendor/psych/lib/psych/omap.rb +0 -4
  30. data/vendor/psych/lib/psych/parser.rb +0 -51
  31. data/vendor/psych/lib/psych/scalar_scanner.rb +0 -149
  32. data/vendor/psych/lib/psych/set.rb +0 -4
  33. data/vendor/psych/lib/psych/stream.rb +0 -37
  34. data/vendor/psych/lib/psych/streaming.rb +0 -27
  35. data/vendor/psych/lib/psych/syntax_error.rb +0 -21
  36. data/vendor/psych/lib/psych/tree_builder.rb +0 -96
  37. data/vendor/psych/lib/psych/visitors/depth_first.rb +0 -26
  38. data/vendor/psych/lib/psych/visitors/emitter.rb +0 -51
  39. data/vendor/psych/lib/psych/visitors/json_tree.rb +0 -24
  40. data/vendor/psych/lib/psych/visitors/to_ruby.rb +0 -372
  41. data/vendor/psych/lib/psych/visitors/visitor.rb +0 -19
  42. data/vendor/psych/lib/psych/visitors/yaml_tree.rb +0 -496
  43. data/vendor/psych/lib/psych/visitors.rb +0 -6
  44. data/vendor/psych/lib/psych/y.rb +0 -9
  45. data/vendor/psych/lib/psych.bundle +0 -0
  46. data/vendor/psych/lib/psych.rb +0 -497
  47. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/Makefile +0 -221
  48. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/mkmf.log +0 -50
  49. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych.bundle +0 -0
  50. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych.o +0 -0
  51. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_emitter.o +0 -0
  52. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_parser.o +0 -0
  53. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_to_ruby.o +0 -0
  54. data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_yaml_tree.o +0 -0
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MmJlNDVjYjkzMTZmMDQ4OGQ0MzhhMGZkOTM1M2ZiYzBlMjIzZGY4Yg==
5
- data.tar.gz: !binary |-
6
- OWUyY2Y2NGQyMmZjZTllOGM0MTI2ZDdjOGIxZjBlMjFlMTczZGNiMg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MThlODBkNGFmMDZiNzM2NmRiYmFhMzAxMTE2NGFlMjZjNWRmYzc0MzMyOWQ3
10
- NmRiZjcwZTI5YTVmMjQwYmE5MmZjMDE5NTkwZGIyZTk0NzIyMmY4ZDYzMmIy
11
- MzI4MDFiNmNkOGEzMGUzZmI1ZGI3MDU1OTBhMmZkZjg4YjExOWQ=
12
- data.tar.gz: !binary |-
13
- ODEyMTE1YjFjZWRhOGM2MzI2ODdmZTYyMDgzZTViYjEwODI1NDJiZWEwMzBj
14
- MmEyYWQ4NTRmYmVkNWQxYjIwYjkyOGQ4NTRlNWIzN2FkNzgzZTRlZjI5ODUw
15
- ZDFmYTY3YTcxZGMwZmU4Y2RlM2RmOTVjMjVlZDMwMWM0NzVkYmY=
2
+ SHA1:
3
+ metadata.gz: a94838b837a0a8cb2510d7fede5b9ab5ab672288
4
+ data.tar.gz: 75dce28e208ab9183c650bc802bc1d119d992c9b
5
+ SHA512:
6
+ metadata.gz: 0b823b0481e5c94b8a4e53b41cc951b66a04937c5bc2359620f42be3ddb4719f2755e3a06cf36d1dbde9e3c01224206f8f97659dde0730244af2c1b02d664275
7
+ data.tar.gz: 9a6e397a7db4debec02dac76ec3ec806699241cb74ea0b355d5bc6ffeb61294525d6f0f7d86e632d51e02295f6430335bb7d670b89363bd3e5d08db07055f679
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-1.9.3-p362
1
+ ruby-1.9.3-p484
data/Gemfile CHANGED
@@ -1,9 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "pry"
4
-
5
- group :test do
6
- gem 'psych', "2.0.0", :path => "./vendor/psych"
7
- end
4
+ gem 'psych', '~> 2.0.0'
8
5
 
9
6
  gemspec
data/README.md CHANGED
@@ -30,17 +30,17 @@ SAUCE_ACCESS_KEY=Your Access Key, found on the lower left of your Account page
30
30
  ```
31
31
 
32
32
  ## Usage
33
-
33
+
34
34
  ### Marking jobs passed or failed
35
35
  ```ruby
36
36
  SauceWhisk::Jobs.pass_job job_id
37
37
  SauceWhisk::Jobs.fail_job job_id
38
38
  SauceWhisk::Jobs.change_status job_id, true_for_passed_false_for_failed
39
- ```
40
-
39
+ ```
40
+
41
41
  ### Creating Job Objects
42
42
 
43
- There are two ways to create a Job object.
43
+ There are two ways to create a Job object.
44
44
 
45
45
  ```ruby
46
46
  # Create an 'empty' job (i.e. don't retrieve job details from the API)
@@ -90,7 +90,7 @@ There are three types of asset for Sauce Labs jobs: screenshots, video and logs.
90
90
 
91
91
  ### Accounts
92
92
 
93
- At the moment, it is only possible to query existing accounts using the API gem.
93
+ At the moment, it is only possible to query existing accounts, and create subaccounts.
94
94
 
95
95
  #### Retrieving a specific account
96
96
  ```ruby
@@ -98,7 +98,7 @@ my_account = SauceWhisk::Accounts.fetch "account_name" # Returns a SauceWhisk::A
98
98
  my_account = SauceWhisk::Accounts.fetch("account_name", false) # Returns a SauceWhisk::Account object, does not fetch its concurrency limit
99
99
  ```
100
100
 
101
- `SauceWhisk::Account` objects don't do anything other then store data about the relevant account:
101
+ `SauceWhisk::Account` objects store data about the relevant account:
102
102
 
103
103
  ```ruby
104
104
  my_account.username # Sauce Labs Username
@@ -117,6 +117,19 @@ mac_concurrency = SauceWhisk::Accounts.concurrency_for "account_name", :mac #
117
117
  total_concurrency = SauceWhisk::Accounts.concurrency_for "account_name", :total # Fixnum of the upper concurrency limit
118
118
  ```
119
119
 
120
+ #### Creating subaccounts
121
+
122
+ ```ruby
123
+ parent = SauceWhisk::Accounts.fetch "account_name"
124
+
125
+ subaccount = parent.add_subaccount("User", "Username", "User@email.com", "Password") # New SauceWhisk::SubAccount
126
+ ```
127
+
128
+ SubAccounts are a subclass of Account, with an accessor for their parent object.
129
+ ```ruby
130
+ subaccount.parent == parent #=>true
131
+ ```
132
+
120
133
  ### Tunnels
121
134
 
122
135
  Tunnels give information about currently running [Sauce Connect](https://saucelabs.com/docs/connect) tunnels for a given user.
@@ -162,14 +175,14 @@ platforms = SauceWhisk::Sauce.platforms # Fetch all platforms or return c
162
175
  platforms = SauceWhisk::Sauce.platforms(true) # Force a fetch of all platforms
163
176
 
164
177
  platforms.first # => A Hash of platform details:
165
-
178
+
166
179
  {
167
180
  "long_name"=>"Firefox", # Full name of the platform's browser
168
181
  "api_name"=>"firefox", # desired_capabilities name of the platform
169
182
  "long_version"=>"20.0.1.", # Full version number for the platform's browser
170
183
  "preferred_version"=>"", # Preferred version of the platform's browser (If none is requested)
171
184
  "automation_backend"=>"webdriver", # Whether this is a Webdriver or Selenium-rc driven platform
172
- "os"=>"Linux", # desired_capabilities name of the Platform's Operating System
185
+ "os"=>"Linux", # desired_capabilities name of the Platform's Operating System
173
186
  "short_version"=>"20" # desired_capabilities name of the Platform's Browsers's version
174
187
  }
175
188
  ```
@@ -215,3 +228,5 @@ SauceWhisk.logger defaults to STDOUT.
215
228
  3. Commit your changes (`git commit -am 'Add some feature'`)
216
229
  4. Push to the branch (`git push origin my-new-feature`)
217
230
  5. Create new Pull Request
231
+
232
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/saucelabs/sauce_whisk/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
@@ -25,7 +25,6 @@ module SauceWhisk
25
25
 
26
26
  def self.open(opts, wait_until_ready = true)
27
27
  new_tunnel_parameters = JSON.parse((post :payload => opts), :symbolize_names => true)
28
- STDERR.puts "PERMS #{new_tunnel_parameters}"
29
28
  new_tunnel = fetch new_tunnel_parameters[:id]
30
29
 
31
30
  while(["starting", "booting"].include? new_tunnel.status)
@@ -1,3 +1,3 @@
1
1
  module SauceWhisk
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/sauce_whisk.rb CHANGED
@@ -41,4 +41,11 @@ module SauceWhisk
41
41
  def self.logger
42
42
  @logger||= STDOUT
43
43
  end
44
+
45
+ def self.public_link(job_id)
46
+ key = "#{self.username}:#{self.password}"
47
+ auth_token = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('md5'), key, job_id)
48
+
49
+ "https://saucelabs.com/jobs/#{job_id}?auth=#{auth_token}"
50
+ end
44
51
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce_whisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Lacey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-30 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: vcr
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: webmock
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: A Wrapper for the Sauce Labs REST API.
@@ -87,10 +87,10 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
92
- - .ruby-gemset
93
- - .ruby-version
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".ruby-gemset"
93
+ - ".ruby-version"
94
94
  - Gemfile
95
95
  - LICENSE.txt
96
96
  - README.md
@@ -127,52 +127,6 @@ files:
127
127
  - spec/lib/sauce_whisk/tunnel_spec.rb
128
128
  - spec/lib/sauce_whisk/tunnels_spec.rb
129
129
  - spec/spec_helper.rb
130
- - vendor/psych/lib/psych.bundle
131
- - vendor/psych/lib/psych.rb
132
- - vendor/psych/lib/psych/class_loader.rb
133
- - vendor/psych/lib/psych/coder.rb
134
- - vendor/psych/lib/psych/core_ext.rb
135
- - vendor/psych/lib/psych/deprecated.rb
136
- - vendor/psych/lib/psych/exception.rb
137
- - vendor/psych/lib/psych/handler.rb
138
- - vendor/psych/lib/psych/handlers/document_stream.rb
139
- - vendor/psych/lib/psych/handlers/recorder.rb
140
- - vendor/psych/lib/psych/json/ruby_events.rb
141
- - vendor/psych/lib/psych/json/stream.rb
142
- - vendor/psych/lib/psych/json/tree_builder.rb
143
- - vendor/psych/lib/psych/json/yaml_events.rb
144
- - vendor/psych/lib/psych/nodes.rb
145
- - vendor/psych/lib/psych/nodes/alias.rb
146
- - vendor/psych/lib/psych/nodes/document.rb
147
- - vendor/psych/lib/psych/nodes/mapping.rb
148
- - vendor/psych/lib/psych/nodes/node.rb
149
- - vendor/psych/lib/psych/nodes/scalar.rb
150
- - vendor/psych/lib/psych/nodes/sequence.rb
151
- - vendor/psych/lib/psych/nodes/stream.rb
152
- - vendor/psych/lib/psych/omap.rb
153
- - vendor/psych/lib/psych/parser.rb
154
- - vendor/psych/lib/psych/scalar_scanner.rb
155
- - vendor/psych/lib/psych/set.rb
156
- - vendor/psych/lib/psych/stream.rb
157
- - vendor/psych/lib/psych/streaming.rb
158
- - vendor/psych/lib/psych/syntax_error.rb
159
- - vendor/psych/lib/psych/tree_builder.rb
160
- - vendor/psych/lib/psych/visitors.rb
161
- - vendor/psych/lib/psych/visitors/depth_first.rb
162
- - vendor/psych/lib/psych/visitors/emitter.rb
163
- - vendor/psych/lib/psych/visitors/json_tree.rb
164
- - vendor/psych/lib/psych/visitors/to_ruby.rb
165
- - vendor/psych/lib/psych/visitors/visitor.rb
166
- - vendor/psych/lib/psych/visitors/yaml_tree.rb
167
- - vendor/psych/lib/psych/y.rb
168
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/Makefile
169
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/mkmf.log
170
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych.bundle
171
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych.o
172
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_emitter.o
173
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_parser.o
174
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_to_ruby.o
175
- - vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_yaml_tree.o
176
130
  homepage: http://www.github.com/dylanlacey/sauce_whisk
177
131
  licenses:
178
132
  - MIT
@@ -183,17 +137,17 @@ require_paths:
183
137
  - lib
184
138
  required_ruby_version: !ruby/object:Gem::Requirement
185
139
  requirements:
186
- - - ! '>='
140
+ - - ">="
187
141
  - !ruby/object:Gem::Version
188
142
  version: '0'
189
143
  required_rubygems_version: !ruby/object:Gem::Requirement
190
144
  requirements:
191
- - - ! '>='
145
+ - - ">="
192
146
  - !ruby/object:Gem::Version
193
147
  version: '0'
194
148
  requirements: []
195
149
  rubyforge_project:
196
- rubygems_version: 2.0.3
150
+ rubygems_version: 2.2.1
197
151
  signing_key:
198
152
  specification_version: 4
199
153
  summary: Sauce_Whisk lets you mix extra data into your Sauce test results! Fetch and
@@ -1,101 +0,0 @@
1
- require 'psych/omap'
2
- require 'psych/set'
3
-
4
- module Psych
5
- class ClassLoader # :nodoc:
6
- BIG_DECIMAL = 'BigDecimal'
7
- COMPLEX = 'Complex'
8
- DATE = 'Date'
9
- DATE_TIME = 'DateTime'
10
- EXCEPTION = 'Exception'
11
- OBJECT = 'Object'
12
- PSYCH_OMAP = 'Psych::Omap'
13
- PSYCH_SET = 'Psych::Set'
14
- RANGE = 'Range'
15
- RATIONAL = 'Rational'
16
- REGEXP = 'Regexp'
17
- STRUCT = 'Struct'
18
- SYMBOL = 'Symbol'
19
-
20
- def initialize
21
- @cache = CACHE.dup
22
- end
23
-
24
- def load klassname
25
- return nil if !klassname || klassname.empty?
26
-
27
- find klassname
28
- end
29
-
30
- def symbolize sym
31
- symbol
32
- sym.to_sym
33
- end
34
-
35
- constants.each do |const|
36
- konst = const_get const
37
- define_method(const.to_s.downcase) do
38
- load konst
39
- end
40
- end
41
-
42
- private
43
-
44
- def find klassname
45
- @cache[klassname] ||= resolve(klassname)
46
- end
47
-
48
- def resolve klassname
49
- name = klassname
50
- retried = false
51
-
52
- begin
53
- path2class(name)
54
- rescue ArgumentError, NameError => ex
55
- unless retried
56
- name = "Struct::#{name}"
57
- retried = ex
58
- retry
59
- end
60
- raise retried
61
- end
62
- end
63
-
64
- CACHE = Hash[constants.map { |const|
65
- val = const_get const
66
- begin
67
- [val, ::Object.const_get(val)]
68
- rescue
69
- nil
70
- end
71
- }.compact]
72
-
73
- class Restricted < ClassLoader
74
- def initialize classes, symbols
75
- @classes = classes
76
- @symbols = symbols
77
- super()
78
- end
79
-
80
- def symbolize sym
81
- return super if @symbols.empty?
82
-
83
- if @symbols.include? sym
84
- super
85
- else
86
- raise DisallowedClass, 'Symbol'
87
- end
88
- end
89
-
90
- private
91
-
92
- def find klassname
93
- if @classes.include? klassname
94
- super
95
- else
96
- raise DisallowedClass, klassname
97
- end
98
- end
99
- end
100
- end
101
- end
@@ -1,94 +0,0 @@
1
- module Psych
2
- ###
3
- # If an object defines +encode_with+, then an instance of Psych::Coder will
4
- # be passed to the method when the object is being serialized. The Coder
5
- # automatically assumes a Psych::Nodes::Mapping is being emitted. Other
6
- # objects like Sequence and Scalar may be emitted if +seq=+ or +scalar=+ are
7
- # called, respectively.
8
- class Coder
9
- attr_accessor :tag, :style, :implicit, :object
10
- attr_reader :type, :seq
11
-
12
- def initialize tag
13
- @map = {}
14
- @seq = []
15
- @implicit = false
16
- @type = :map
17
- @tag = tag
18
- @style = Psych::Nodes::Mapping::BLOCK
19
- @scalar = nil
20
- @object = nil
21
- end
22
-
23
- def scalar *args
24
- if args.length > 0
25
- warn "#{caller[0]}: Coder#scalar(a,b,c) is deprecated" if $VERBOSE
26
- @tag, @scalar, _ = args
27
- @type = :scalar
28
- end
29
- @scalar
30
- end
31
-
32
- # Emit a map. The coder will be yielded to the block.
33
- def map tag = @tag, style = @style
34
- @tag = tag
35
- @style = style
36
- yield self if block_given?
37
- @map
38
- end
39
-
40
- # Emit a scalar with +value+ and +tag+
41
- def represent_scalar tag, value
42
- self.tag = tag
43
- self.scalar = value
44
- end
45
-
46
- # Emit a sequence with +list+ and +tag+
47
- def represent_seq tag, list
48
- @tag = tag
49
- self.seq = list
50
- end
51
-
52
- # Emit a sequence with +map+ and +tag+
53
- def represent_map tag, map
54
- @tag = tag
55
- self.map = map
56
- end
57
-
58
- # Emit an arbitrary object +obj+ and +tag+
59
- def represent_object tag, obj
60
- @tag = tag
61
- @type = :object
62
- @object = obj
63
- end
64
-
65
- # Emit a scalar with +value+
66
- def scalar= value
67
- @type = :scalar
68
- @scalar = value
69
- end
70
-
71
- # Emit a map with +value+
72
- def map= map
73
- @type = :map
74
- @map = map
75
- end
76
-
77
- def []= k, v
78
- @type = :map
79
- @map[k] = v
80
- end
81
- alias :add :[]=
82
-
83
- def [] k
84
- @type = :map
85
- @map[k]
86
- end
87
-
88
- # Emit a sequence of +list+
89
- def seq= list
90
- @type = :seq
91
- @seq = list
92
- end
93
- end
94
- end
@@ -1,35 +0,0 @@
1
- class Object
2
- def self.yaml_tag url
3
- Psych.add_tag(url, self)
4
- end
5
-
6
- # FIXME: rename this to "to_yaml" when syck is removed
7
-
8
- ###
9
- # call-seq: to_yaml(options = {})
10
- #
11
- # Convert an object to YAML. See Psych.dump for more information on the
12
- # available +options+.
13
- def psych_to_yaml options = {}
14
- Psych.dump self, options
15
- end
16
- remove_method :to_yaml rescue nil
17
- alias :to_yaml :psych_to_yaml
18
- end
19
-
20
- class Module
21
- def psych_yaml_as url
22
- return if caller[0].end_with?('rubytypes.rb')
23
- if $VERBOSE
24
- warn "#{caller[0]}: yaml_as is deprecated, please use yaml_tag"
25
- end
26
- Psych.add_tag(url, self)
27
- end
28
-
29
- remove_method :yaml_as rescue nil
30
- alias :yaml_as :psych_yaml_as
31
- end
32
-
33
- if defined?(::IRB)
34
- require 'psych/y'
35
- end
@@ -1,85 +0,0 @@
1
- require 'date'
2
-
3
- module Psych
4
- DEPRECATED = __FILE__ # :nodoc:
5
-
6
- module DeprecatedMethods # :nodoc:
7
- attr_accessor :taguri
8
- attr_accessor :to_yaml_style
9
- end
10
-
11
- def self.quick_emit thing, opts = {}, &block # :nodoc:
12
- warn "#{caller[0]}: YAML.quick_emit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
13
- target = eval 'self', block.binding
14
- target.extend DeprecatedMethods
15
- metaclass = class << target; self; end
16
- metaclass.send(:define_method, :encode_with) do |coder|
17
- target.taguri = coder.tag
18
- target.to_yaml_style = coder.style
19
- block.call coder
20
- end
21
- target.psych_to_yaml unless opts[:nodump]
22
- end
23
-
24
- # This method is deprecated, use Psych.load_stream instead.
25
- def self.load_documents yaml, &block
26
- if $VERBOSE
27
- warn "#{caller[0]}: load_documents is deprecated, use load_stream"
28
- end
29
- list = load_stream yaml
30
- return list unless block_given?
31
- list.each(&block)
32
- end
33
-
34
- def self.detect_implicit thing
35
- warn "#{caller[0]}: detect_implicit is deprecated" if $VERBOSE
36
- return '' unless String === thing
37
- return 'null' if '' == thing
38
- ss = ScalarScanner.new(ClassLoader.new)
39
- ss.tokenize(thing).class.name.downcase
40
- end
41
-
42
- def self.add_ruby_type type_tag, &block
43
- warn "#{caller[0]}: add_ruby_type is deprecated, use add_domain_type" if $VERBOSE
44
- domain = 'ruby.yaml.org,2002'
45
- key = ['tag', domain, type_tag].join ':'
46
- @domain_types[key] = [key, block]
47
- end
48
-
49
- def self.add_private_type type_tag, &block
50
- warn "#{caller[0]}: add_private_type is deprecated, use add_domain_type" if $VERBOSE
51
- domain = 'x-private'
52
- key = [domain, type_tag].join ':'
53
- @domain_types[key] = [key, block]
54
- end
55
-
56
- def self.tagurize thing
57
- warn "#{caller[0]}: add_private_type is deprecated, use add_domain_type" if $VERBOSE
58
- return thing unless String === thing
59
- "tag:yaml.org,2002:#{thing}"
60
- end
61
-
62
- def self.read_type_class type, reference
63
- warn "#{caller[0]}: read_type_class is deprecated" if $VERBOSE
64
- _, _, type, name = type.split ':', 4
65
-
66
- reference = name.split('::').inject(reference) do |k,n|
67
- k.const_get(n.to_sym)
68
- end if name
69
- [type, reference]
70
- end
71
-
72
- def self.object_maker klass, hash
73
- warn "#{caller[0]}: object_maker is deprecated" if $VERBOSE
74
- klass.allocate.tap do |obj|
75
- hash.each { |k,v| obj.instance_variable_set(:"@#{k}", v) }
76
- end
77
- end
78
- end
79
-
80
- class Object
81
- undef :to_yaml_properties rescue nil
82
- def to_yaml_properties # :nodoc:
83
- instance_variables
84
- end
85
- end
@@ -1,13 +0,0 @@
1
- module Psych
2
- class Exception < RuntimeError
3
- end
4
-
5
- class BadAlias < Exception
6
- end
7
-
8
- class DisallowedClass < Exception
9
- def initialize klass_name
10
- super "Tried to load unspecified class: #{klass_name}"
11
- end
12
- end
13
- end