legion-data 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3181ed356e3e8824c11395ebe6e9243951f75ba4167d61ef1fa50bd67e492a0c
4
- data.tar.gz: e5ef94e148b2fd6c54c8790f10293ee61f3c1186bbe2f784bbef029b25df70c6
3
+ metadata.gz: 1201c65f7728a2af01e9b77ea56b2bf5b1f357c246f12cf84e59790d917a314c
4
+ data.tar.gz: e7a17e1c023b5514a31952fad0898e4048dc89938888ffcb76632403a1aa3a94
5
5
  SHA512:
6
- metadata.gz: ecf75674d469d1d79b17bebd520b9ed4259ff7187884abc020d30aaa069d4920fafdf55100223ff5aabfe941aeb9378bc290fb292277cabf34ced9acecafe99e
7
- data.tar.gz: 81d01b0512a7054babf355225139bc767c6d0aea8284bed05b94b54563f5e45289ca3b6f1953910e6a38aaa2b945b20979212ff5cb82e2a9e8699eab58c65dde
6
+ metadata.gz: '08530a83befaf49097ffcb3caff420f92d4d2fe942e88dce7b847a854d4241ab5d8370cef6168995e725db5fe26ff7773bb6763b7391992974b39bf444563638'
7
+ data.tar.gz: cfa8d6055185cbea52085d845058538148f497096e13ff3370cd13086b00a062e4dc9861663f749c58781bc23bb37ea87e588b049a20b884dd1f881025d16a50
data/.circleci/config.yml CHANGED
@@ -6,6 +6,7 @@ jobs:
6
6
  steps:
7
7
  - checkout
8
8
  - run: gem install rubocop
9
+ - run: bundle install
9
10
  - run:
10
11
  name: Run Rubocop
11
12
  command: rubocop
data/.rubocop.yml CHANGED
@@ -1,3 +1,8 @@
1
+ require:
2
+ - rubocop-sequel
3
+ - rubocop-md
4
+ - rubocop-performance
5
+
1
6
  Metrics/LineLength:
2
7
  Max: 120
3
8
  Exclude:
@@ -14,16 +19,12 @@ Layout/SpaceAroundEqualsInParameterDefault:
14
19
  EnforcedStyle: space
15
20
  Style/SymbolArray:
16
21
  Enabled: true
17
- Layout/AlignHash:
22
+ Layout/HashAlignment:
18
23
  EnforcedHashRocketStyle: table
19
24
  EnforcedColonStyle: table
20
- Style/HashSyntax:
21
- EnforcedStyle: ruby19_no_mixed_keys
22
25
  Style/Documentation:
23
26
  Enabled: false
24
27
  AllCops:
25
- TargetRubyVersion: 2.4
28
+ TargetRubyVersion: 2.6
26
29
  Style/FrozenStringLiteralComment:
27
30
  Enabled: false
28
- Naming/FileName:
29
- Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Legion::Data Changelog
2
+
3
+ ## v0.1.1
4
+ * Updated `rubocop.yml` with updated syntax
5
+ * Changing default connection count to 100 from 10
6
+ * Updating some exception handling to meet rubocop requirements
7
+ * Updating gemspec to have more things
8
+ * Fixing logic in debug_logging
9
+ * 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'
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.
data/legion-data.gemspec CHANGED
@@ -10,21 +10,32 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = 'Used by Legion to connect to the database'
12
12
  spec.description = 'The Legion connect gem'
13
- spec.homepage = 'https://bitbucket.org/legion-io/legion-data'
13
+ spec.homepage = 'https://bitbucket.org/legion-io/legion-data'
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
+ spec.metadata['bug_tracker_uri'] = 'https://bitbucket.org/legion-io/legion-data/issues?status=new&status=open'
16
+ spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/legion-data/src/CHANGELOG.md'
17
+ spec.metadata['documentation_uri'] = 'https://bitbucket.org/legion-io/legion-data'
18
+ spec.metadata['homepage_uri'] = 'https://bitbucket.org/legion-io/legion-data'
19
+ spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/legion-data'
20
+ spec.metadata['wiki_uri'] = 'https://bitbucket.org/legion-io/legion-data/wiki/Home'
21
+
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
23
  f.match(%r{^(test|spec|features)/})
17
24
  end
18
- spec.bindir = 'exe'
25
+ spec.bindir = 'bin'
19
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
27
  spec.require_paths = ['lib']
21
28
 
22
29
  spec.add_development_dependency 'bundler'
23
- spec.add_development_dependency 'codecov', '~> 0'
24
- spec.add_development_dependency 'rake', '~> 10.0'
25
- spec.add_development_dependency 'rspec', '~> 3.0'
26
- spec.add_development_dependency 'rspec_junit_formatter', '~> 0'
27
- spec.add_development_dependency 'rubocop', '~> 0'
30
+ spec.add_development_dependency 'codecov'
31
+ spec.add_development_dependency 'rake'
32
+ spec.add_development_dependency 'rspec'
33
+ spec.add_development_dependency 'rspec_junit_formatter'
34
+ spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'rubocop-md'
36
+ spec.add_development_dependency 'rubocop-performance'
37
+ spec.add_development_dependency 'rubocop-rspec'
38
+ spec.add_development_dependency 'rubocop-sequel'
28
39
 
29
40
  spec.add_dependency 'legion-logging', '~>0.1'
30
41
  spec.add_dependency 'legion-settings', '~>0.1'
@@ -27,10 +27,10 @@ module Legion
27
27
 
28
28
  def debug_logging(enabled = true, connection = @connection, _options = {})
29
29
  if enabled
30
- connection.loggers = Legion::Logging
30
+ connection.logger = Legion::Logging
31
31
  connection.sql_log_level = :debug
32
32
  elsif enabled == false
33
- connection.loggers = nil
33
+ connection.logger = nil
34
34
  connection.sql_log_level = :debug
35
35
  end
36
36
  connection
@@ -9,7 +9,7 @@ module Legion
9
9
  host: '127.0.0.1',
10
10
  user: 'legion',
11
11
  password: 'legion',
12
- max_connections: 10,
12
+ max_connections: 100,
13
13
  database: 'legion'
14
14
  } } }
15
15
  end
@@ -16,12 +16,12 @@ module Legion
16
16
  Legion::Logging.debug("Running Legion::Data.migrate with path: #{path}")
17
17
  Sequel::Migrator.run(connection, path)
18
18
  Legion::Logging.info('Legion::Data finished migrations')
19
- rescue Sequel::Migrator::Error => ex
20
- Legion::Logging.error(ex.message)
21
- raise ex
22
- rescue StandardError => ex
23
- Legion::Logging.error(ex.message)
24
- raise ex unless Legion::Settings[:data][:migrations][:continue_on_fail]
19
+ rescue Sequel::Migrator::Error => e
20
+ Legion::Logging.error(e.message)
21
+ raise e
22
+ rescue StandardError => e
23
+ Legion::Logging.error(e.message)
24
+ raise e unless Legion::Settings[:data][:migrations][:continue_on_fail]
25
25
  end
26
26
  end
27
27
  end
@@ -26,9 +26,9 @@ module Legion
26
26
  require_relative "models/#{model}"
27
27
  @loaded_models << model
28
28
  Legion::Logging.debug("Successfully loaded #{model}")
29
- rescue LoadError => ex
29
+ rescue LoadError => e
30
30
  Legion::Logging.fatal("Failed to load #{model}")
31
- raise ex unless Legion::Settings[:data][:models][:continue_on_fail]
31
+ raise e unless Legion::Settings[:data][:models][:continue_on_fail]
32
32
  end
33
33
  end
34
34
  end
@@ -1,5 +1,5 @@
1
1
  module Legion
2
2
  module Data
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-27 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,70 +28,126 @@ dependencies:
28
28
  name: codecov
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec_junit_formatter
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-md
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-sequel
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
95
151
  - !ruby/object:Gem::Version
96
152
  version: '0'
97
153
  - !ruby/object:Gem::Dependency
@@ -161,6 +217,7 @@ files:
161
217
  - ".gitignore"
162
218
  - ".rspec"
163
219
  - ".rubocop.yml"
220
+ - CHANGELOG.md
164
221
  - Gemfile
165
222
  - README.md
166
223
  - Rakefile
@@ -206,7 +263,13 @@ files:
206
263
  - lib/legion/data/version.rb
207
264
  homepage: https://bitbucket.org/legion-io/legion-data
208
265
  licenses: []
209
- metadata: {}
266
+ metadata:
267
+ bug_tracker_uri: https://bitbucket.org/legion-io/legion-data/issues?status=new&status=open
268
+ changelog_uri: https://bitbucket.org/legion-io/legion-data/src/CHANGELOG.md
269
+ documentation_uri: https://bitbucket.org/legion-io/legion-data
270
+ homepage_uri: https://bitbucket.org/legion-io/legion-data
271
+ source_code_uri: https://bitbucket.org/legion-io/legion-data
272
+ wiki_uri: https://bitbucket.org/legion-io/legion-data/wiki/Home
210
273
  post_install_message:
211
274
  rdoc_options: []
212
275
  require_paths:
@@ -222,8 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
285
  - !ruby/object:Gem::Version
223
286
  version: '0'
224
287
  requirements: []
225
- rubyforge_project:
226
- rubygems_version: 2.7.8
288
+ rubygems_version: 3.0.3
227
289
  signing_key:
228
290
  specification_version: 4
229
291
  summary: Used by Legion to connect to the database