keycard 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
- SHA1:
3
- metadata.gz: f5d7f477660b581edd56242cba917ceac9a92c56
4
- data.tar.gz: 64257be7f76d1497ca3f8397e18e6c56d7e49269
2
+ SHA256:
3
+ metadata.gz: 04e5999db1a74c237714b9c8afae5bca2ac11c0c33bc8d56c174967082331ee7
4
+ data.tar.gz: db2486afcc74b2777fb74f0ce02fd6f6c3499c69823d39af9db7bd4403d31bb7
5
5
  SHA512:
6
- metadata.gz: 6105dc8009f59f487d8f463d97325ef021f2f922ada9d912cdf6b83d193efe1c9d7cbf86af1c9c0fb3c3959b50dda8ef73dcb55162e61e7b41a091f08f1ff0e7
7
- data.tar.gz: c55623373226fffa991ac9ef370a71085ca2da258080ab3ea6046788ebc9f691eaac5bd1bed5c2029ab6ea8131f608981ef9a9e8c781ca20a643824bf260e73d
6
+ metadata.gz: 671cff5c7be3e97ff2b4325ff94786f3dbb3d82ffb03e5efd015bf95a8e73a1d9c92a34ca47aa8c2eaf124bea691d0560f765ee854db4fa2e5127b3e4484f160
7
+ data.tar.gz: 7ebe3ac9d5019acd351fc63f430e65c52e7d711db036713db96fc9be5b8c962013d7808bb4f3f5c1993b7f2526ad95719ab3733b628abf9c33b2d6ede48f8fdc
data/Rakefile CHANGED
@@ -5,4 +5,6 @@ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
+ load 'lib/tasks/migrate.rake'
9
+
8
10
  task default: :spec
data/keycard.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "bundler", "~> 1.16"
32
32
  spec.add_development_dependency "coveralls", "~> 0.8"
33
33
  spec.add_development_dependency "pry"
34
- spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rake", "~> 12.0"
35
35
  spec.add_development_dependency "rspec", "~> 3.0"
36
36
  spec.add_development_dependency "rubocop", "~> 0.52"
37
37
  spec.add_development_dependency "rubocop-rails", "~> 1.1"
data/lib/keycard/db.rb CHANGED
@@ -83,8 +83,10 @@ module Keycard
83
83
  # This will connect with the current config if not already conencted.
84
84
  def migrate!
85
85
  connect! unless connected?
86
- Sequel.extension :migration
87
- Sequel::Migrator.run(db, File.join(__dir__, '../../db/migrations'), table: schema_table)
86
+ unless config.readonly
87
+ Sequel.extension :migration
88
+ Sequel::Migrator.run(db, File.join(__dir__, '../../db/migrations'), table: schema_table)
89
+ end
88
90
  end
89
91
 
90
92
  def schema_table
@@ -134,7 +136,8 @@ module Keycard
134
136
 
135
137
  def config
136
138
  @config ||= OpenStruct.new(
137
- url: ENV['KEYCARD_DATABASE_URL'] || ENV['DATABASE_URL']
139
+ url: ENV['KEYCARD_DATABASE_URL'] || ENV['DATABASE_URL'],
140
+ readonly: false
138
141
  )
139
142
  end
140
143
 
@@ -26,7 +26,7 @@ module Keycard
26
26
  end
27
27
 
28
28
  def attributes_for(request)
29
- return {} unless (numeric_ip = numeric_ip(client_ip(request)))
29
+ return {} unless (numeric_ip = numeric_ip(request.remote_ip))
30
30
 
31
31
  insts = insts_for_ip(numeric_ip)
32
32
 
@@ -54,9 +54,5 @@ module Keycard
54
54
  nil
55
55
  end
56
56
  end
57
-
58
- def client_ip(request)
59
- request.get_header('X-Forwarded-For')
60
- end
61
57
  end
62
58
  end
@@ -82,14 +82,7 @@ module Keycard
82
82
  Railtie.after_blocks.each do |block|
83
83
  block.call(config.to_h)
84
84
  end
85
- end
86
85
 
87
- # This runs before any block registered under a `config.to_prepare`, which
88
- # could be in plugins or initializers that want to use a fully configured
89
- # Keycard instance. The `to_prepare` hook is run once at the start of a
90
- # production instance and for every request in development (unless caching
91
- # is turned on so there is no reloading).
92
- initializer "keycard.ready", after: :finisher_hook do
93
86
  Keycard::DB.initialize! unless Railtie.under_rake?
94
87
 
95
88
  Railtie.ready_blocks.each do |block|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Keycard
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycard
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
  - Noah Botimer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-03-06 00:00:00.000000000 Z
12
+ date: 2018-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mysql2
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '10.0'
90
+ version: '12.0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '10.0'
97
+ version: '12.0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rspec
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  version: '0'
228
228
  requirements: []
229
229
  rubyforge_project:
230
- rubygems_version: 2.6.13
230
+ rubygems_version: 2.7.3
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: Keycard provides authentication support and user/request information, especially