thrifty 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/thrifty/manager.rb +8 -0
- data/lib/thrifty/thrift_file.rb +3 -2
- data/lib/thrifty/version.rb +1 -1
- data/test/functional/_lib/thrift/{service.thrift → user_service.thrift} +0 -0
- data/test/functional/_lib/thrift-includes/including.thrift +6 -0
- data/test/functional/thrifty.rb +16 -9
- metadata +8 -6
data/lib/thrifty/manager.rb
CHANGED
data/lib/thrifty/thrift_file.rb
CHANGED
@@ -42,7 +42,7 @@ class Thrifty::ThriftFile
|
|
42
42
|
orig_load_path = $:.dup
|
43
43
|
|
44
44
|
begin
|
45
|
-
$:[0..-1] = [
|
45
|
+
$:[0..-1] = @manager.require_path + [DUMMY_DIRECTORY]
|
46
46
|
log.info('Requiring', file: generated_file, idl: path, build_directory: build_directory)
|
47
47
|
# Global require
|
48
48
|
super(generated_file)
|
@@ -59,7 +59,8 @@ class Thrifty::ThriftFile
|
|
59
59
|
e.message << ' (HINT: this probably means you forgot to precompile your Thrift file, or the relative path has changed between your build and deploy machines)'
|
60
60
|
raise e
|
61
61
|
end
|
62
|
-
|
62
|
+
includes = @manager.include_path.map {|x| ['-I', x]}.flatten
|
63
|
+
Rubysh('thrift', *includes, '--gen', 'rb', '-out', build_directory, path).check_call
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
data/lib/thrifty/version.rb
CHANGED
File without changes
|
data/test/functional/thrifty.rb
CHANGED
@@ -14,8 +14,7 @@ class Thrifty::DynamicTest < Critic::Functional::Test
|
|
14
14
|
it(description) do
|
15
15
|
pid = fork do
|
16
16
|
method.bind(self).call
|
17
|
-
|
18
|
-
exec('true')
|
17
|
+
exit!(true)
|
19
18
|
end
|
20
19
|
_, status = Process.waitpid2(pid)
|
21
20
|
assert_equal(0, status.exitstatus)
|
@@ -24,7 +23,7 @@ class Thrifty::DynamicTest < Critic::Functional::Test
|
|
24
23
|
|
25
24
|
describe 'without a build_root' do
|
26
25
|
it_isolated 'can load the service' do
|
27
|
-
Thrifty.register('_lib/thrift/
|
26
|
+
Thrifty.register('_lib/thrift/user_service.thrift', relative_to: __FILE__)
|
28
27
|
Thrifty.require('user_storage')
|
29
28
|
ThriftyTest::UserStorage
|
30
29
|
end
|
@@ -33,19 +32,27 @@ class Thrifty::DynamicTest < Critic::Functional::Test
|
|
33
32
|
expected_root = File.expand_path('../_lib/thrift/build-thrifty', __FILE__)
|
34
33
|
FileUtils.rm_rf(expected_root)
|
35
34
|
|
36
|
-
Thrifty.register('_lib/thrift/
|
35
|
+
Thrifty.register('_lib/thrift/user_service.thrift', relative_to: __FILE__)
|
37
36
|
Thrifty.require('user_storage')
|
38
37
|
ThriftyTest::UserStorage
|
39
38
|
|
40
39
|
assert(File.exists?(expected_root))
|
41
40
|
end
|
42
41
|
|
42
|
+
it_isolated 'can handle included thrift files' do
|
43
|
+
Thrifty.register('_lib/thrift/user_service.thrift', relative_to: __FILE__)
|
44
|
+
Thrifty.register('_lib/thrift-includes/including.thrift', relative_to: __FILE__)
|
45
|
+
|
46
|
+
Thrifty.require('including_service')
|
47
|
+
IncludeThriftyTest::IncludingService
|
48
|
+
end
|
49
|
+
|
43
50
|
describe 'without relative_to' do
|
44
51
|
it_isolated 'build_root defaults to Dir.tmpdir/thrifty' do
|
45
52
|
expected_root = File.join(Dir.tmpdir, 'build-thrifty')
|
46
53
|
FileUtils.rm_rf(expected_root)
|
47
54
|
|
48
|
-
Thrifty.register(File.expand_path('../_lib/thrift/
|
55
|
+
Thrifty.register(File.expand_path('../_lib/thrift/user_service.thrift', __FILE__))
|
49
56
|
Thrifty.require('user_storage')
|
50
57
|
ThriftyTest::UserStorage
|
51
58
|
|
@@ -81,16 +88,16 @@ class Thrifty::DynamicTest < Critic::Functional::Test
|
|
81
88
|
end
|
82
89
|
|
83
90
|
it_isolated 'sets paths appropriately' do
|
84
|
-
thrift_file = Thrifty.register('_lib/thrift/
|
91
|
+
thrift_file = Thrifty.register('_lib/thrift/user_service.thrift',
|
85
92
|
relative_to: __FILE__,
|
86
93
|
build_root: '_lib/thrift/thrifty')
|
87
|
-
assert_equal(File.expand_path('../_lib/thrift/
|
94
|
+
assert_equal(File.expand_path('../_lib/thrift/user_service.thrift', __FILE__),
|
88
95
|
thrift_file.path)
|
89
96
|
assert_equal(File.expand_path('../_lib/thrift/thrifty', __FILE__), thrift_file.build_root)
|
90
97
|
end
|
91
98
|
|
92
99
|
it_isolated 'can load the service' do
|
93
|
-
Thrifty.register('_lib/thrift/
|
100
|
+
Thrifty.register('_lib/thrift/user_service.thrift',
|
94
101
|
relative_to: __FILE__,
|
95
102
|
build_root: '_lib/thrift/thrifty')
|
96
103
|
Thrifty.require('user_storage')
|
@@ -100,7 +107,7 @@ class Thrifty::DynamicTest < Critic::Functional::Test
|
|
100
107
|
end
|
101
108
|
|
102
109
|
it_isolated 'builds a given thrift file once' do
|
103
|
-
Thrifty.register('_lib/thrift/
|
110
|
+
Thrifty.register('_lib/thrift/user_service.thrift',
|
104
111
|
relative_to: __FILE__,
|
105
112
|
build_root: '_lib/thrift/thrifty')
|
106
113
|
results = Thrifty.compile_all
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thrifty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -178,9 +178,10 @@ files:
|
|
178
178
|
- lib/thrifty/version.rb
|
179
179
|
- test/_lib.rb
|
180
180
|
- test/functional/_lib.rb
|
181
|
+
- test/functional/_lib/thrift-includes/including.thrift
|
181
182
|
- test/functional/_lib/thrift/.gitignore
|
182
183
|
- test/functional/_lib/thrift/collision.thrift
|
183
|
-
- test/functional/_lib/thrift/
|
184
|
+
- test/functional/_lib/thrift/user_service.thrift
|
184
185
|
- test/functional/thrifty.rb
|
185
186
|
- test/integration/_lib.rb
|
186
187
|
- test/meta/_lib.rb
|
@@ -200,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
201
|
version: '0'
|
201
202
|
segments:
|
202
203
|
- 0
|
203
|
-
hash:
|
204
|
+
hash: -2772158143117342826
|
204
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
206
|
none: false
|
206
207
|
requirements:
|
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
210
|
version: '0'
|
210
211
|
segments:
|
211
212
|
- 0
|
212
|
-
hash:
|
213
|
+
hash: -2772158143117342826
|
213
214
|
requirements: []
|
214
215
|
rubyforge_project:
|
215
216
|
rubygems_version: 1.8.23
|
@@ -220,9 +221,10 @@ summary: Begone manual compilation of Thrift definitions! Thrifty makes it easy
|
|
220
221
|
test_files:
|
221
222
|
- test/_lib.rb
|
222
223
|
- test/functional/_lib.rb
|
224
|
+
- test/functional/_lib/thrift-includes/including.thrift
|
223
225
|
- test/functional/_lib/thrift/.gitignore
|
224
226
|
- test/functional/_lib/thrift/collision.thrift
|
225
|
-
- test/functional/_lib/thrift/
|
227
|
+
- test/functional/_lib/thrift/user_service.thrift
|
226
228
|
- test/functional/thrifty.rb
|
227
229
|
- test/integration/_lib.rb
|
228
230
|
- test/meta/_lib.rb
|