legion-data-java 1.1.2
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 +7 -0
- data/.circleci/config.yml +171 -0
- data/.gitignore +12 -0
- data/.rspec +1 -0
- data/.rubocop.yml +33 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +99 -0
- data/README.md +37 -0
- data/Rakefile +55 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bitbucket-pipelines.yml +26 -0
- data/legion-data.gemspec +50 -0
- data/lib/legion/data.rb +60 -0
- data/lib/legion/data/connection.rb +61 -0
- data/lib/legion/data/migration.rb +15 -0
- data/lib/legion/data/migrations/001_add_schema_columns.rb +17 -0
- data/lib/legion/data/migrations/002_add_users.rb +17 -0
- data/lib/legion/data/migrations/003_add_groups.rb +16 -0
- data/lib/legion/data/migrations/004_add_chains.rb +25 -0
- data/lib/legion/data/migrations/005_add_envs.rb +24 -0
- data/lib/legion/data/migrations/006_add_dcs.rb +24 -0
- data/lib/legion/data/migrations/007_add_nodes.rb +26 -0
- data/lib/legion/data/migrations/008_add_settings.rb +18 -0
- data/lib/legion/data/migrations/009_add_extensions.rb +25 -0
- data/lib/legion/data/migrations/010_add_runners.rb +21 -0
- data/lib/legion/data/migrations/011_add_functions.rb +29 -0
- data/lib/legion/data/migrations/012_add_tasks.rb +28 -0
- data/lib/legion/data/migrations/013_add_task_logs.rb +23 -0
- data/lib/legion/data/migrations/014_add_relationships.rb +27 -0
- data/lib/legion/data/migrations/015_add_default_extensions.rb +24 -0
- data/lib/legion/data/migrations/016_change_task_args.rb +7 -0
- data/lib/legion/data/migrations/017_add_payload_task.rb +7 -0
- data/lib/legion/data/model.rb +36 -0
- data/lib/legion/data/models/chain.rb +11 -0
- data/lib/legion/data/models/datacenter.rb +11 -0
- data/lib/legion/data/models/environment.rb +11 -0
- data/lib/legion/data/models/extension.rb +11 -0
- data/lib/legion/data/models/function.rb +15 -0
- data/lib/legion/data/models/group.rb +10 -0
- data/lib/legion/data/models/node.rb +13 -0
- data/lib/legion/data/models/relationship.rb +16 -0
- data/lib/legion/data/models/runner.rb +15 -0
- data/lib/legion/data/models/setting.rb +10 -0
- data/lib/legion/data/models/task.rb +16 -0
- data/lib/legion/data/models/task_log.rb +12 -0
- data/lib/legion/data/models/user.rb +10 -0
- data/lib/legion/data/settings.rb +68 -0
- data/lib/legion/data/version.rb +5 -0
- data/sonar-project.properties +12 -0
- metadata +295 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eb498f6be55c266c124ead24ef7c4887b1b1c6c0293013c49ab2b80e981814d1
|
4
|
+
data.tar.gz: ed537f3fdead5e90940387d685a60fa848a028f4cb46a47dd3340dd4804cca89
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5551d4474fbbd02c116d6698b97152236a2bb00e681a85f5f29f471c3dc754df777377d77294b398085474439cd005faf7bcc0dfe96cd22cd6b7e61d8b55c95
|
7
|
+
data.tar.gz: 357f03cf9bfa1ad7d47ef5e33989ff11fb605a54c50983707dde4651dc03e544c393f6ff0362a1bd81f7bd0fab83a4c7041c59340bd166a34b659f7bb7d20dea
|
@@ -0,0 +1,171 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@0.2.1
|
4
|
+
sonarcloud: sonarsource/sonarcloud@1.0.1
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
"rubocop":
|
8
|
+
docker:
|
9
|
+
- image: circleci/ruby:2.7-node
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
- ruby/load-cache
|
13
|
+
- ruby/install-deps
|
14
|
+
- run:
|
15
|
+
name: Run Rubocop
|
16
|
+
command: bundle exec rubocop
|
17
|
+
- ruby/save-cache
|
18
|
+
"ruby-two-five":
|
19
|
+
docker:
|
20
|
+
- image: circleci/ruby:2.5
|
21
|
+
- image: circleci/mysql:5.7
|
22
|
+
environment:
|
23
|
+
MYSQL_DATABASE: 'legion'
|
24
|
+
MYSQL_ROOT_PASSWORD: 'legion'
|
25
|
+
MYSQL_USER: 'legion'
|
26
|
+
MYSQL_PASSWORD: 'legion'
|
27
|
+
steps:
|
28
|
+
- checkout
|
29
|
+
- ruby/load-cache
|
30
|
+
- run:
|
31
|
+
name: update bundler
|
32
|
+
command: gem update bundler
|
33
|
+
- ruby/install-deps
|
34
|
+
- run:
|
35
|
+
name: update max connections
|
36
|
+
command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
|
37
|
+
- ruby/run-tests
|
38
|
+
- ruby/save-cache
|
39
|
+
"ruby-two-six":
|
40
|
+
docker:
|
41
|
+
- image: circleci/ruby:2.6
|
42
|
+
- image: circleci/mysql:5.7
|
43
|
+
environment:
|
44
|
+
MYSQL_DATABASE: 'legion'
|
45
|
+
MYSQL_ROOT_PASSWORD: 'legion'
|
46
|
+
MYSQL_USER: 'legion'
|
47
|
+
MYSQL_PASSWORD: 'legion'
|
48
|
+
steps:
|
49
|
+
- checkout
|
50
|
+
- ruby/load-cache
|
51
|
+
- run:
|
52
|
+
name: update bundler
|
53
|
+
command: gem update bundler
|
54
|
+
- ruby/install-deps
|
55
|
+
- run:
|
56
|
+
name: update max connections
|
57
|
+
command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
|
58
|
+
- ruby/run-tests
|
59
|
+
- ruby/save-cache
|
60
|
+
"ruby-two-seven":
|
61
|
+
docker:
|
62
|
+
- image: circleci/ruby:2.7
|
63
|
+
- image: circleci/mysql:5.7
|
64
|
+
environment:
|
65
|
+
MYSQL_DATABASE: 'legion'
|
66
|
+
MYSQL_ROOT_PASSWORD: 'legion'
|
67
|
+
MYSQL_USER: 'legion'
|
68
|
+
MYSQL_PASSWORD: 'legion'
|
69
|
+
steps:
|
70
|
+
- checkout
|
71
|
+
- ruby/load-cache
|
72
|
+
- ruby/install-deps
|
73
|
+
- run:
|
74
|
+
name: update max connections
|
75
|
+
command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
|
76
|
+
- ruby/run-tests
|
77
|
+
- ruby/save-cache
|
78
|
+
"jruby-nine-two":
|
79
|
+
docker:
|
80
|
+
- image: circleci/jruby:9.2-jre
|
81
|
+
- image: circleci/mysql:5.7
|
82
|
+
environment:
|
83
|
+
MYSQL_DATABASE: 'legion'
|
84
|
+
MYSQL_ROOT_PASSWORD: 'legion'
|
85
|
+
MYSQL_USER: 'legion'
|
86
|
+
MYSQL_PASSWORD: 'legion'
|
87
|
+
steps:
|
88
|
+
- checkout
|
89
|
+
- run:
|
90
|
+
name: Bundle Install
|
91
|
+
command: bundle install
|
92
|
+
- run:
|
93
|
+
name: update max connections
|
94
|
+
command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
|
95
|
+
- run:
|
96
|
+
name: Run RSpec
|
97
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
98
|
+
when: always
|
99
|
+
- sonarcloud/scan
|
100
|
+
"jruby-nine-two-e":
|
101
|
+
docker:
|
102
|
+
- image: circleci/jruby:9.2.11-jre
|
103
|
+
- image: circleci/mysql:5.7
|
104
|
+
environment:
|
105
|
+
MYSQL_DATABASE: 'legion'
|
106
|
+
MYSQL_ROOT_PASSWORD: 'legion'
|
107
|
+
MYSQL_USER: 'legion'
|
108
|
+
MYSQL_PASSWORD: 'legion'
|
109
|
+
steps:
|
110
|
+
- checkout
|
111
|
+
- run:
|
112
|
+
name: Bundle Install
|
113
|
+
command: bundle install
|
114
|
+
- run:
|
115
|
+
name: update max connections
|
116
|
+
command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
|
117
|
+
- run:
|
118
|
+
name: Run RSpec
|
119
|
+
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
120
|
+
when: always
|
121
|
+
"sonarcloud":
|
122
|
+
docker:
|
123
|
+
- image: circleci/ruby:2.7
|
124
|
+
- image: circleci/mysql:5.7
|
125
|
+
environment:
|
126
|
+
MYSQL_DATABASE: 'legion'
|
127
|
+
MYSQL_ROOT_PASSWORD: 'legion'
|
128
|
+
MYSQL_USER: 'legion'
|
129
|
+
MYSQL_PASSWORD: 'legion'
|
130
|
+
steps:
|
131
|
+
- checkout
|
132
|
+
- ruby/load-cache
|
133
|
+
- run:
|
134
|
+
name: update bundler
|
135
|
+
command: gem update bundler
|
136
|
+
- ruby/install-deps
|
137
|
+
- run:
|
138
|
+
name: update max connections
|
139
|
+
command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
|
140
|
+
- ruby/run-tests
|
141
|
+
- run:
|
142
|
+
name: Run Rubocop
|
143
|
+
command: bundle exec rubocop --format=json --out=rubocop-result.json
|
144
|
+
- sonarcloud/scan
|
145
|
+
- ruby/save-cache
|
146
|
+
|
147
|
+
workflows:
|
148
|
+
version: 2
|
149
|
+
rubocop-rspec:
|
150
|
+
jobs:
|
151
|
+
- rubocop
|
152
|
+
- ruby-two-five:
|
153
|
+
requires:
|
154
|
+
- rubocop
|
155
|
+
- ruby-two-six:
|
156
|
+
requires:
|
157
|
+
- ruby-two-five
|
158
|
+
- ruby-two-seven:
|
159
|
+
requires:
|
160
|
+
- ruby-two-five
|
161
|
+
- sonarcloud:
|
162
|
+
requires:
|
163
|
+
- ruby-two-seven
|
164
|
+
- ruby-two-six
|
165
|
+
- jruby-nine-two:
|
166
|
+
requires:
|
167
|
+
- ruby-two-seven
|
168
|
+
- ruby-two-six
|
169
|
+
- jruby-nine-two-e:
|
170
|
+
requires:
|
171
|
+
- jruby-nine-two
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-sequel
|
3
|
+
- rubocop-md
|
4
|
+
- rubocop-performance
|
5
|
+
|
6
|
+
Layout/LineLength:
|
7
|
+
Max: 120
|
8
|
+
Exclude:
|
9
|
+
- 'lib/legion/data/migrations/*.rb'
|
10
|
+
Metrics/MethodLength:
|
11
|
+
Max: 30
|
12
|
+
Metrics/ClassLength:
|
13
|
+
Max: 1500
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 34
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Max: 50
|
18
|
+
Exclude:
|
19
|
+
- 'lib/legion/data/migrations/*'
|
20
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
21
|
+
EnforcedStyle: space
|
22
|
+
Style/SymbolArray:
|
23
|
+
Enabled: true
|
24
|
+
Layout/HashAlignment:
|
25
|
+
EnforcedHashRocketStyle: table
|
26
|
+
EnforcedColonStyle: table
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: false
|
29
|
+
AllCops:
|
30
|
+
TargetRubyVersion: 2.5
|
31
|
+
NewCops: enable
|
32
|
+
Style/FrozenStringLiteralComment:
|
33
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Legion::Data Changelog
|
2
|
+
## v1.1.2
|
3
|
+
* Updating connection details to support JDBC
|
4
|
+
* Changing default max connections to 10
|
5
|
+
* Fixing issue with Legion::Cache always throwing an error
|
6
|
+
|
7
|
+
## v0.2.0
|
8
|
+
* Redesigning schema
|
9
|
+
|
10
|
+
## v0.1.1
|
11
|
+
* Updated `rubocop.yml` with updated syntax
|
12
|
+
* Changing default connection count to 100 from 10
|
13
|
+
* Updating some exception handling to meet rubocop requirements
|
14
|
+
* Updating gemspec to have more things
|
15
|
+
* Fixing logic in debug_logging
|
16
|
+
* Adding RSpec tests for debug_logging
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
legion-data-java (1.1.2)
|
5
|
+
jdbc-mysql
|
6
|
+
legion-logging
|
7
|
+
legion-settings
|
8
|
+
sequel
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
ast (2.4.1)
|
14
|
+
codecov (0.2.8)
|
15
|
+
json
|
16
|
+
simplecov
|
17
|
+
diff-lcs (1.4.4)
|
18
|
+
docile (1.3.2)
|
19
|
+
jdbc-mysql (8.0.17)
|
20
|
+
json (2.3.1)
|
21
|
+
json (2.3.1-java)
|
22
|
+
json_pure (2.3.1)
|
23
|
+
legion-json (1.1.2)
|
24
|
+
json_pure
|
25
|
+
multi_json
|
26
|
+
legion-logging (1.1.1)
|
27
|
+
rainbow (~> 3)
|
28
|
+
legion-settings (1.1.1)
|
29
|
+
legion-json
|
30
|
+
legion-logging
|
31
|
+
multi_json (1.15.0)
|
32
|
+
parallel (1.19.2)
|
33
|
+
parser (2.7.1.4)
|
34
|
+
ast (~> 2.4.1)
|
35
|
+
rainbow (3.0.0)
|
36
|
+
rake (13.0.1)
|
37
|
+
regexp_parser (1.7.1)
|
38
|
+
rexml (3.2.4)
|
39
|
+
rspec (3.9.0)
|
40
|
+
rspec-core (~> 3.9.0)
|
41
|
+
rspec-expectations (~> 3.9.0)
|
42
|
+
rspec-mocks (~> 3.9.0)
|
43
|
+
rspec-core (3.9.2)
|
44
|
+
rspec-support (~> 3.9.3)
|
45
|
+
rspec-expectations (3.9.2)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-mocks (3.9.1)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.9.0)
|
51
|
+
rspec-support (3.9.3)
|
52
|
+
rspec_junit_formatter (0.4.1)
|
53
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
54
|
+
rubocop (0.89.1)
|
55
|
+
parallel (~> 1.10)
|
56
|
+
parser (>= 2.7.1.1)
|
57
|
+
rainbow (>= 2.2.2, < 4.0)
|
58
|
+
regexp_parser (>= 1.7)
|
59
|
+
rexml
|
60
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
61
|
+
ruby-progressbar (~> 1.7)
|
62
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
63
|
+
rubocop-ast (0.3.0)
|
64
|
+
parser (>= 2.7.1.4)
|
65
|
+
rubocop-md (0.4.0)
|
66
|
+
rubocop (~> 0.60)
|
67
|
+
rubocop-performance (1.7.1)
|
68
|
+
rubocop (>= 0.82.0)
|
69
|
+
rubocop-rspec (1.43.2)
|
70
|
+
rubocop (~> 0.87)
|
71
|
+
rubocop-sequel (0.0.6)
|
72
|
+
rubocop (~> 0.55, >= 0.55)
|
73
|
+
ruby-progressbar (1.10.1)
|
74
|
+
sequel (5.35.0)
|
75
|
+
simplecov (0.19.0)
|
76
|
+
docile (~> 1.1)
|
77
|
+
simplecov-html (~> 0.11)
|
78
|
+
simplecov-html (0.12.2)
|
79
|
+
unicode-display_width (1.7.0)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
java
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
bundler
|
87
|
+
codecov
|
88
|
+
legion-data-java!
|
89
|
+
rake
|
90
|
+
rspec
|
91
|
+
rspec_junit_formatter
|
92
|
+
rubocop
|
93
|
+
rubocop-md
|
94
|
+
rubocop-performance
|
95
|
+
rubocop-rspec
|
96
|
+
rubocop-sequel
|
97
|
+
|
98
|
+
BUNDLED WITH
|
99
|
+
2.1.4
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Legion::Data
|
2
|
+
|
3
|
+
Legion::Data is used by the framework to connect to a database. All database changes should be
|
4
|
+
added as a migration with proper up/downs.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'legion-data'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install legion-data
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
You can create a new connection to the database with the following example
|
25
|
+
``` Legion::Data::Connection.new.database.connection ```
|
26
|
+
Keep in mind that if you need access to the database as part of a LEX, you should instead add it as a
|
27
|
+
requirement inside your definitions with the following
|
28
|
+
```
|
29
|
+
def requirements
|
30
|
+
%w[legion-transport legion-data]
|
31
|
+
end
|
32
|
+
```
|
33
|
+
and the framework will take care of the rest.
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/legion-io/legion-data.
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task default: :spec
|
8
|
+
|
9
|
+
task :dev do
|
10
|
+
end
|
11
|
+
|
12
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
13
|
+
t.options = ['--display-cop-names']
|
14
|
+
end
|
15
|
+
|
16
|
+
RuboCop::RakeTask.new(:rubocop_fix) do |t|
|
17
|
+
# t.options = ['--display-cop-names -a']
|
18
|
+
t.options = ['--display-cop-names']
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :db do
|
22
|
+
require 'sequel'
|
23
|
+
require 'legion/logging'
|
24
|
+
Sequel.extension :migration
|
25
|
+
|
26
|
+
# desc 'Prints current schema version'
|
27
|
+
# task :version do
|
28
|
+
# version = DB[:schema_info].first[:version] # if DB.tables.include?(:schema_info) || true
|
29
|
+
#
|
30
|
+
# puts "Schema Version: #{version}"
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# desc 'Perform migration up to latest migration available'
|
34
|
+
# task :migrate do
|
35
|
+
# Sequel::Migrator.run(DB, 'lib/legion/data/migrations')
|
36
|
+
# Rake::Task['db:version'].execute
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# desc 'Perform rollback to specified target or full rollback as default'
|
40
|
+
# task :rollback, :target do |_t, args|
|
41
|
+
# args.with_defaults(target: 0)
|
42
|
+
#
|
43
|
+
# Sequel::Migrator.run(DB, 'lib/legion/data/migrations', target: args[:target].to_i)
|
44
|
+
# Rake::Task['db:version'].execute
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# desc 'Perform migration reset (full rollback and migration)'
|
48
|
+
# task :reset do
|
49
|
+
# Sequel::Migrator.run(DB, 'migrations', target: 0)
|
50
|
+
# Sequel::Migrator.run(DB, 'migrations')
|
51
|
+
# Rake::Task['db:version'].execute
|
52
|
+
# end
|
53
|
+
end
|
54
|
+
|
55
|
+
# RuboCop::RakeTask.new
|