the_pb 0.0.1 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a62a56ec70269bcfdbb806a194dd525a5572cb90d0b9af8f819dc894b54ccad
4
- data.tar.gz: e3a5fcac9c8d7188fb7562d3394fe263c819c59b505f498280a757f2b5e18f00
3
+ metadata.gz: ca726029e35c3146001358e2e6e19a3bb19ee008b4a986d78139984b2c430859
4
+ data.tar.gz: e434a895e83547538731ec4ed693d673e23f1aa54c90bf79de76ee212b812246
5
5
  SHA512:
6
- metadata.gz: 97a247a174280ad09214ec4006c697b35dcaeeff053b48113286a5feeacad2c07a0bb71fb6841e01193289c1fface1e33ab91e4cd05bcd7ede9cae6d762348f4
7
- data.tar.gz: 4c3b755836a7d624dfddd6ef25c99d56b8db6b890cde27e5507113e26c5530cbf2280ea4e9feb95135dbe0ff8f438c41d6aeedc9ec29d6f33bb894622f42a186
6
+ metadata.gz: 38fb426655699206ba62977ab44c4e2eed17b72cb9fe921b810125f0ae565a3ff7bd04c3b745b1da9ca0546ce436d10c21bd2f2504da1decd9f6ec8a9a8011c3
7
+ data.tar.gz: 85c421a1ef7c21710cc451503ec53368a3fc3233d665216b895a6d51fa7eefc94a7ad4f1338fcf116a223fbeff7680a6f6a84d0b883a9cc157e334c1d112f456
@@ -0,0 +1,31 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+
9
+ pull_request:
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ name: Ruby ${{ matrix.ruby }}
15
+ strategy:
16
+ matrix:
17
+ ruby:
18
+ - '4.0'
19
+ - '3.4'
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ persist-credentials: false
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
30
+ - name: Run the default task
31
+ run: bundle exec rspec
@@ -0,0 +1,31 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: publish
12
+ permissions:
13
+ id-token: write
14
+ contents: read
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ persist-credentials: false
20
+
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: '4.0'
25
+ bundler-cache: true
26
+
27
+ - name: Build gem
28
+ run: gem build pb.gemspec
29
+
30
+ - name: Publish to RubyGems
31
+ uses: rubygems/release-gem@v1
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in pb.gemspec
4
4
  gemspec
5
+
6
+ gem "bundler", "~> 2.7"
7
+ gem "rake", "~> 13.3"
8
+ gem "rspec", "~> 3.13"
data/Gemfile.lock CHANGED
@@ -1,43 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- the_pb (0.0.1)
5
- google-protobuf (~> 3.0)
4
+ the_pb (0.0.3)
5
+ google-protobuf (>= 3.0, < 5.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- coderay (1.1.2)
11
- diff-lcs (1.3)
12
- google-protobuf (3.11.4)
13
- method_source (0.9.2)
14
- pry (0.12.2)
15
- coderay (~> 1.1.0)
16
- method_source (~> 0.9.0)
17
- rake (10.5.0)
18
- rspec (3.9.0)
19
- rspec-core (~> 3.9.0)
20
- rspec-expectations (~> 3.9.0)
21
- rspec-mocks (~> 3.9.0)
22
- rspec-core (3.9.1)
23
- rspec-support (~> 3.9.1)
24
- rspec-expectations (3.9.0)
10
+ bigdecimal (4.0.1)
11
+ diff-lcs (1.6.2)
12
+ google-protobuf (4.34.0)
13
+ bigdecimal
14
+ rake (~> 13.3)
15
+ google-protobuf (4.34.0-aarch64-linux-gnu)
16
+ bigdecimal
17
+ rake (~> 13.3)
18
+ google-protobuf (4.34.0-arm64-darwin)
19
+ bigdecimal
20
+ rake (~> 13.3)
21
+ google-protobuf (4.34.0-x86_64-darwin)
22
+ bigdecimal
23
+ rake (~> 13.3)
24
+ google-protobuf (4.34.0-x86_64-linux-gnu)
25
+ bigdecimal
26
+ rake (~> 13.3)
27
+ rake (13.3.1)
28
+ rspec (3.13.2)
29
+ rspec-core (~> 3.13.0)
30
+ rspec-expectations (~> 3.13.0)
31
+ rspec-mocks (~> 3.13.0)
32
+ rspec-core (3.13.6)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-expectations (3.13.5)
25
35
  diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.9.0)
27
- rspec-mocks (3.9.1)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-mocks (3.13.7)
28
38
  diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.9.0)
30
- rspec-support (3.9.2)
39
+ rspec-support (~> 3.13.0)
40
+ rspec-support (3.13.7)
31
41
 
32
42
  PLATFORMS
43
+ aarch64-linux
44
+ arm64-darwin
33
45
  ruby
46
+ x86_64-darwin
47
+ x86_64-linux
34
48
 
35
49
  DEPENDENCIES
36
- bundler (~> 2.0)
37
- pry
38
- rake (~> 10.0)
39
- rspec (~> 3.0)
50
+ bundler (~> 2.7)
51
+ rake (~> 13.3)
52
+ rspec (~> 3.13)
40
53
  the_pb!
41
54
 
42
55
  BUNDLED WITH
43
- 2.0.2
56
+ 2.7.2
data/Rakefile CHANGED
@@ -3,4 +3,11 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
+ desc "Compile protobuf files"
7
+ task :protoc do
8
+ sh "protoc --ruby_out=spec/proto -Ispec/proto spec/proto/*.proto"
9
+ end
10
+
11
+ task :spec => :protoc unless ENV["CI"]
12
+
6
13
  task :default => :spec
data/lib/pb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/pb.rb CHANGED
@@ -21,10 +21,11 @@ module Pb
21
21
  ].freeze
22
22
 
23
23
  class << self
24
- # @param [Time, DateTime, Date, String, nil] t
24
+ # @param [Time, DateTime, Date, String, Google::Protobuf::Timestamp, nil] t
25
25
  # @return [Google::Protobuf::Timestamp, nil]
26
26
  def to_timestamp(t)
27
27
  return nil if t.nil?
28
+ return t if t.is_a?(Google::Protobuf::Timestamp)
28
29
  case t
29
30
  when DateTime, Date
30
31
  t = t.to_time
@@ -36,24 +37,27 @@ module Pb
36
37
  Google::Protobuf::Timestamp.new(seconds: t.to_i, nanos: t.nsec)
37
38
  end
38
39
 
39
- # @param [String, nil]
40
+ # @param [String, Google::Protobuf::StringValue, nil]
40
41
  # @return [Google::Protobuf::StringValue, nil]
41
42
  def to_strval(str)
42
43
  return nil if str.nil?
44
+ return str if str.is_a?(Google::Protobuf::StringValue)
43
45
  Google::Protobuf::StringValue.new(value: str)
44
46
  end
45
47
 
46
- # @param [Integer, nil] num
48
+ # @param [Integer, Google::Protobuf::Int32Value, nil] num
47
49
  # @return [Google::Protobuf::Int32Value, nil]
48
50
  def to_int32val(num)
49
51
  return nil if num.nil?
52
+ return num if num.is_a?(Google::Protobuf::Int32Value)
50
53
  Google::Protobuf::Int32Value.new(value: num)
51
54
  end
52
55
 
53
- # @param [String, Integer, nil] num
56
+ # @param [String, Integer, Google::Protobuf::Int64Value, nil] num
54
57
  # @return [Google::Protobuf::Int64Value, nil]
55
58
  def to_int64val(num)
56
59
  return nil if num.nil?
60
+ return num if num.is_a?(Google::Protobuf::Int64Value)
57
61
  case num
58
62
  when String
59
63
  n = num.to_i
@@ -63,17 +67,19 @@ module Pb
63
67
  Google::Protobuf::Int64Value.new(value: n)
64
68
  end
65
69
 
66
- # @param [Integer, nil] num
70
+ # @param [Integer, Google::Protobuf::UInt32Value, nil] num
67
71
  # @return [Google::Protobuf::UInt32Value, nil]
68
72
  def to_uint32val(num)
69
73
  return nil if num.nil?
74
+ return num if num.is_a?(Google::Protobuf::UInt32Value)
70
75
  Google::Protobuf::UInt32Value.new(value: num)
71
76
  end
72
77
 
73
- # @param [String, Integer, nil] num
78
+ # @param [String, Integer, Google::Protobuf::UInt64Value, nil] num
74
79
  # @return [Google::Protobuf::UInt64Value, nil]
75
80
  def to_uint64val(num)
76
81
  return nil if num.nil?
82
+ return num if num.is_a?(Google::Protobuf::UInt64Value)
77
83
  case num
78
84
  when String
79
85
  n = num.to_i
@@ -83,31 +89,35 @@ module Pb
83
89
  Google::Protobuf::UInt64Value.new(value: n)
84
90
  end
85
91
 
86
- # @param [Float, nil] num
92
+ # @param [Float, Google::Protobuf::FloatValue, nil] num
87
93
  # @return [Google::Protobuf::FloatValue, nil]
88
94
  def to_floatval(num)
89
95
  return nil if num.nil?
96
+ return num if num.is_a?(Google::Protobuf::FloatValue)
90
97
  Google::Protobuf::FloatValue.new(value: num)
91
98
  end
92
99
 
93
- # @param [Float, nil] num
100
+ # @param [Float, Google::Protobuf::DoubleValue, nil] num
94
101
  # @return [Google::Protobuf::DoubleValue, nil]
95
102
  def to_doubleval(num)
96
103
  return nil if num.nil?
104
+ return num if num.is_a?(Google::Protobuf::DoubleValue)
97
105
  Google::Protobuf::DoubleValue.new(value: num)
98
106
  end
99
107
 
100
- # @param [bool, nil] b
108
+ # @param [bool, Google::Protobuf::BoolValue, nil] b
101
109
  # @return [Google::Protobuf::BoolValue, nil]
102
110
  def to_boolval(b)
103
111
  return nil if b.nil?
112
+ return b if b.is_a?(Google::Protobuf::BoolValue)
104
113
  Google::Protobuf::BoolValue.new(value: b)
105
114
  end
106
115
 
107
- # @param [String, nil] bytes
116
+ # @param [String, Google::Protobuf::BytesValue, nil] bytes
108
117
  # @return [Google::Protobuf::BytesValue, nil]
109
118
  def to_bytesval(bytes)
110
119
  return nil if bytes.nil?
120
+ return bytes if bytes.is_a?(Google::Protobuf::BytesValue)
111
121
  Google::Protobuf::BytesValue.new(value: bytes)
112
122
  end
113
123
 
data/pb.gemspec CHANGED
@@ -25,9 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rspec", "~> 3.0"
31
- spec.add_development_dependency "pry"
32
- spec.add_runtime_dependency "google-protobuf", "~> 3.0"
28
+ spec.add_runtime_dependency "google-protobuf", ">= 3.0", "< 5.0"
33
29
  end
metadata CHANGED
@@ -1,85 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_pb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nao Minami
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2020-03-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
13
+ name: google-protobuf
43
14
  requirement: !ruby/object:Gem::Requirement
44
15
  requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
16
+ - - ">="
53
17
  - !ruby/object:Gem::Version
54
18
  version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
19
+ - - "<"
60
20
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
21
+ version: '5.0'
22
+ type: :runtime
63
23
  prerelease: false
64
24
  version_requirements: !ruby/object:Gem::Requirement
65
25
  requirements:
66
26
  - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: google-protobuf
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
27
  - !ruby/object:Gem::Version
75
28
  version: '3.0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
29
+ - - "<"
81
30
  - !ruby/object:Gem::Version
82
- version: '3.0'
31
+ version: '5.0'
83
32
  description: Utility for Google Protocol Buffers.
84
33
  email:
85
34
  - south37777@gmail.com
@@ -87,9 +36,10 @@ executables: []
87
36
  extensions: []
88
37
  extra_rdoc_files: []
89
38
  files:
39
+ - ".github/workflows/main.yml"
40
+ - ".github/workflows/publish.yml"
90
41
  - ".gitignore"
91
42
  - ".rspec"
92
- - ".travis.yml"
93
43
  - CODE_OF_CONDUCT.md
94
44
  - Gemfile
95
45
  - Gemfile.lock
@@ -108,7 +58,6 @@ licenses:
108
58
  metadata:
109
59
  homepage_uri: https://github.com/wantedly/the_pb
110
60
  source_code_uri: https://github.com/wantedly/the_pb
111
- post_install_message:
112
61
  rdoc_options: []
113
62
  require_paths:
114
63
  - lib
@@ -123,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
72
  - !ruby/object:Gem::Version
124
73
  version: '0'
125
74
  requirements: []
126
- rubygems_version: 3.0.6
127
- signing_key:
75
+ rubygems_version: 4.0.3
128
76
  specification_version: 4
129
77
  summary: Utility for Google Protocol Buffers.
130
78
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.2