Skip to content

Commit e82a32f

Browse files
lib/rb: Namespace properly the std libs
1 parent 12d46f3 commit e82a32f

19 files changed

+40
-26
lines changed

lib/rb/Makefile.am

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ TYPE_FILES = ../../types/*.thrift ../../types/*/*.thrift
4242

4343
$(TYPE_FILES):
4444
mkdir -p lib/thrift/$(patsubst ../../%,%,$(dir $@))
45-
$(THRIFT) -gen rb:namespace_wrapper=thrift \
46-
--out lib/thrift/$(patsubst ../../%,%,$(dir $@)) $@
45+
$(THRIFT) -gen rb:namespaced,namespace_wrapper=thrift \
46+
--out lib/ $@
4747

4848
generate-types: $(TYPE_FILES)
4949

lib/rb/lib/thrift.rb

+5
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@
6868
require 'thrift/server/thread_pool_server'
6969

7070
require 'thrift/thrift_native'
71+
72+
require 'thrift/types/known/any/any'
73+
require 'thrift/types/known/timestamp/timestamp'
74+
require 'thrift/types/known/duration/duration'
75+
require 'thrift/types/annotation/naming/naming'

lib/rb/lib/thrift/types/annotation/deprecation_constants.rb lib/rb/lib/thrift/types/annotation/deprecation/deprecation_constants.rb

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'thrift/types/annotation/naming/naming_types'
2+
3+
module Thrift
4+
module Types
5+
module Annotation
6+
module Naming
7+
class CanonicalNameExtractor
8+
class << self
9+
def extract(definition)
10+
definition.structured_annotations.select do |sa|
11+
sa.is_a? PreviouslyKnownAs
12+
end.map do |pka|
13+
"#{pka.namespace_ || definition.namespace}.#{pka.name || definition.name}"
14+
end
15+
end
16+
end
17+
18+
::Thrift.register_canonical_name_extractor self
19+
end
20+
end
21+
end
22+
end
23+
end

lib/rb/lib/thrift/types/annotation/naming_constants.rb lib/rb/lib/thrift/types/annotation/naming/naming_constants.rb

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rb/lib/thrift/types/annotation/naming_types.rb lib/rb/lib/thrift/types/annotation/naming/naming_types.rb

-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rb/lib/thrift/types/known/any.rb lib/rb/lib/thrift/types/known/any/any.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'thrift/types/known/any_types'
1+
require 'thrift/types/known/any/any_types'
22
require 'json'
33
require 'yaml'
44

lib/rb/lib/thrift/types/known/any_constants.rb lib/rb/lib/thrift/types/known/any/any_constants.rb

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rb/lib/thrift/types/known/duration.rb lib/rb/lib/thrift/types/known/duration/duration.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'thrift/types/known/duration_types'
1+
require 'thrift/types/known/duration/duration_types'
22

33
module Thrift
44
module Types

lib/rb/lib/thrift/types/known/duration_constants.rb lib/rb/lib/thrift/types/known/duration/duration_constants.rb

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rb/lib/thrift/types/known/timestamp.rb lib/rb/lib/thrift/types/known/timestamp/timestamp.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'thrift/types/known/timestamp_types'
1+
require 'thrift/types/known/timestamp/timestamp_types'
22

33
module Thrift
44
module Types

lib/rb/lib/thrift/types/known/timestamp_constants.rb lib/rb/lib/thrift/types/known/timestamp/timestamp_constants.rb

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rb/lib/thrift/types/value.rb lib/rb/lib/thrift/types/value/value.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'thrift/types/value_types'
1+
require 'thrift/types/value/value_types'
22

33
module Thrift
44
module Types

lib/rb/lib/thrift/types/value_constants.rb lib/rb/lib/thrift/types/value/value_constants.rb

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)