active_ksql 0.1.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +180 -0
- data/.ruby_version +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +64 -0
- data/LICENSE.txt +21 -0
- data/README.md +106 -0
- data/Rakefile +12 -0
- data/bin/console +22 -0
- data/bin/setup +8 -0
- data/lib/active_ksql/api.rb +64 -0
- data/lib/active_ksql/configuration.rb +10 -0
- data/lib/active_ksql/version.rb +5 -0
- data/lib/active_ksql.rb +21 -0
- data/lib/generators/active_ksql.rb +19 -0
- data/lib/generators/templates/initializer.rb +7 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b20299186218124c1dfb90e4d9c24182757d6c8586b98eeff4dedb7c9f7ef199
|
4
|
+
data.tar.gz: a6b43eead19a6b9a15ad45251a96091728858bf6449b07d886404180ac3ef2bd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28462710785bb2a04a5607281bdf59c32b015f29dd9b21c39f02732f8cb7a336b32879303adf355d7f998bc54aff5eb7f229906e7c90923b4850723dee61ca65
|
7
|
+
data.tar.gz: '09e88ca0f9db991606ab76dea2dd2cfbe535e12e01676535d2703431a0090e4daba2ad015b702781d09c35c30518cf65171a8bdb6e23970e3553255d421d9e3c'
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
# Allow longer lines and methods
|
2
|
+
Layout/LineLength:
|
3
|
+
Max: 240
|
4
|
+
|
5
|
+
Metrics/MethodLength:
|
6
|
+
Max: 30
|
7
|
+
|
8
|
+
# Tests are declarative, no block length test
|
9
|
+
Metrics/BlockLength:
|
10
|
+
IgnoredMethods: ['describe', 'context', 'namespace']
|
11
|
+
|
12
|
+
AllCops:
|
13
|
+
TargetRubyVersion: 2.5
|
14
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
15
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
16
|
+
DisabledByDefault: true
|
17
|
+
Exclude:
|
18
|
+
- '**/templates/**/*'
|
19
|
+
- '**/vendor/**/*'
|
20
|
+
- '**/vendor/**/.*'
|
21
|
+
- '**/node_modules/**/*'
|
22
|
+
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
23
|
+
|
24
|
+
# Prefer &&/|| over and/or.
|
25
|
+
Style/AndOr:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# Align `when` with `case`.
|
29
|
+
Layout/CaseIndentation:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Align comments with method definitions.
|
33
|
+
Layout/CommentIndentation:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Layout/ElseAlignment:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# Align `end` with the matching keyword or starting expression except for
|
40
|
+
# assignments, where it should be aligned with the LHS.
|
41
|
+
Layout/EndAlignment:
|
42
|
+
Enabled: true
|
43
|
+
EnforcedStyleAlignWith: variable
|
44
|
+
AutoCorrect: true
|
45
|
+
|
46
|
+
Layout/EmptyLineAfterMagicComment:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
# In a regular class definition, no empty lines around the body.
|
50
|
+
Layout/EmptyLinesAroundClassBody:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
# In a regular method definition, no empty lines around the body.
|
54
|
+
Layout/EmptyLinesAroundMethodBody:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# In a regular module definition, no empty lines around the body.
|
58
|
+
Layout/EmptyLinesAroundModuleBody:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Layout/FirstArgumentIndentation:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
65
|
+
Style/HashSyntax:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
69
|
+
# extra level of indentation.
|
70
|
+
Layout/IndentationConsistency:
|
71
|
+
Enabled: true
|
72
|
+
EnforcedStyle: indented_internal_methods
|
73
|
+
|
74
|
+
# Two spaces, no tabs (for indentation).
|
75
|
+
Layout/IndentationWidth:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Layout/LeadingCommentSpace:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Layout/SpaceAfterColon:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Layout/SpaceAfterComma:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Layout/SpaceAroundKeyword:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Layout/SpaceAroundOperators:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Layout/SpaceBeforeComma:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Layout/SpaceBeforeFirstArg:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Style/DefWithParentheses:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
# Defining a method with parameters needs parentheses.
|
106
|
+
Style/MethodDefParentheses:
|
107
|
+
Enabled: true
|
108
|
+
|
109
|
+
# Style/FrozenStringLiteralComment:
|
110
|
+
# Enabled: true
|
111
|
+
# EnforcedStyle: always
|
112
|
+
# Exclude:
|
113
|
+
# - 'actionview/test/**/*.builder'
|
114
|
+
# - 'actionview/test/**/*.ruby'
|
115
|
+
# - 'actionpack/test/**/*.builder'
|
116
|
+
# - 'actionpack/test/**/*.ruby'
|
117
|
+
# - 'activestorage/db/migrate/**/*.rb'
|
118
|
+
# - 'db/migrate/**/*.rb'
|
119
|
+
# - 'db/*.rb'
|
120
|
+
|
121
|
+
# Use `foo {}` not `foo{}`.
|
122
|
+
Layout/SpaceBeforeBlockBraces:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
# Use `foo { bar }` not `foo {bar}`.
|
126
|
+
Layout/SpaceInsideBlockBraces:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
130
|
+
Layout/SpaceInsideHashLiteralBraces:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Layout/SpaceInsideParens:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
# Check quotes usage according to lint rule below.
|
137
|
+
Style/StringLiterals:
|
138
|
+
Enabled: true
|
139
|
+
EnforcedStyle: single_quotes
|
140
|
+
|
141
|
+
# Detect hard tabs, no hard tabs.
|
142
|
+
Layout/IndentationStyle:
|
143
|
+
Enabled: true
|
144
|
+
|
145
|
+
# Blank lines should not have any spaces.
|
146
|
+
Layout/TrailingEmptyLines:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
# No trailing whitespace.
|
150
|
+
Layout/TrailingWhitespace:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
# Use quotes for string literals when they are enough.
|
154
|
+
Style/RedundantPercentQ:
|
155
|
+
Enabled: true
|
156
|
+
|
157
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
158
|
+
Lint/RequireParentheses:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Lint/RedundantStringCoercion:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
# Supports --auto-correct
|
165
|
+
Style/RedundantSelf:
|
166
|
+
Description: Don't use self where it's not needed.
|
167
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-self-unless-required
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Style/RedundantReturn:
|
171
|
+
Enabled: true
|
172
|
+
AllowMultipleReturnValues: true
|
173
|
+
|
174
|
+
Style/Semicolon:
|
175
|
+
Enabled: true
|
176
|
+
AllowAsExpressionSeparator: true
|
177
|
+
|
178
|
+
# Prefer Foo.method over Foo::method
|
179
|
+
Style/ColonMethodCall:
|
180
|
+
Enabled: true
|
data/.ruby_version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.2
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
active_ksql (0.1.0.pre)
|
5
|
+
httparty (~> 0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
httparty (0.20.0)
|
13
|
+
mime-types (~> 3.0)
|
14
|
+
multi_xml (>= 0.5.2)
|
15
|
+
mime-types (3.4.1)
|
16
|
+
mime-types-data (~> 3.2015)
|
17
|
+
mime-types-data (3.2021.1115)
|
18
|
+
multi_xml (0.6.0)
|
19
|
+
parallel (1.21.0)
|
20
|
+
parser (3.0.3.2)
|
21
|
+
ast (~> 2.4.1)
|
22
|
+
rainbow (3.0.0)
|
23
|
+
rake (13.0.6)
|
24
|
+
regexp_parser (2.2.0)
|
25
|
+
rexml (3.2.5)
|
26
|
+
rspec (3.10.0)
|
27
|
+
rspec-core (~> 3.10.0)
|
28
|
+
rspec-expectations (~> 3.10.0)
|
29
|
+
rspec-mocks (~> 3.10.0)
|
30
|
+
rspec-core (3.10.1)
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-expectations (3.10.1)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-mocks (3.10.2)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.10.0)
|
38
|
+
rspec-support (3.10.3)
|
39
|
+
rubocop (1.24.0)
|
40
|
+
parallel (~> 1.10)
|
41
|
+
parser (>= 3.0.0.0)
|
42
|
+
rainbow (>= 2.2.2, < 4.0)
|
43
|
+
regexp_parser (>= 1.8, < 3.0)
|
44
|
+
rexml
|
45
|
+
rubocop-ast (>= 1.15.0, < 2.0)
|
46
|
+
ruby-progressbar (~> 1.7)
|
47
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
48
|
+
rubocop-ast (1.15.0)
|
49
|
+
parser (>= 3.0.1.1)
|
50
|
+
ruby-progressbar (1.11.0)
|
51
|
+
unicode-display_width (2.1.0)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
x86_64-darwin-20
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
active_ksql!
|
59
|
+
rake (~> 13.0)
|
60
|
+
rspec (~> 3.0)
|
61
|
+
rubocop (~> 1.7)
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
2.2.28
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Lapo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
![][ruby-shield]
|
2
|
+
|
3
|
+
<p align="center">
|
4
|
+
<img width="200" src="https://user-images.githubusercontent.com/50866745/147449973-a743b690-fef4-4b97-86d3-cc01f1695118.png" >
|
5
|
+
</p>
|
6
|
+
|
7
|
+
|
8
|
+
# ActiveKsql
|
9
|
+
|
10
|
+
[![GitHub license](https://badgen.net/github/license/Naereen/Strapdown.js)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE) ![gem](https://img.shields.io/badge/gem-0.1.0.alpha-blue) [![stability-alpha](https://img.shields.io/badge/stability-alpha-f4d03f.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#alpha)
|
11
|
+
|
12
|
+
ActiveKsql allows you to perform SQL requests to your ksqlDB server.
|
13
|
+
You can find the ksqlDB official documentation [here](https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/quick-reference/).
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'active_ksql', '0.1.0.alpha.1'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle install
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install active_ksql
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
The gem is currently under development although you can start using the beta version.
|
34
|
+
|
35
|
+
### Configuration
|
36
|
+
|
37
|
+
Run `rails generate active_ksql` to generate the gem initializer.
|
38
|
+
|
39
|
+
```Ruby
|
40
|
+
ActiveKsql.configure do |config|
|
41
|
+
config.host = "http://localhost:8088"
|
42
|
+
config.api_key = ""
|
43
|
+
config.api_secret = ""
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
### API Client
|
48
|
+
|
49
|
+
At the moment the client allows you to run [queries](https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-rest-api/query-endpoint/) and to execute [statements](https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-rest-api/ksql-endpoint/).
|
50
|
+
|
51
|
+
### Queries
|
52
|
+
|
53
|
+
To run queries you can use the client's `query` method, like so:
|
54
|
+
|
55
|
+
```Ruby
|
56
|
+
client = ActiveKsql::Api.new
|
57
|
+
|
58
|
+
client.query("SELECT * FROM pageviews EMIT CHANGES;", {
|
59
|
+
streams_properties: {
|
60
|
+
"ksql.streams.auto.offset.reset": "earliest"
|
61
|
+
}
|
62
|
+
})
|
63
|
+
```
|
64
|
+
|
65
|
+
Optional arguments are:
|
66
|
+
|
67
|
+
- streams_properties
|
68
|
+
|
69
|
+
### Statements
|
70
|
+
|
71
|
+
Same as for queries you can use the client's `ksql` method, like so:
|
72
|
+
|
73
|
+
```Ruby
|
74
|
+
client = ActiveKsql::Api.new
|
75
|
+
|
76
|
+
client.ksql("CREATE STREAM pageviews_home AS SELECT * FROM pageviews_original WHERE pageid='home';", {
|
77
|
+
streams_properties: {
|
78
|
+
"ksql.streams.auto.offset.reset": "earliest"
|
79
|
+
}
|
80
|
+
})
|
81
|
+
```
|
82
|
+
|
83
|
+
Optional arguments are:
|
84
|
+
|
85
|
+
- streams_properties
|
86
|
+
- session_variables
|
87
|
+
- command_sequence_number
|
88
|
+
|
89
|
+
|
90
|
+
## Development
|
91
|
+
|
92
|
+
The gem will soon act as an ORM.
|
93
|
+
We're planning to develop and release enhancements early 2022.
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/LapoElisacci/active_ksql.
|
98
|
+
|
99
|
+
## License
|
100
|
+
|
101
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
102
|
+
|
103
|
+
<!--- MARKDOWN LINKS --->
|
104
|
+
|
105
|
+
[ruby-shield]: https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge&logo=ruby&logoColor=white
|
106
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'active_ksql'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require 'pry'
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
|
16
|
+
ActiveKsql.configure do |config|
|
17
|
+
config.host = 'http://localhost:8088'
|
18
|
+
config.api_key = ''
|
19
|
+
config.api_secret = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
module ActiveKsql
|
6
|
+
#
|
7
|
+
# KsqlDB API Client
|
8
|
+
#
|
9
|
+
class Api
|
10
|
+
attr_accessor :base_uri, :client, :headers
|
11
|
+
|
12
|
+
KSQL_ENDPOINT = 'ksql'
|
13
|
+
QUERY_ENDPOINT = 'query'
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@base_uri = ActiveKsql.config.host
|
17
|
+
@headers = {
|
18
|
+
'Accept' => 'application/vnd.ksql.v1+json; q=0.9, application/json; q=0.5',
|
19
|
+
'Authorization' => "Basic #{ActiveKsql.config.api_key}:#{ActiveKsql.config.api_secret}"
|
20
|
+
}
|
21
|
+
@client = HTTParty
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# Perform requests to the /ksql endpoint of ksqlDB REST API
|
26
|
+
#
|
27
|
+
# @param [String] sql The ksqlDB SQL Statement
|
28
|
+
# @param [Hash] streams_properties ksqlDB streamsProperties param
|
29
|
+
# @param [Hash] session_variables ksqlDB sessionVariables param
|
30
|
+
# @param [Int] command_sequence_number ksqlDB commandSequenceNumber param
|
31
|
+
#
|
32
|
+
# @return [Hash/Array] Request response
|
33
|
+
#
|
34
|
+
def ksql(sql, streams_properties: nil, session_variables: nil, command_sequence_number: nil)
|
35
|
+
post(KSQL_ENDPOINT, body: { ksql: sql, streamsProperties: streams_properties, sessionVariables: session_variables, commandSequenceNumber: command_sequence_number }.compact)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Perform requests to the /query endpoint of ksqlDB REST API
|
40
|
+
#
|
41
|
+
# @param [String] sql The ksqlDB SQL Statement
|
42
|
+
# @param [Hash] streams_properties ksqlDB streamsProperties param
|
43
|
+
#
|
44
|
+
# @return [Hash/Array] Request response
|
45
|
+
#
|
46
|
+
def query(sql, streams_properties: nil)
|
47
|
+
post(QUERY_ENDPOINT, body: { ksql: sql, streamsProperties: streams_properties }.compact)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
#
|
53
|
+
# Perform the HTTP Request
|
54
|
+
#
|
55
|
+
# @param [String] endpoint ksqlDB REST API Endpoint
|
56
|
+
# @param [Hash] body HTTP Request Body
|
57
|
+
#
|
58
|
+
# @return [Hash/Array] Request response
|
59
|
+
#
|
60
|
+
def post(endpoint, body: {})
|
61
|
+
client.post("#{base_uri}/#{endpoint}", headers: headers, body: body.to_json).parsed_response
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/active_ksql.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# require 'active_support'
|
4
|
+
# require 'active_model'
|
5
|
+
|
6
|
+
require_relative 'active_ksql/version'
|
7
|
+
require_relative 'active_ksql/configuration'
|
8
|
+
require_relative 'active_ksql/api'
|
9
|
+
|
10
|
+
module ActiveKsql
|
11
|
+
class Error < StandardError; end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
attr_accessor :config
|
15
|
+
|
16
|
+
def configure
|
17
|
+
self.config = ActiveKsql::Configuration.new
|
18
|
+
yield(config)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
# Creates the ActiveKsql initializer file for Rails apps.
|
6
|
+
#
|
7
|
+
# @example Invokation from terminal
|
8
|
+
# rails generate active_ksql
|
9
|
+
#
|
10
|
+
class ActiveKsqlGenerator < Rails::Generators::Base
|
11
|
+
desc "Description:\n This creates a Rails initializer for Ksql"
|
12
|
+
|
13
|
+
source_root File.expand_path('templates', __dir__)
|
14
|
+
|
15
|
+
desc 'Configures Ksql to connect to ksqlDB'
|
16
|
+
def generate_layout
|
17
|
+
template 'initializer.rb', 'config/initializers/active_ksql.rb'
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_ksql
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.alpha.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lapo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-12-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: ''
|
28
|
+
email:
|
29
|
+
- lapoelisacci@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rspec"
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- ".ruby_version"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- Gemfile
|
39
|
+
- Gemfile.lock
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/console
|
44
|
+
- bin/setup
|
45
|
+
- lib/active_ksql.rb
|
46
|
+
- lib/active_ksql/api.rb
|
47
|
+
- lib/active_ksql/configuration.rb
|
48
|
+
- lib/active_ksql/version.rb
|
49
|
+
- lib/generators/active_ksql.rb
|
50
|
+
- lib/generators/templates/initializer.rb
|
51
|
+
homepage: https://github.com/LapoElisacci/ksql
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata:
|
55
|
+
homepage_uri: https://github.com/LapoElisacci/ksql
|
56
|
+
source_code_uri: https://github.com/LapoElisacci/active_ksql
|
57
|
+
changelog_uri: https://github.com/LapoElisacci/active_ksql/blob/main/CHANGELOG.md
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.4.0
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 1.3.1
|
72
|
+
requirements: []
|
73
|
+
rubygems_version: 3.1.2
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Kafka ksqlDB ORM for Ruby
|
77
|
+
test_files: []
|