kilroy 0.0.0 → 0.0.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: 80f407c1ed7ba767e4b36b67c89d4204683a574d38de8a7eb81411418af88f16
4
- data.tar.gz: 6a585bf645ced7f48df9131803341e637f08f5ccfc090c99e7410feee4cdd6f4
3
+ metadata.gz: 313ee563b7a15bbc83337607f21ffe55e4593ba3b35f5c862e8057d03bec1e15
4
+ data.tar.gz: 71bc5449f214371de5272ef23b36ec20703b681f93687d59817ed6115052688e
5
5
  SHA512:
6
- metadata.gz: 285128d1d17d83b8809ff610a3479ad5202c37a186b7dd1b2e8301804eb3fc5edd6db73ea05677e3c85f73e401d82449c59b18319d19740ab5edd9f0e1f2eebc
7
- data.tar.gz: dac3597c25baadf248e54569ad731211e0aa46d4bf1e1d28aab82f1921d78c0f155a1fe0f846498d0984b1930012121c1a37c1a3770ad230fa72221c7ee81792
6
+ metadata.gz: 05e3afde7bd5721105f963fb2deacbbd64cda2c38791fe2a1e4b8f8b27839e9d334eaa1abad00bf088c718793d007ec38e187d39b9a7fa88f012fa8f01fcbd3c
7
+ data.tar.gz: fdd98e9c4ba6e13c78bf85a02ee5ad0e3792c39426dd2091f03bcc712e877bbb8bfed806507c7ac9f7646785abcfaa1af9c1e8f291adb08e14a8820f003f3398
@@ -1,4 +1,6 @@
1
- require "kilroy/version"
1
+ require 'kilroy/version'
2
+ require 'kilroy/middleware/visitor'
3
+ require 'kilroy/railtie'
2
4
 
3
5
  module Kilroy
4
6
  # Your code goes here...
@@ -0,0 +1,15 @@
1
+ module Kilroy
2
+ module Middleware
3
+ class Visitor
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ request = ActionDispatch::Request.new(env)
10
+ request.cookie_jar.signed[:visitor_id] ||= SecureRandom.uuid
11
+ @app.call(env)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module Kilroy
2
+ class Railtie < Rails::Railtie
3
+ initializer 'kilroy.install_visitor_middleware' do |app|
4
+ app.middleware.use Middleware::Visitor
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Kilroy
2
- VERSION = "0.0.0".freeze
2
+ VERSION = '0.0.1'.freeze
3
3
  end
@@ -4,6 +4,6 @@ RSpec.describe Kilroy do
4
4
  end
5
5
 
6
6
  it "does something useful" do
7
- expect(false).to eq(true)
7
+ expect(subject).not_to be_nil
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kilroy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - smudge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-04 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -62,6 +62,8 @@ files:
62
62
  - README.md
63
63
  - Rakefile
64
64
  - lib/kilroy.rb
65
+ - lib/kilroy/middleware/visitor.rb
66
+ - lib/kilroy/railtie.rb
65
67
  - lib/kilroy/version.rb
66
68
  - spec/kilroy_spec.rb
67
69
  - spec/spec_helper.rb