legion-data 0.1.0 → 1.1.4

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +98 -71
  3. data/.gitignore +0 -1
  4. data/.rubocop.yml +10 -7
  5. data/CHANGELOG.md +16 -0
  6. data/Gemfile +0 -3
  7. data/Gemfile.lock +100 -0
  8. data/README.md +13 -11
  9. data/legion-data.gemspec +22 -10
  10. data/lib/legion/data.rb +51 -33
  11. data/lib/legion/data/connection.rb +55 -19
  12. data/lib/legion/data/migration.rb +7 -20
  13. data/lib/legion/data/migrations/001_add_schema_columns.rb +1 -1
  14. data/lib/legion/data/migrations/002_add_users.rb +17 -0
  15. data/lib/legion/data/migrations/003_add_groups.rb +16 -0
  16. data/lib/legion/data/migrations/004_add_chains.rb +25 -0
  17. data/lib/legion/data/migrations/005_add_envs.rb +24 -0
  18. data/lib/legion/data/migrations/006_add_dcs.rb +24 -0
  19. data/lib/legion/data/migrations/007_add_nodes.rb +26 -0
  20. data/lib/legion/data/migrations/008_add_settings.rb +18 -0
  21. data/lib/legion/data/migrations/009_add_extensions.rb +25 -0
  22. data/lib/legion/data/migrations/010_add_runners.rb +21 -0
  23. data/lib/legion/data/migrations/011_add_functions.rb +29 -0
  24. data/lib/legion/data/migrations/012_add_tasks.rb +28 -0
  25. data/lib/legion/data/migrations/013_add_task_logs.rb +23 -0
  26. data/lib/legion/data/migrations/014_add_relationships.rb +27 -0
  27. data/lib/legion/data/migrations/015_add_default_extensions.rb +24 -0
  28. data/lib/legion/data/migrations/016_change_task_args.rb +7 -0
  29. data/lib/legion/data/migrations/017_add_payload_task.rb +7 -0
  30. data/lib/legion/data/migrations/018_add_migration_column.rb +7 -0
  31. data/lib/legion/data/model.rb +26 -25
  32. data/lib/legion/data/models/chain.rb +0 -1
  33. data/lib/legion/data/models/datacenter.rb +0 -1
  34. data/lib/legion/data/models/environment.rb +0 -1
  35. data/lib/legion/data/models/extension.rb +11 -0
  36. data/lib/legion/data/models/function.rb +5 -4
  37. data/lib/legion/data/models/group.rb +10 -0
  38. data/lib/legion/data/models/node.rb +1 -1
  39. data/lib/legion/data/models/relationship.rb +1 -1
  40. data/lib/legion/data/models/runner.rb +15 -0
  41. data/lib/legion/data/models/setting.rb +10 -0
  42. data/lib/legion/data/models/task.rb +0 -1
  43. data/lib/legion/data/models/task_log.rb +0 -1
  44. data/lib/legion/data/models/user.rb +10 -0
  45. data/lib/legion/data/settings.rb +68 -0
  46. data/lib/legion/data/version.rb +1 -1
  47. data/sonar-project.properties +12 -0
  48. metadata +119 -54
  49. data/lib/legion/data/connections/base.rb +0 -45
  50. data/lib/legion/data/connections/jdbc.rb +0 -21
  51. data/lib/legion/data/connections/mysql.rb +0 -26
  52. data/lib/legion/data/connections/mysql2.rb +0 -26
  53. data/lib/legion/data/connections/mysql_base.rb +0 -19
  54. data/lib/legion/data/migrations/002_add_chains_table.rb +0 -21
  55. data/lib/legion/data/migrations/003_add_datacenters_table.rb +0 -21
  56. data/lib/legion/data/migrations/004_add_envs_table.rb +0 -21
  57. data/lib/legion/data/migrations/005_add_functions_table.rb +0 -25
  58. data/lib/legion/data/migrations/006_add_namespaces_table.rb +0 -24
  59. data/lib/legion/data/migrations/007_add_nodes_table.rb +0 -22
  60. data/lib/legion/data/migrations/008_add_relationships_table.rb +0 -28
  61. data/lib/legion/data/migrations/009_add_task_logs_table.rb +0 -17
  62. data/lib/legion/data/migrations/010_add_tasks_table.rb +0 -20
  63. data/lib/legion/data/migrations/011_add_users_and_groups.rb +0 -28
  64. data/lib/legion/data/migrations/012_foreign_keys_users_and_groups.rb +0 -42
  65. data/lib/legion/data/migrations/013_function_foreign_keys.rb +0 -10
  66. data/lib/legion/data/migrations/014_nodes_foreign_keys.rb +0 -12
  67. data/lib/legion/data/migrations/015_relationships_foreign_keys.rb +0 -14
  68. data/lib/legion/data/migrations/016_tasks_foreign_keys.rb +0 -22
  69. data/lib/legion/data/migrations/017_add_relationship_to_tasks.rb +0 -14
  70. data/lib/legion/data/models/namespace.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3181ed356e3e8824c11395ebe6e9243951f75ba4167d61ef1fa50bd67e492a0c
4
- data.tar.gz: e5ef94e148b2fd6c54c8790f10293ee61f3c1186bbe2f784bbef029b25df70c6
3
+ metadata.gz: ef8f31798b1ea264a22d1a7d35aaa107268d6b9aa16bb936c57897b76febd4e1
4
+ data.tar.gz: 54c5f13cb7f956f0d0e7ed3a8b2b619432a27fcf66a8efc1eab8562065cd19fb
5
5
  SHA512:
6
- metadata.gz: ecf75674d469d1d79b17bebd520b9ed4259ff7187884abc020d30aaa069d4920fafdf55100223ff5aabfe941aeb9378bc290fb292277cabf34ced9acecafe99e
7
- data.tar.gz: 81d01b0512a7054babf355225139bc767c6d0aea8284bed05b94b54563f5e45289ca3b6f1953910e6a38aaa2b945b20979212ff5cb82e2a9e8699eab58c65dde
6
+ metadata.gz: e305e59542335455fc886ca57949a159bbad690eadceec7838713bf4e111632f20fb584b38a0689f691eaebf74dc6f38161cbbddca729db840aa00b33a99d703
7
+ data.tar.gz: a5a9e19e394ff914ffc19cc4332d860c68923b120db45627c8487173771732f9d49344123f79e7f961a7c3a963a716a289d7fbdcd5ce04b0d0dbc65299a90ddf
@@ -1,20 +1,24 @@
1
- version: 2 # use CircleCI 2.0
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@0.2.1
4
+ sonarcloud: sonarsource/sonarcloud@1.0.1
5
+
2
6
  jobs:
3
7
  "rubocop":
4
8
  docker:
5
- - image: circleci/ruby:2.4-node
9
+ - image: circleci/ruby:2.7-node
6
10
  steps:
7
11
  - checkout
8
- - run: gem install rubocop
12
+ - ruby/load-cache
13
+ - ruby/install-deps
9
14
  - run:
10
15
  name: Run Rubocop
11
- command: rubocop
12
- - store_test_results:
13
- path: test_results
14
- "ruby-2.3":
16
+ command: bundle exec rubocop
17
+ - ruby/save-cache
18
+ "ruby-two-five":
15
19
  docker:
16
- - image: circleci/ruby:2.3
17
- - image: mysql:5.7
20
+ - image: circleci/ruby:2.5
21
+ - image: circleci/mysql:5.7
18
22
  environment:
19
23
  MYSQL_DATABASE: 'legion'
20
24
  MYSQL_ROOT_PASSWORD: 'legion'
@@ -22,20 +26,20 @@ jobs:
22
26
  MYSQL_PASSWORD: 'legion'
23
27
  steps:
24
28
  - checkout
29
+ - ruby/load-cache
25
30
  - run:
26
- name: Bundle Install
27
- command: bundle install
31
+ name: update bundler
32
+ command: gem update bundler
33
+ - ruby/install-deps
28
34
  - run:
29
- name: Run RSpec
30
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
31
- when: always
32
- - store_test_results:
33
- path: test-results
34
-
35
- "ruby-2.4":
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":
36
40
  docker:
37
- - image: circleci/ruby:2.4-node
38
- - image: mysql:5.7
41
+ - image: circleci/ruby:2.6
42
+ - image: circleci/mysql:5.7
39
43
  environment:
40
44
  MYSQL_DATABASE: 'legion'
41
45
  MYSQL_ROOT_PASSWORD: 'legion'
@@ -43,19 +47,38 @@ jobs:
43
47
  MYSQL_PASSWORD: 'legion'
44
48
  steps:
45
49
  - checkout
50
+ - ruby/load-cache
46
51
  - run:
47
- name: Bundle Install
48
- command: bundle install
52
+ name: update bundler
53
+ command: gem update bundler
54
+ - ruby/install-deps
49
55
  - run:
50
- name: Run RSpec
51
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
52
- when: always
53
- - store_test_results:
54
- path: test-results
55
- "ruby-2.5":
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":
56
61
  docker:
57
- - image: circleci/ruby:2.5-node
58
- - image: mysql:5.7
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
59
82
  environment:
60
83
  MYSQL_DATABASE: 'legion'
61
84
  MYSQL_ROOT_PASSWORD: 'legion'
@@ -66,16 +89,18 @@ jobs:
66
89
  - run:
67
90
  name: Bundle Install
68
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;"'
69
95
  - run:
70
96
  name: Run RSpec
71
97
  command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
72
98
  when: always
73
- - store_test_results:
74
- path: test-results
75
- "ruby-2.6":
99
+ - sonarcloud/scan
100
+ "jruby-nine-two-e":
76
101
  docker:
77
- - image: circleci/ruby:2.6-node
78
- - image: mysql:5.7
102
+ - image: circleci/jruby:9.2.13-jre
103
+ - image: circleci/mysql:5.7
79
104
  environment:
80
105
  MYSQL_DATABASE: 'legion'
81
106
  MYSQL_ROOT_PASSWORD: 'legion'
@@ -86,16 +111,17 @@ jobs:
86
111
  - run:
87
112
  name: Bundle Install
88
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;"'
89
117
  - run:
90
118
  name: Run RSpec
91
119
  command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
92
120
  when: always
93
- - store_test_results:
94
- path: test-results
95
- "jruby-9.2":
121
+ "sonarcloud":
96
122
  docker:
97
- - image: circleci/jruby:9.2
98
- - image: mysql:5.7
123
+ - image: circleci/ruby:2.7
124
+ - image: circleci/mysql:5.7
99
125
  environment:
100
126
  MYSQL_DATABASE: 'legion'
101
127
  MYSQL_ROOT_PASSWORD: 'legion'
@@ -103,45 +129,46 @@ jobs:
103
129
  MYSQL_PASSWORD: 'legion'
104
130
  steps:
105
131
  - checkout
132
+ - ruby/load-cache
106
133
  - run:
107
- name: Bundle Install
108
- command: bundle install
134
+ name: Install Rubocop
135
+ command: gem install rubocop rubocop-sequel rubocop-performance rubocop-rspec
109
136
  - run:
110
- name: Run RSpec
111
- command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
112
- when: always
113
- - store_test_results:
114
- path: test-results
137
+ name: update bundler
138
+ command: gem update bundler
139
+ - ruby/install-deps
140
+ - run:
141
+ name: update max connections
142
+ command: 'sudo apt-get install default-mysql-client && mysql -h 127.0.0.1 -u root --password=legion --execute="set global max_connections = 100000;"'
143
+ - ruby/run-tests
144
+ - run:
145
+ name: Run Rubocop
146
+ command: rubocop --format=json --out=rubocop-result.json
147
+ - sonarcloud/scan
148
+ - ruby/save-cache
115
149
 
116
150
  workflows:
117
151
  version: 2
118
- cop_rake_deploy:
152
+ rubocop-rspec:
119
153
  jobs:
120
154
  - rubocop
121
- - ruby-2.3:
122
- requires:
123
- - ruby-2.4
124
- filters:
125
- branches:
126
- only: /\bdevelop\b|\bmaster\b/
127
- - ruby-2.4:
155
+ - ruby-two-five:
128
156
  requires:
129
157
  - rubocop
130
- - ruby-2.5:
158
+ - ruby-two-six:
159
+ requires:
160
+ - ruby-two-five
161
+ - ruby-two-seven:
162
+ requires:
163
+ - ruby-two-five
164
+ - sonarcloud:
165
+ requires:
166
+ - ruby-two-seven
167
+ - ruby-two-six
168
+ - jruby-nine-two:
131
169
  requires:
132
- - ruby-2.4
133
- filters:
134
- branches:
135
- only: /\bdevelop\b|\bmaster\b/
136
- - ruby-2.6:
170
+ - ruby-two-seven
171
+ - ruby-two-six
172
+ - jruby-nine-two-e:
137
173
  requires:
138
- - ruby-2.4
139
- filters:
140
- branches:
141
- only: /\bdevelop\b|\bmaster\b/
142
- # - jruby-9.2:
143
- # requires:
144
- # - ruby-2.3
145
- # - ruby-2.4
146
- # - ruby-2.5
147
- # - ruby-2.6
174
+ - jruby-nine-two
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
@@ -1,4 +1,8 @@
1
- Metrics/LineLength:
1
+ require:
2
+ - rubocop-sequel
3
+ - rubocop-performance
4
+
5
+ Layout/LineLength:
2
6
  Max: 120
3
7
  Exclude:
4
8
  - 'lib/legion/data/migrations/*.rb'
@@ -6,6 +10,8 @@ Metrics/MethodLength:
6
10
  Max: 30
7
11
  Metrics/ClassLength:
8
12
  Max: 1500
13
+ Metrics/AbcSize:
14
+ Max: 34
9
15
  Metrics/BlockLength:
10
16
  Max: 50
11
17
  Exclude:
@@ -14,16 +20,13 @@ Layout/SpaceAroundEqualsInParameterDefault:
14
20
  EnforcedStyle: space
15
21
  Style/SymbolArray:
16
22
  Enabled: true
17
- Layout/AlignHash:
23
+ Layout/HashAlignment:
18
24
  EnforcedHashRocketStyle: table
19
25
  EnforcedColonStyle: table
20
- Style/HashSyntax:
21
- EnforcedStyle: ruby19_no_mixed_keys
22
26
  Style/Documentation:
23
27
  Enabled: false
24
28
  AllCops:
25
- TargetRubyVersion: 2.4
29
+ TargetRubyVersion: 2.5
30
+ NewCops: enable
26
31
  Style/FrozenStringLiteralComment:
27
32
  Enabled: false
28
- Naming/FileName:
29
- Enabled: false
@@ -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 CHANGED
@@ -2,6 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in legion-data.gemspec
4
4
  gemspec
5
-
6
- gem 'legion-logging', path: '~/legion-io/legion-logging'
7
- gem 'legion-settings', path: '~/legion-io/legion-settings'
@@ -0,0 +1,100 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ legion-data (1.1.4)
5
+ legion-logging
6
+ legion-settings
7
+ mysql2
8
+ sequel
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ ast (2.4.1)
14
+ codecov (0.2.12)
15
+ json
16
+ simplecov
17
+ diff-lcs (1.4.4)
18
+ docile (1.3.2)
19
+ json (2.3.1)
20
+ json (2.3.1-java)
21
+ json_pure (2.3.1)
22
+ legion-json (1.1.2)
23
+ json_pure
24
+ multi_json
25
+ legion-logging (1.1.1)
26
+ rainbow (~> 3)
27
+ legion-settings (1.1.1)
28
+ legion-json
29
+ legion-logging
30
+ multi_json (1.15.0)
31
+ mysql2 (0.5.3)
32
+ parallel (1.19.2)
33
+ parser (2.7.2.0)
34
+ ast (~> 2.4.1)
35
+ rainbow (3.0.0)
36
+ rake (13.0.1)
37
+ regexp_parser (1.8.2)
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.3)
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.93.1)
55
+ parallel (~> 1.10)
56
+ parser (>= 2.7.1.5)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ regexp_parser (>= 1.8)
59
+ rexml
60
+ rubocop-ast (>= 0.6.0)
61
+ ruby-progressbar (~> 1.7)
62
+ unicode-display_width (>= 1.4.0, < 2.0)
63
+ rubocop-ast (0.8.0)
64
+ parser (>= 2.7.1.5)
65
+ rubocop-md (0.4.0)
66
+ rubocop (~> 0.60)
67
+ rubocop-performance (1.8.1)
68
+ rubocop (>= 0.87.0)
69
+ rubocop-ast (>= 0.4.0)
70
+ rubocop-rspec (1.43.2)
71
+ rubocop (~> 0.87)
72
+ rubocop-sequel (0.0.6)
73
+ rubocop (~> 0.55, >= 0.55)
74
+ ruby-progressbar (1.10.1)
75
+ sequel (5.37.0)
76
+ simplecov (0.19.0)
77
+ docile (~> 1.1)
78
+ simplecov-html (~> 0.11)
79
+ simplecov-html (0.12.3)
80
+ unicode-display_width (1.7.0)
81
+
82
+ PLATFORMS
83
+ java
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ bundler
88
+ codecov
89
+ legion-data!
90
+ rake
91
+ rspec
92
+ rspec_junit_formatter
93
+ rubocop
94
+ rubocop-md
95
+ rubocop-performance
96
+ rubocop-rspec
97
+ rubocop-sequel
98
+
99
+ BUNDLED WITH
100
+ 2.1.4
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Legion::Data
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/legion/data`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
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.
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,14 +21,17 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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.
32
34
 
33
35
  ## Contributing
34
36
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/legion-data.
37
+ Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/legion-io/legion-data.