active_thrift 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +67 -0
- metadata +132 -0
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# ActiveThrift
|
2
|
+
|
3
|
+
- Thrift ActiveRecord Serialization
|
4
|
+
- Codegen Thrift IDL from ActiveRecord classes.
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
Install the gem:
|
9
|
+
```
|
10
|
+
gem install active_thrift
|
11
|
+
```
|
12
|
+
|
13
|
+
### ActiveRecord::Serializers::Thrift
|
14
|
+
|
15
|
+
```
|
16
|
+
require 'active_record'
|
17
|
+
require 'active_thrift'
|
18
|
+
|
19
|
+
class Customer < ActiveRecord::Base
|
20
|
+
include ActiveModel::Serializers::Thrift
|
21
|
+
|
22
|
+
struct_class = MyThriftModule::CustomerStruct
|
23
|
+
|
24
|
+
...
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
options = {:include => {:order => {:exclude => [:updated_at]}}}
|
29
|
+
struct = Customer.create(:name => 'Bob').to_thrift(options)
|
30
|
+
```
|
31
|
+
|
32
|
+
### IDL Code Generation
|
33
|
+
|
34
|
+
_NOTE: the current version does not work with serialization API, but will be
|
35
|
+
changed to do so. Expect breaking changes._
|
36
|
+
|
37
|
+
Make a rake task (or other script). If you have a single ActiveRecord you can
|
38
|
+
generate thrift IDL:
|
39
|
+
```
|
40
|
+
require 'active_thrift'
|
41
|
+
|
42
|
+
File.open('customer.thrift', 'w') do |f|
|
43
|
+
f.puts ActiveThrift::StructGenerator.structs(Customer)
|
44
|
+
end
|
45
|
+
```
|
46
|
+
If you'd like all associated ActiveRecords, include the `:recurse` option:
|
47
|
+
```
|
48
|
+
require 'active_thrift'
|
49
|
+
|
50
|
+
File.open('customer.thrift', 'w') do |f|
|
51
|
+
f.puts ActiveThrift::StructGenerator.structs(Customer, :recurse => true)
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
If you don't want all associations, you can restrict your ActiveRecord to a
|
56
|
+
specific list:
|
57
|
+
```
|
58
|
+
require 'active_thrift'
|
59
|
+
|
60
|
+
File.open('customer.thrift', 'w') do |f|
|
61
|
+
f.puts ActiveThrift::StructGenerator.structs([Customer, Order])
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
NOTE: self-joins are not supported yet.
|
66
|
+
|
67
|
+
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_thrift
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- chrismo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activerecord
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sqlite3
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: stark
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: ActiveRecord to Thrift tooling
|
95
|
+
email:
|
96
|
+
- chrismo@clabs.org
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- README.md
|
102
|
+
homepage: http://github.com/livingsocial/active_thrift
|
103
|
+
licenses: []
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
hash: 1745257713785642842
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
hash: 1745257713785642842
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.8.23
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: ActiveRecord to Thrift tooling
|
132
|
+
test_files: []
|