rubyfox-sfsobject 0.5.1-java → 0.6.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-env +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +19 -0
- data/Gemfile +4 -0
- data/README.md +105 -0
- data/lib/rubyfox/sfsobject/version.rb +1 -1
- data/lib/rubyfox/sfsobject.rb +2 -2
- data/rubyfox-sfsobject.gemspec +1 -3
- data/test/helper.rb +16 -4
- metadata +24 -81
- data/.rvmrc +0 -1
- data/README.rdoc +0 -82
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 183e560ee74a8286bc61b32f21afdedf8b236eaa
|
4
|
+
data.tar.gz: 4db6eaeff61ac1f9dbfb52263ae68a1460e5c625
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7aa03cc88362516ad3005f4286dcd9e5dbb5013a2db6b619eb6ce06d1f464b166b5d4dccde65fa00ea9fee7ede45dbec1f31d49ad1eb27460292f5b666d4b839
|
7
|
+
data.tar.gz: 94773ba2a2bdc567d4f8e9690ab9312724cb9d2cdbfd98c4c5dbf2e280404b68e43e9ecbf7a498063d85eca7fbf8e6f2a7c28261105f0edbc8b9f7c44312ffbd
|
data/.ruby-env
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
JRUBY_OPTS="--dev --2.0"
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jruby
|
data/.travis.yml
CHANGED
@@ -1,3 +1,22 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
3
|
+
cache: bundler
|
2
4
|
rvm:
|
3
5
|
- jruby-19mode
|
6
|
+
- jruby
|
7
|
+
- jruby-head
|
8
|
+
env:
|
9
|
+
global:
|
10
|
+
- CODECLIMATE_REPO_TOKEN=7800b9ed7143dedbdc5e3c62021efa6944bacce3ea9e001654d7481cdabb8c07
|
11
|
+
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
12
|
+
matrix:
|
13
|
+
fast_finish: true
|
14
|
+
allow_failures:
|
15
|
+
- rvm: jruby-head
|
16
|
+
notifications:
|
17
|
+
webhooks:
|
18
|
+
urls:
|
19
|
+
- https://webhooks.gitter.im/e/bc3a12e425e557a6ca23
|
20
|
+
on_success: change # options: [always|never|change] default: always
|
21
|
+
on_failure: always # options: [always|never|change] default: always
|
22
|
+
on_start: false # default: false
|
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
[github]: https://github.com/neopoly/rubyfox-sfsobject
|
2
|
+
[doc]: http://rubydoc.info/github/neopoly/rubyfox-sfsobject/master/file/README.md
|
3
|
+
[gem]: https://rubygems.org/gems/rubyfox-sfsobject
|
4
|
+
[travis]: https://travis-ci.org/neopoly/rubyfox-sfsobject
|
5
|
+
[codeclimate]: https://codeclimate.com/github/neopoly/rubyfox-sfsobject
|
6
|
+
[inchpages]: https://inch-ci.org/github/neopoly/rubyfox-sfsobject
|
7
|
+
|
8
|
+
# Rubyfox::SFSObject
|
9
|
+
|
10
|
+
[![Travis](https://img.shields.io/travis/neopoly/rubyfox-sfsobject.svg?branch=master)][travis]
|
11
|
+
[![Gem Version](https://img.shields.io/gem/v/rubyfox-sfsobject.svg)][gem]
|
12
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/neopoly/rubyfox-sfsobject.svg)][codeclimate]
|
13
|
+
[![Test Coverage](https://codeclimate.com/github/neopoly/rubyfox-sfsobject/badges/coverage.svg)][codeclimate]
|
14
|
+
[![Inline docs](https://inch-ci.org/github/neopoly/rubyfox-sfsobject.svg?branch=master&style=flat)][inchpages]
|
15
|
+
|
16
|
+
[Gem][gem] |
|
17
|
+
[Source][github] |
|
18
|
+
[Documentation][doc]
|
19
|
+
|
20
|
+
Converts between SmartFox's SFSObjects and Ruby Hashes.
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
Add this line to your application's Gemfile:
|
25
|
+
|
26
|
+
gem 'rubyfox-sfsobject'
|
27
|
+
|
28
|
+
And then execute:
|
29
|
+
|
30
|
+
$ bundle
|
31
|
+
|
32
|
+
Or install it yourself as:
|
33
|
+
|
34
|
+
$ gem install rubyfox-sfsobject
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
### Bulk mode
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require 'rubyfox/sfsobject/bulk'
|
42
|
+
sfs_object = Rubyfox::SFSObject::Bulk.to_sfs({ :hello => "world" })
|
43
|
+
# => SFSObject ready to use in SmartFox
|
44
|
+
hash = Rubyfox::SFSObject::Bulk.to_hash(sfs_object)
|
45
|
+
# => { :hello => "world" }
|
46
|
+
```
|
47
|
+
|
48
|
+
### Schema mode
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'rubyfox/sfsobject/schema'
|
52
|
+
schema = { :hello => String }
|
53
|
+
sfs_object = Rubyfox::SFSObject::Schema.to_sfs(schema, { :hello => "world" })
|
54
|
+
# => SFSObject ready to use in SmartFox
|
55
|
+
hash = Rubyfox::SFSObject::Schema.to_hash(schema, sfs_object)
|
56
|
+
# => { :hello => "world" }
|
57
|
+
```
|
58
|
+
|
59
|
+
### Core extension
|
60
|
+
|
61
|
+
You can extend Hash and SFSObject with method shortcuts:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
require 'rubyfox/sfsobject/core_ext'
|
65
|
+
sfs_object = { :hello => "world" }.to_sfs
|
66
|
+
# => SFSObject
|
67
|
+
sfs_object.to_hash
|
68
|
+
# { :hello => "world" }
|
69
|
+
```
|
70
|
+
|
71
|
+
#### JSON
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
require 'rubyfox/sfsobject/core_ext'
|
75
|
+
json = sfs_object.to_json
|
76
|
+
Rubyfox::SFSObject.from_json(json)
|
77
|
+
```
|
78
|
+
|
79
|
+
#### Hash-like access
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
require 'rubyfox/sfsobject/core_ext'
|
83
|
+
sfs_object = Rubyfox::SFSObject[:meaning_of_life => 42]
|
84
|
+
sfs_object[:meaning_of_life] # => 42
|
85
|
+
sfs_object[:string] = "value"
|
86
|
+
sfs_object[:string] # => "value"
|
87
|
+
```
|
88
|
+
|
89
|
+
## Caveats
|
90
|
+
|
91
|
+
**Note** that all hash keys will be converted to symbols.
|
92
|
+
|
93
|
+
## TODO
|
94
|
+
|
95
|
+
* More docs, please!
|
96
|
+
|
97
|
+
|
98
|
+
## Contributing
|
99
|
+
|
100
|
+
1. Fork it
|
101
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
102
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
103
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
104
|
+
5. Create new Pull Request
|
105
|
+
|
data/lib/rubyfox/sfsobject.rb
CHANGED
@@ -6,10 +6,10 @@ module Rubyfox
|
|
6
6
|
unless $LOAD_PATH.include?(sf_dir)
|
7
7
|
path = Pathname.new(sf_dir).join("*.jar")
|
8
8
|
jars = Dir[path].to_a
|
9
|
-
|
9
|
+
if jars.any?
|
10
10
|
jars.each { |jar| require jar }
|
11
11
|
else
|
12
|
-
raise LoadError, "No jars found in #{path}"
|
12
|
+
raise LoadError, "No jars found in #{path.inspect}"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/rubyfox-sfsobject.gemspec
CHANGED
@@ -20,7 +20,5 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_development_dependency 'rake'
|
22
22
|
gem.add_development_dependency 'rdoc'
|
23
|
-
gem.add_development_dependency 'minitest'
|
24
|
-
gem.add_development_dependency 'testem'
|
25
|
-
gem.add_development_dependency 'simple_assertions'
|
23
|
+
gem.add_development_dependency 'minitest', '~> 5.8.0'
|
26
24
|
end
|
data/test/helper.rb
CHANGED
@@ -1,12 +1,24 @@
|
|
1
|
+
if ENV['CODECLIMATE_REPO_TOKEN']
|
2
|
+
require "codeclimate-test-reporter"
|
3
|
+
CodeClimate::TestReporter.start
|
4
|
+
end
|
5
|
+
|
1
6
|
require 'minitest/autorun'
|
2
|
-
require 'testem'
|
3
|
-
require 'simple_assertions'
|
4
7
|
|
5
8
|
require 'rubyfox/sfsobject'
|
6
9
|
|
7
10
|
ENV['SF_DIR'] ||= File.join(File.dirname(__FILE__), 'vendor', 'smartfox')
|
8
11
|
Rubyfox::SFSObject.boot!(ENV['SF_DIR'] + "/lib")
|
9
12
|
|
10
|
-
class RubyfoxCase <
|
11
|
-
|
13
|
+
class RubyfoxCase < Minitest::Spec
|
14
|
+
class << self
|
15
|
+
alias_method :test, :it
|
16
|
+
alias_method :context, :describe
|
17
|
+
end
|
18
|
+
|
19
|
+
def assert_raises(exception, options={})
|
20
|
+
pattern = options.fetch(:message)
|
21
|
+
error = super(exception) { yield }
|
22
|
+
assert_match pattern, error.message
|
23
|
+
end
|
12
24
|
end
|
metadata
CHANGED
@@ -1,104 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyfox-sfsobject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.0
|
6
5
|
platform: java
|
7
6
|
authors:
|
8
7
|
- Peter Suschlik
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
version_requirements: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- -
|
17
|
+
- - '>='
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
MA==
|
22
|
-
none: false
|
19
|
+
version: '0'
|
23
20
|
requirement: !ruby/object:Gem::Requirement
|
24
21
|
requirements:
|
25
|
-
- -
|
22
|
+
- - '>='
|
26
23
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
MA==
|
29
|
-
none: false
|
24
|
+
version: '0'
|
30
25
|
prerelease: false
|
31
26
|
type: :development
|
32
27
|
- !ruby/object:Gem::Dependency
|
33
28
|
name: rdoc
|
34
29
|
version_requirements: !ruby/object:Gem::Requirement
|
35
30
|
requirements:
|
36
|
-
- -
|
31
|
+
- - '>='
|
37
32
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
39
|
-
MA==
|
40
|
-
none: false
|
33
|
+
version: '0'
|
41
34
|
requirement: !ruby/object:Gem::Requirement
|
42
35
|
requirements:
|
43
|
-
- -
|
36
|
+
- - '>='
|
44
37
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
-
MA==
|
47
|
-
none: false
|
38
|
+
version: '0'
|
48
39
|
prerelease: false
|
49
40
|
type: :development
|
50
41
|
- !ruby/object:Gem::Dependency
|
51
42
|
name: minitest
|
52
43
|
version_requirements: !ruby/object:Gem::Requirement
|
53
44
|
requirements:
|
54
|
-
- -
|
45
|
+
- - ~>
|
55
46
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
57
|
-
MA==
|
58
|
-
none: false
|
47
|
+
version: 5.8.0
|
59
48
|
requirement: !ruby/object:Gem::Requirement
|
60
49
|
requirements:
|
61
|
-
- -
|
50
|
+
- - ~>
|
62
51
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
-
MA==
|
65
|
-
none: false
|
66
|
-
prerelease: false
|
67
|
-
type: :development
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: testem
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ! '>='
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: !binary |-
|
75
|
-
MA==
|
76
|
-
none: false
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ! '>='
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: !binary |-
|
82
|
-
MA==
|
83
|
-
none: false
|
84
|
-
prerelease: false
|
85
|
-
type: :development
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: simple_assertions
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
requirements:
|
90
|
-
- - ! '>='
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: !binary |-
|
93
|
-
MA==
|
94
|
-
none: false
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ! '>='
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: !binary |-
|
100
|
-
MA==
|
101
|
-
none: false
|
52
|
+
version: 5.8.0
|
102
53
|
prerelease: false
|
103
54
|
type: :development
|
104
55
|
description: Map SFSObject into Ruby Hash
|
@@ -109,11 +60,12 @@ extensions: []
|
|
109
60
|
extra_rdoc_files: []
|
110
61
|
files:
|
111
62
|
- .gitignore
|
112
|
-
- .
|
63
|
+
- .ruby-env
|
64
|
+
- .ruby-version
|
113
65
|
- .travis.yml
|
114
66
|
- Gemfile
|
115
67
|
- LICENSE.txt
|
116
|
-
- README.
|
68
|
+
- README.md
|
117
69
|
- Rakefile
|
118
70
|
- lib/rubyfox/sfsobject.rb
|
119
71
|
- lib/rubyfox/sfsobject/accessor.rb
|
@@ -132,35 +84,26 @@ files:
|
|
132
84
|
- test/rubyfox/sfsobject/schema_test.rb
|
133
85
|
homepage: https://github.com/neopoly/rubyfox-sfsobject
|
134
86
|
licenses: []
|
87
|
+
metadata: {}
|
135
88
|
post_install_message:
|
136
89
|
rdoc_options: []
|
137
90
|
require_paths:
|
138
91
|
- lib
|
139
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
93
|
requirements:
|
141
|
-
- -
|
94
|
+
- - '>='
|
142
95
|
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
- 0
|
145
|
-
version: !binary |-
|
146
|
-
MA==
|
147
|
-
hash: 2
|
148
|
-
none: false
|
96
|
+
version: '0'
|
149
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
98
|
requirements:
|
151
|
-
- -
|
99
|
+
- - '>='
|
152
100
|
- !ruby/object:Gem::Version
|
153
|
-
|
154
|
-
- 0
|
155
|
-
version: !binary |-
|
156
|
-
MA==
|
157
|
-
hash: 2
|
158
|
-
none: false
|
101
|
+
version: '0'
|
159
102
|
requirements: []
|
160
103
|
rubyforge_project:
|
161
|
-
rubygems_version: 1.
|
104
|
+
rubygems_version: 2.1.9
|
162
105
|
signing_key:
|
163
|
-
specification_version:
|
106
|
+
specification_version: 4
|
164
107
|
summary: ''
|
165
108
|
test_files:
|
166
109
|
- test/benchmark/perf.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm jruby@rubyfox-sfsobject --create
|
data/README.rdoc
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
= Rubyfox::SFSObject {<img src="https://secure.travis-ci.org/neopoly/rubyfox-sfsobject.png?branch=master" alt="Build Status" />}[https://travis-ci.org/neopoly/rubyfox-sfsobject]
|
2
|
-
|
3
|
-
Converts between SmartFox's SFSObjects and Ruby Hashes.
|
4
|
-
|
5
|
-
Gem[https://rubygems.org/gems/rubyfox-sfsobject] |
|
6
|
-
Source[https://github.com/neopoly/rubyfox-sfsobject] |
|
7
|
-
Documentation[http://rubydoc.info/github/neopoly/rubyfox-sfsobject/master/file/README.rdoc]
|
8
|
-
|
9
|
-
== Installation
|
10
|
-
|
11
|
-
Add this line to your application's Gemfile:
|
12
|
-
|
13
|
-
gem 'rubyfox-sfsobject'
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install rubyfox-sfsobject
|
22
|
-
|
23
|
-
== Usage
|
24
|
-
|
25
|
-
=== Bulk mode
|
26
|
-
|
27
|
-
require 'rubyfox/sfsobject/bulk'
|
28
|
-
sfs_object = Rubyfox::SFSObject::Bulk.to_sfs({ :hello => "world" })
|
29
|
-
# => SFSObject ready to use in SmartFox
|
30
|
-
hash = Rubyfox::SFSObject::Bulk.to_hash(sfs_object)
|
31
|
-
# => { :hello => "world" }
|
32
|
-
|
33
|
-
|
34
|
-
=== Schema mode
|
35
|
-
|
36
|
-
require 'rubyfox/sfsobject/schema'
|
37
|
-
schema = { :hello => String }
|
38
|
-
sfs_object = Rubyfox::SFSObject::Schema.to_sfs(schema, { :hello => "world" })
|
39
|
-
# => SFSObject ready to use in SmartFox
|
40
|
-
hash = Rubyfox::SFSObject::Schema.to_hash(schema, sfs_object)
|
41
|
-
# => { :hello => "world" }
|
42
|
-
|
43
|
-
=== Core extension
|
44
|
-
|
45
|
-
You can extend Hash and SFSObject with method shortcuts:
|
46
|
-
|
47
|
-
require 'rubyfox/sfsobject/core_ext'
|
48
|
-
sfs_object = { :hello => "world" }.to_sfs
|
49
|
-
# => SFSObject
|
50
|
-
sfs_object.to_hash
|
51
|
-
# { :hello => "world" }
|
52
|
-
|
53
|
-
==== JSON
|
54
|
-
|
55
|
-
require 'rubyfox/sfsobject/core_ext'
|
56
|
-
json = sfs_object.to_json
|
57
|
-
Rubyfox::SFSObject.from_json(json)
|
58
|
-
|
59
|
-
==== Hash-like access
|
60
|
-
|
61
|
-
require 'rubyfox/sfsobject/core_ext'
|
62
|
-
sfs_object = Rubyfox::SFSObject[:meaning_of_life => 42]
|
63
|
-
sfs_object[:meaning_of_life] # => 42
|
64
|
-
sfs_object[:string] = "value"
|
65
|
-
sfs_object[:string] # => "value"
|
66
|
-
|
67
|
-
|
68
|
-
== Caveats
|
69
|
-
|
70
|
-
*Note* that all hash keys will be converted to symbols.
|
71
|
-
|
72
|
-
== TODO
|
73
|
-
|
74
|
-
* More docs, please!
|
75
|
-
|
76
|
-
== Contributing
|
77
|
-
|
78
|
-
1. Fork it
|
79
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
80
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
81
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
82
|
-
5. Create new Pull Request
|