peatio-jruby 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.drone.yml +29 -0
  3. data/.gitignore +16 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +148 -0
  6. data/.simplecov +17 -0
  7. data/.tool-versions +1 -0
  8. data/.travis.yml +18 -0
  9. data/Gemfile +8 -0
  10. data/Gemfile.lock +198 -0
  11. data/README.md +47 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/peatio +12 -0
  15. data/bin/setup +8 -0
  16. data/lib/peatio.rb +52 -0
  17. data/lib/peatio/adapter_registry.rb +25 -0
  18. data/lib/peatio/auth/error.rb +18 -0
  19. data/lib/peatio/auth/jwt_authenticator.rb +127 -0
  20. data/lib/peatio/block.rb +29 -0
  21. data/lib/peatio/blockchain/abstract.rb +161 -0
  22. data/lib/peatio/blockchain/error.rb +37 -0
  23. data/lib/peatio/blockchain/registry.rb +16 -0
  24. data/lib/peatio/command/base.rb +11 -0
  25. data/lib/peatio/command/db.rb +20 -0
  26. data/lib/peatio/command/inject.rb +13 -0
  27. data/lib/peatio/command/root.rb +14 -0
  28. data/lib/peatio/command/security.rb +29 -0
  29. data/lib/peatio/command/service.rb +40 -0
  30. data/lib/peatio/error.rb +18 -0
  31. data/lib/peatio/executor.rb +64 -0
  32. data/lib/peatio/injectors/peatio_events.rb +240 -0
  33. data/lib/peatio/logger.rb +39 -0
  34. data/lib/peatio/metrics/server.rb +15 -0
  35. data/lib/peatio/mq/client.rb +51 -0
  36. data/lib/peatio/ranger/connection.rb +117 -0
  37. data/lib/peatio/ranger/events.rb +11 -0
  38. data/lib/peatio/ranger/router.rb +234 -0
  39. data/lib/peatio/ranger/web_socket.rb +68 -0
  40. data/lib/peatio/security/key_generator.rb +26 -0
  41. data/lib/peatio/sql/client.rb +19 -0
  42. data/lib/peatio/sql/schema.rb +72 -0
  43. data/lib/peatio/transaction.rb +122 -0
  44. data/lib/peatio/upstream/base.rb +116 -0
  45. data/lib/peatio/upstream/registry.rb +14 -0
  46. data/lib/peatio/version.rb +3 -0
  47. data/lib/peatio/wallet/abstract.rb +189 -0
  48. data/lib/peatio/wallet/error.rb +37 -0
  49. data/lib/peatio/wallet/registry.rb +16 -0
  50. data/peatio.gemspec +59 -0
  51. metadata +480 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6665f9afd483a4674b3eab911fc82e539faba861519b404b768c337d0beed74c
4
+ data.tar.gz: 291653ca4f4c1ca1b248510b6583647b3e020db8f471746c735cefb5d473ea03
5
+ SHA512:
6
+ metadata.gz: 0d3133d5c6302533a76d2470cc56e1e87073ab7db25b1e1926e2efdb3b8aef60110bb6a7b3904123098fd19d9c152ccbcd836995f98945b6363f6cf21c0d0190
7
+ data.tar.gz: 1f278104f924430765fd7ad9087d5a5ee6b11d02ffeb667102117ba34f51ce722f98284a7a1c31a1bb820ac4e7439aa571b53de7b38a8553955f2c1dedfd8098
@@ -0,0 +1,29 @@
1
+ ---
2
+ kind: pipeline
3
+ name: default
4
+
5
+ steps:
6
+ - name: Run rspec for each library
7
+ image: ruby:2.6
8
+ commands:
9
+ - bundle install
10
+ - bundle exec rspec
11
+
12
+ - name: Release gems
13
+ image: ruby:2.6
14
+ environment:
15
+ GEM_CREDENTIALS:
16
+ from_secret: gem_credentials
17
+ commands:
18
+ - mkdir -p ~/.gem
19
+ - echo $GEM_CREDENTIALS | base64 -d > ~/.gem/credentials
20
+ - chmod 0600 ~/.gem/credentials
21
+ - gem build peatio.gemspec
22
+ - gem push peatio-*.gem
23
+ when:
24
+ branch:
25
+ - master
26
+
27
+ trigger:
28
+ event:
29
+ - push
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /*.gem
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ # Ignore RubyMine files
15
+ .idea
16
+ /secrets
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,148 @@
1
+ # Commonly used screens these days easily fit more than 80 characters.
2
+ Metrics/LineLength:
3
+ Max: 120
4
+
5
+ # Too short methods lead to extraction of single-use methods, which can make
6
+ # the code easier to read (by naming things), but can also clutter the class
7
+ Metrics/MethodLength:
8
+ Max: 20
9
+
10
+ # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
11
+ Metrics/ClassLength:
12
+ Max: 1500
13
+
14
+ # No space makes the method definition shorter and differentiates
15
+ # from a regular assignment.
16
+ Layout/SpaceAroundEqualsInParameterDefault:
17
+ EnforcedStyle: no_space
18
+
19
+ # Single quotes being faster is hardly measurable and only affects parse time.
20
+ # Enforcing double quotes reduces the times where you need to change them
21
+ # when introducing an interpolation. Use single quotes only if their semantics
22
+ # are needed.
23
+ Style/StringLiterals:
24
+ EnforcedStyle: double_quotes
25
+
26
+ # We do not need to support Ruby 1.9, so this is good to use.
27
+ Style/SymbolArray:
28
+ Enabled: true
29
+
30
+ # Most readable form.
31
+ Layout/AlignHash:
32
+ EnforcedHashRocketStyle: table
33
+ EnforcedColonStyle: table
34
+
35
+ # Mixing the styles looks just silly.
36
+ Style/HashSyntax:
37
+ EnforcedStyle: ruby19_no_mixed_keys
38
+
39
+ # has_key? and has_value? are far more readable than key? and value?
40
+ Style/PreferredHashMethods:
41
+ Enabled: false
42
+
43
+ # String#% is by far the least verbose and only object oriented variant.
44
+ Style/FormatString:
45
+ EnforcedStyle: percent
46
+
47
+ Style/CollectionMethods:
48
+ Enabled: true
49
+ PreferredMethods:
50
+ # inject seems more common in the community.
51
+ reduce: "inject"
52
+
53
+
54
+ # Either allow this style or don't. Marking it as safe with parenthesis
55
+ # is silly. Let's try to live without them for now.
56
+ Style/ParenthesesAroundCondition:
57
+ AllowSafeAssignment: false
58
+ Lint/AssignmentInCondition:
59
+ AllowSafeAssignment: false
60
+
61
+ # A specialized exception class will take one or more arguments and construct the message from it.
62
+ # So both variants make sense.
63
+ Style/RaiseArgs:
64
+ Enabled: false
65
+
66
+ # Indenting the chained dots beneath each other is not supported by this cop,
67
+ # see https://github.com/bbatsov/rubocop/issues/1633
68
+ Layout/MultilineOperationIndentation:
69
+ Enabled: false
70
+
71
+ # Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
72
+ # The argument that fail should be used to abort the program is wrong too,
73
+ # there's Kernel#abort for that.
74
+ Style/SignalException:
75
+ EnforcedStyle: only_raise
76
+
77
+ # Suppressing exceptions can be perfectly fine, and be it to avoid to
78
+ # explicitly type nil into the rescue since that's what you want to return,
79
+ # or suppressing LoadError for optional dependencies
80
+ Lint/HandleExceptions:
81
+ Enabled: false
82
+
83
+ Layout/SpaceInsideBlockBraces:
84
+ # The space here provides no real gain in readability while consuming
85
+ # horizontal space that could be used for a better parameter name.
86
+ # Also {| differentiates better from a hash than { | does.
87
+ SpaceBeforeBlockParameters: false
88
+
89
+ # No trailing space differentiates better from the block:
90
+ # foo} means hash, foo } means block.
91
+ Layout/SpaceInsideHashLiteralBraces:
92
+ EnforcedStyle: no_space
93
+
94
+ # { ... } for multi-line blocks is okay, follow Weirichs rule instead:
95
+ # https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
96
+ Style/BlockDelimiters:
97
+ Enabled: false
98
+
99
+ # do / end blocks should be used for side effects,
100
+ # methods that run a block for side effects and have
101
+ # a useful return value are rare, assign the return
102
+ # value to a local variable for those cases.
103
+ Style/MethodCalledOnDoEndBlock:
104
+ Enabled: true
105
+
106
+ # Enforcing the names of variables? To single letter ones? Just no.
107
+ Style/SingleLineBlockParams:
108
+ Enabled: false
109
+
110
+ # Shadowing outer local variables with block parameters is often useful
111
+ # to not reinvent a new name for the same thing, it highlights the relation
112
+ # between the outer variable and the parameter. The cases where it's actually
113
+ # confusing are rare, and usually bad for other reasons already, for example
114
+ # because the method is too long.
115
+ Lint/ShadowingOuterLocalVariable:
116
+ Enabled: false
117
+
118
+ # Check with yard instead.
119
+ Style/Documentation:
120
+ Enabled: false
121
+
122
+ # This is just silly. Calling the argument `other` in all cases makes no sense.
123
+ Naming/BinaryOperatorParameterName:
124
+ Enabled: false
125
+
126
+ # There are valid cases, for example debugging Cucumber steps,
127
+ # also they'll fail CI anyway
128
+ Lint/Debugger:
129
+ Enabled: false
130
+
131
+ # Style preference
132
+ Style/MethodDefParentheses:
133
+ Enabled: false
134
+
135
+ Style/TrailingCommaInArrayLiteral:
136
+ Enabled: false
137
+
138
+ Style/TrailingCommaInHashLiteral:
139
+ Enabled: false
140
+
141
+ Style/ClassAndModuleChildren:
142
+ EnforcedStyle: compact
143
+
144
+ Layout/IndentHeredoc:
145
+ Enabled: false
146
+
147
+ Style/MethodCallWithoutArgsParentheses:
148
+ Enabled: false
@@ -0,0 +1,17 @@
1
+ # -*- ruby -*-
2
+ require 'simplecov-json'
3
+
4
+ SimpleCov.start do
5
+ add_filter '/spec/'
6
+ end
7
+
8
+ SimpleCov.formatters = [
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ SimpleCov::Formatter::JSONFormatter,
11
+ ]
12
+
13
+ # save to CircleCI's artifacts directory if we're on CircleCI
14
+ if ENV['CIRCLE_ARTIFACTS']
15
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
16
+ SimpleCov.coverage_dir(dir)
17
+ end
@@ -0,0 +1 @@
1
+ ruby jruby-9.2.13.0
@@ -0,0 +1,18 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5.1
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 1.17.3
8
+ env:
9
+ - WEBSOCKET_HOST: localhost
10
+ WEBSOCKET_PORT: 8081
11
+ deploy:
12
+ provider: rubygems
13
+ api_key:
14
+ secure: MTlSs+/1/+djQBx9UpZBoPdkLb9j9tx31CxoJ2uw3a429cj9qhJc+qZL9Gbim4kqdDhWAlfIFKDn2aeVPHIcd3VAP3dBUkG2gMxC440gx7rBJXSGpo+zwS9pnsFNQb9RnFZ4OI0dDr0VvYyctZh2h4VVTKhP2m7U59A6yNeNhW8K5HzUZ3+QvykiEQVQUrT29BRpf+9vEISVDPk3o0S0HO+RRvWXOBe5F2M/5hhJUdxUZ2/Pikg3PFJGhS1+g23YhLiEvMN6TiHz/PbUdLN1hnAVgmE86t/DU2lRzhDHNX3CetEhEhtElkTlbpIitmfy8309G0lUMZkN4Z6qKjuYKjuGYXYjXS6nEq6oy5U0HK2Ljo6ka4WZC5u08t5+I12jzCJ5Nq3kdqJkYZwMODgzvcyw4EKNHejyYLGGIbrXgbuYtR6wwvIYz7hz/j/fFxFDawBYC9s92/gvthtHNTzosBi/I07DYYhdF7Rt4TMfdPpasctV8ijTQ+ePH76cNPaDBqupemZUMSJRuuPOXS8SXS1xLDrPviffok/a3zmHDHgYWjqqBzktjCZ5C2PIeVo3o+ClSiWu8tJ3UquqdQ2ug60LK6ttbKxvDk/De3JcV4SEpqJBroSWD84hp0IiyQMEAhl/SxCVLXn9m5xF3evqH168p/Tgr5pklFUDw/tpSh8=
15
+ gem: peatio
16
+ on:
17
+ tags: true
18
+ repo: rubykube/peatio-core
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in peatio.gemspec
8
+ gemspec
@@ -0,0 +1,198 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ peatio-jruby (2.6.2)
5
+ activemodel (> 5.2, <= 6.0.0)
6
+ activerecord-jdbc-adapter
7
+ activerecord-jdbcmysql-adapter
8
+ amqp
9
+ bunny
10
+ clamp
11
+ em-synchrony (~> 1.0)
12
+ em-websocket
13
+ eventmachine
14
+ faraday_middleware (~> 0.13.1)
15
+ faye (~> 1.2)
16
+ jdbc-mysql
17
+ jwt
18
+ prometheus-client
19
+ trinidad
20
+
21
+ GEM
22
+ remote: https://rubygems.org/
23
+ specs:
24
+ activemodel (6.0.0)
25
+ activesupport (= 6.0.0)
26
+ activerecord (6.0.0)
27
+ activemodel (= 6.0.0)
28
+ activesupport (= 6.0.0)
29
+ activerecord-jdbc-adapter (50.0)
30
+ activerecord (>= 2.2)
31
+ activerecord-jdbcmysql-adapter (50.0)
32
+ activerecord-jdbc-adapter (~> 50.0)
33
+ jdbc-mysql (~> 5.1.36)
34
+ activesupport (6.0.0)
35
+ concurrent-ruby (~> 1.0, >= 1.0.2)
36
+ i18n (>= 0.7, < 2)
37
+ minitest (~> 5.1)
38
+ tzinfo (~> 1.1)
39
+ zeitwerk (~> 2.1, >= 2.1.8)
40
+ addressable (2.7.0)
41
+ public_suffix (>= 2.0.2, < 5.0)
42
+ amq-protocol (2.3.1)
43
+ amqp (1.8.0)
44
+ amq-protocol (>= 2.2.0)
45
+ eventmachine
46
+ ast (2.4.0)
47
+ bump (0.9.0)
48
+ bunny (2.15.0)
49
+ amq-protocol (~> 2.3, >= 2.3.1)
50
+ bunny-mock (1.7.0)
51
+ bunny (>= 1.7)
52
+ clamp (1.3.2)
53
+ concurrent-ruby (1.1.6)
54
+ cookiejar (0.3.3)
55
+ diff-lcs (1.3)
56
+ docile (1.3.2)
57
+ em-http-request (1.1.7)
58
+ addressable (>= 2.3.4)
59
+ cookiejar (!= 0.3.1)
60
+ em-socksify (>= 0.3)
61
+ eventmachine (>= 1.0.3)
62
+ http_parser.rb (>= 0.6.0)
63
+ em-socksify (0.3.2)
64
+ eventmachine (>= 1.0.0.beta.4)
65
+ em-spec (0.2.7)
66
+ eventmachine
67
+ em-synchrony (1.0.6)
68
+ eventmachine (>= 1.0.0.beta.1)
69
+ em-websocket (0.5.2)
70
+ eventmachine (>= 0.12.9)
71
+ http_parser.rb (~> 0.6.0)
72
+ em-websocket-client (0.1.2)
73
+ eventmachine
74
+ websocket
75
+ eventmachine (1.2.7)
76
+ eventmachine (1.2.7-java)
77
+ faraday (0.17.3)
78
+ multipart-post (>= 1.2, < 3)
79
+ faraday_middleware (0.13.1)
80
+ faraday (>= 0.7.4, < 1.0)
81
+ faye (1.4.0)
82
+ cookiejar (>= 0.3.0)
83
+ em-http-request (>= 1.1.6)
84
+ eventmachine (>= 0.12.0)
85
+ faye-websocket (>= 0.11.0)
86
+ multi_json (>= 1.0.0)
87
+ rack (>= 1.0.0)
88
+ websocket-driver (>= 0.5.1)
89
+ faye-websocket (0.11.0)
90
+ eventmachine (>= 0.12.0)
91
+ websocket-driver (>= 0.5.1)
92
+ http_parser.rb (0.6.0)
93
+ http_parser.rb (0.6.0-java)
94
+ i18n (1.8.3)
95
+ concurrent-ruby (~> 1.0)
96
+ io-console (0.5.6)
97
+ irb (1.2.4)
98
+ reline (>= 0.0.1)
99
+ jaro_winkler (1.5.4)
100
+ jaro_winkler (1.5.4-java)
101
+ jdbc-mysql (5.1.47)
102
+ jruby-rack (1.1.21)
103
+ json (2.3.0)
104
+ json (2.3.0-java)
105
+ jwt (2.2.2)
106
+ minitest (5.14.1)
107
+ multi_json (1.15.0)
108
+ multipart-post (2.1.1)
109
+ parallel (1.19.1)
110
+ parser (2.7.1.3)
111
+ ast (~> 2.4.0)
112
+ prometheus-client (2.1.0)
113
+ public_suffix (4.0.6)
114
+ rack (2.2.2)
115
+ rainbow (3.0.0)
116
+ rake (13.0.1)
117
+ reline (0.1.4)
118
+ io-console (~> 0.5)
119
+ rexml (3.2.4)
120
+ rspec (3.9.0)
121
+ rspec-core (~> 3.9.0)
122
+ rspec-expectations (~> 3.9.0)
123
+ rspec-mocks (~> 3.9.0)
124
+ rspec-core (3.9.2)
125
+ rspec-support (~> 3.9.3)
126
+ rspec-expectations (3.9.2)
127
+ diff-lcs (>= 1.2.0, < 2.0)
128
+ rspec-support (~> 3.9.0)
129
+ rspec-mocks (3.9.1)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.9.0)
132
+ rspec-support (3.9.3)
133
+ rspec_junit_formatter (0.4.1)
134
+ rspec-core (>= 2, < 4, != 2.12.0)
135
+ rubocop (0.82.0)
136
+ jaro_winkler (~> 1.5.1)
137
+ parallel (~> 1.10)
138
+ parser (>= 2.7.0.1)
139
+ rainbow (>= 2.2.2, < 4.0)
140
+ rexml
141
+ ruby-progressbar (~> 1.7)
142
+ unicode-display_width (>= 1.4.0, < 2.0)
143
+ rubocop-github (0.16.0)
144
+ rubocop (<= 0.82.0)
145
+ rubocop-performance (~> 1.0)
146
+ rubocop-rails (~> 2.0)
147
+ rubocop-performance (1.6.1)
148
+ rubocop (>= 0.71.0)
149
+ rubocop-rails (2.6.0)
150
+ activesupport (>= 4.2.0)
151
+ rack (>= 1.1)
152
+ rubocop (>= 0.82.0)
153
+ ruby-progressbar (1.10.1)
154
+ simplecov (0.18.5)
155
+ docile (~> 1.1)
156
+ simplecov-html (~> 0.11)
157
+ simplecov-html (0.12.2)
158
+ simplecov-json (0.2.1)
159
+ json
160
+ simplecov
161
+ thread_safe (0.3.6)
162
+ thread_safe (0.3.6-java)
163
+ trinidad (1.4.6)
164
+ jruby-rack (~> 1.1.13)
165
+ trinidad_jars (>= 1.3.0, < 1.5.0)
166
+ trinidad_jars (1.4.2)
167
+ tzinfo (1.2.7)
168
+ thread_safe (~> 0.1)
169
+ unicode-display_width (1.7.0)
170
+ websocket (1.2.8)
171
+ websocket-driver (0.7.3)
172
+ websocket-extensions (>= 0.1.0)
173
+ websocket-driver (0.7.3-java)
174
+ websocket-extensions (>= 0.1.0)
175
+ websocket-extensions (0.1.5)
176
+ zeitwerk (2.3.0)
177
+
178
+ PLATFORMS
179
+ java
180
+ ruby
181
+
182
+ DEPENDENCIES
183
+ bump
184
+ bundler
185
+ bunny-mock
186
+ em-spec
187
+ em-websocket-client
188
+ irb
189
+ peatio-jruby!
190
+ rake (~> 13.0)
191
+ rspec (~> 3.0)
192
+ rspec_junit_formatter
193
+ rubocop-github
194
+ simplecov
195
+ simplecov-json
196
+
197
+ BUNDLED WITH
198
+ 1.17.3