token_redis_session_store 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 548920c8657d860c135eb37f084c7ed6e2238bbd85b100f31715b54c284cc58d
4
+ data.tar.gz: cc3d80d49d57983bcc95bd0d02fae8a80621a28fbdac703668abd743ec4788a6
5
+ SHA512:
6
+ metadata.gz: 4b663af87b177f59d854ceb1c717480d7f8b4ec7098e9a7e3a42e2ba90f1f0aa2463898074236e269878b9faa61e162125ac676169218cfb9a456eff6a7afc5d
7
+ data.tar.gz: 311906f3fbc5387be78d1f8aebb3f9caf66d204b80c1cc57fd96199608e880b3ba935e7eb83ecea276f50d42c6f0c3e5c3e15fb86f5484848505a76301d337b4
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,68 @@
1
+ stages:
2
+ - build
3
+ - deploy
4
+
5
+ code_quality:
6
+ retry: 2
7
+ stage: build
8
+ image: docker:stable
9
+ variables:
10
+ DOCKER_DRIVER: overlay2
11
+ services:
12
+ - docker:stable-dind
13
+ script:
14
+ - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
15
+ - docker run
16
+ --env SOURCE_CODE="$PWD"
17
+ --volume "$PWD":/code
18
+ --volume /var/run/docker.sock:/var/run/docker.sock
19
+ "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
20
+ artifacts:
21
+ paths: [gl-code-quality-report.json]
22
+ expire_in: 3 weeks
23
+
24
+ rspec:
25
+ image: ruby:2.6.1
26
+ stage: build
27
+ variables:
28
+ RAILS_ENV: test
29
+ services:
30
+ - docker:dind
31
+ before_script:
32
+ - bundle install --quiet
33
+ script:
34
+ - bundle exec rspec
35
+ artifacts:
36
+ name: "$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA"
37
+ when: always
38
+ expire_in: 1 week
39
+ paths:
40
+ - coverage/
41
+
42
+ codequality-verify:
43
+ retry: 2
44
+ stage: deploy
45
+ allow_failure: true
46
+ image: ruby:2.5.1
47
+ script:
48
+ - ruby -r json -r yaml -e "puts JSON.parse(File.open('gl-code-quality-report.json', 'r', &:read)).to_yaml"
49
+ - "! grep fingerprint gl-code-quality-report.json > /dev/null 2>&1"
50
+
51
+ release:
52
+ stage: deploy
53
+ image: ruby:2.6.1
54
+ before_script:
55
+ - git config --global user.email dev@fullmeasureed.com
56
+ - git config --global user.name fme-ci
57
+ - git remote remove origin
58
+ - git remote add origin https://fme-ci:${GITLAB_CI_TOKEN}@gitlab.com/$CI_PROJECT_PATH.git
59
+ - git fetch origin master
60
+ - git checkout master
61
+ - git branch -u origin/master
62
+ - gem install gem-release -v 2.0.0.rc.3
63
+ script:
64
+ - "echo -e \"---\n:rubygems_api_key: ${RUBYGEMS_KEY}\" > ~/.gem/credentials"
65
+ - chmod 0600 ~/.gem/credentials
66
+ - gem bump patch --skip-ci --tag --push --release
67
+ only:
68
+ - /(^master$)/
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build token_redis_session_store-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install token_redis_session_store-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install token_redis_session_store-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push token_redis_session_store-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.1 [global]" project-jdk-type="RUBY_SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/token_redis_session_store.iml" filepath="$PROJECT_DIR$/.idea/token_redis_session_store.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,43 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="jdk" jdkName="RVM: ruby-2.6.1" jdkType="RUBY_SDK" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="actionpack (v5.2.3, RVM: ruby-2.6.1) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="actionview (v5.2.3, RVM: ruby-2.6.1) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.3, RVM: ruby-2.6.1) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, RVM: ruby-2.6.1) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, RVM: ruby-2.6.1) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.5, RVM: ruby-2.6.1) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.4, RVM: ruby-2.6.1) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.1) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.3.1, RVM: ruby-2.6.1) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="erubi (v1.8.0, RVM: ruby-2.6.1) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="fakeredis (v0.7.0, RVM: ruby-2.6.1) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.6.0, RVM: ruby-2.6.1) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.2.0, RVM: ruby-2.6.1) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="loofah (v2.2.3, RVM: ruby-2.6.1) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.4.0, RVM: ruby-2.6.1) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, RVM: ruby-2.6.1) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.3, RVM: ruby-2.6.1) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rack (v2.0.7, RVM: ruby-2.6.1) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, RVM: ruby-2.6.1) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.6.1) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.4, RVM: ruby-2.6.1) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.6.1) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="redis (v4.1.1, RVM: ruby-2.6.1) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, RVM: ruby-2.6.1) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, RVM: ruby-2.6.1) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.3, RVM: ruby-2.6.1) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, RVM: ruby-2.6.1) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, RVM: ruby-2.6.1) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.16.1, RVM: ruby-2.6.1) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.2, RVM: ruby-2.6.1) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.6.1) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, RVM: ruby-2.6.1) [gem]" level="application" />
42
+ </component>
43
+ </module>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PropertiesComponent">
4
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
5
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
6
+ </component>
7
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.1
7
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at enewbury94@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in token_redis_session_store.gemspec
6
+ gemspec
@@ -0,0 +1,91 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ token_redis_session_store (0.1.0)
5
+ actionpack (>= 3)
6
+ redis (>= 4.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (5.2.3)
12
+ actionview (= 5.2.3)
13
+ activesupport (= 5.2.3)
14
+ rack (~> 2.0)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (5.2.3)
19
+ activesupport (= 5.2.3)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
+ activesupport (5.2.3)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 0.7, < 2)
27
+ minitest (~> 5.1)
28
+ tzinfo (~> 1.1)
29
+ builder (3.2.3)
30
+ concurrent-ruby (1.1.5)
31
+ crass (1.0.4)
32
+ diff-lcs (1.3)
33
+ docile (1.3.1)
34
+ erubi (1.8.0)
35
+ fakeredis (0.7.0)
36
+ redis (>= 3.2, < 5.0)
37
+ i18n (1.6.0)
38
+ concurrent-ruby (~> 1.0)
39
+ json (2.2.0)
40
+ loofah (2.2.3)
41
+ crass (~> 1.0.2)
42
+ nokogiri (>= 1.5.9)
43
+ mini_portile2 (2.4.0)
44
+ minitest (5.11.3)
45
+ nokogiri (1.10.3)
46
+ mini_portile2 (~> 2.4.0)
47
+ rack (2.0.7)
48
+ rack-test (1.1.0)
49
+ rack (>= 1.0, < 3)
50
+ rails-dom-testing (2.0.3)
51
+ activesupport (>= 4.2.0)
52
+ nokogiri (>= 1.6)
53
+ rails-html-sanitizer (1.0.4)
54
+ loofah (~> 2.2, >= 2.2.2)
55
+ rake (10.5.0)
56
+ redis (4.1.1)
57
+ rspec (3.8.0)
58
+ rspec-core (~> 3.8.0)
59
+ rspec-expectations (~> 3.8.0)
60
+ rspec-mocks (~> 3.8.0)
61
+ rspec-core (3.8.0)
62
+ rspec-support (~> 3.8.0)
63
+ rspec-expectations (3.8.3)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.8.0)
66
+ rspec-mocks (3.8.0)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.8.0)
69
+ rspec-support (3.8.0)
70
+ simplecov (0.16.1)
71
+ docile (~> 1.1)
72
+ json (>= 1.8, < 3)
73
+ simplecov-html (~> 0.10.0)
74
+ simplecov-html (0.10.2)
75
+ thread_safe (0.3.6)
76
+ tzinfo (1.2.5)
77
+ thread_safe (~> 0.1)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ bundler (~> 1.17)
84
+ fakeredis (~> 0.5)
85
+ rake (~> 10.0)
86
+ rspec (~> 3.0)
87
+ simplecov (~> 0.11)
88
+ token_redis_session_store!
89
+
90
+ BUNDLED WITH
91
+ 1.17.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 enewbury
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # TokenRedisSessionStore
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/token_redis_session_store`. 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
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'token_redis_session_store'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install token_redis_session_store
22
+
23
+ ## Usage
24
+
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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/token_redis_session_store. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the TokenRedisSessionStore project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/token_redis_session_store/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "token_redis_session_store"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,56 @@
1
+ require 'redis'
2
+ require "token_redis_session_store/version"
3
+
4
+ module TokenRedisSessionStore
5
+ # Token Redis session storage that uses redis and
6
+ # passes the sessionid on an http header instead of cookie
7
+ class TokenRedisStore < ActionDispatch::Session::AbstractStore
8
+ def initialize(app, options = {})
9
+ redis_options = options[:redis] || {}
10
+ @session_header = options[:session_header] || 'Session-Id'
11
+ @redis = Redis.new(redis_options)
12
+ options[:defer] = true
13
+ super
14
+ end
15
+
16
+ # Get a session from the cache.
17
+ def find_session(_req, sid)
18
+ unless sid && (session = parse_session(sid))
19
+ sid = generate_sid
20
+ session = {}
21
+ end
22
+ [sid, session]
23
+ end
24
+
25
+ # Set a session in the cache.
26
+ def write_session(_req, sid, session, options)
27
+ unless session.nil?
28
+ if options[:expire_after].nil?
29
+ redis.set(sid, session.to_json)
30
+ else
31
+ redis.setex(sid, options[:expire_after], session.to_json)
32
+ end
33
+ end
34
+ sid
35
+ end
36
+
37
+ # Remove a session from the cache.
38
+ def delete_session(req, sid, _session)
39
+ req.delete_header "HTTP_#{@session_header.sub('-', '_').upcase}"
40
+ redis.del(sid)
41
+ generate_sid
42
+ end
43
+
44
+ private
45
+
46
+ attr_reader :redis
47
+
48
+ def extract_session_id(req)
49
+ req.get_header "HTTP_#{@session_header.sub('-', '_').upcase}"
50
+ end
51
+
52
+ def parse_session(sid)
53
+ (entry = redis.get(sid)) ? JSON.parse(entry) : nil
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module TokenRedisSessionStore
2
+ VERSION = "0.1.2"
3
+ end
@@ -0,0 +1,42 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "token_redis_session_store/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "token_redis_session_store"
8
+ spec.version = TokenRedisSessionStore::VERSION
9
+ spec.authors = ['enewbury']
10
+ spec.email = ['enewbury94@gmail.com']
11
+
12
+ spec.summary = 'A session store that uses session, json serialization, and gets session fullmeasure from an http header'
13
+ spec.homepage = 'https://gitlab.com/fullmeasure/public/gems/fullmeasure-session-session-store'
14
+ spec.license = 'MIT'
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["allowed_push_host"] = 'https://rubygems.org'
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency 'bundler', '~> 1.17'
35
+ spec.add_development_dependency 'fakeredis', '~> 0.5'
36
+ spec.add_development_dependency 'rake', '~> 10.0'
37
+ spec.add_development_dependency 'rspec', '~> 3.0'
38
+ spec.add_development_dependency 'simplecov', '~> 0.11'
39
+
40
+ spec.add_dependency 'actionpack', '>= 3'
41
+ spec.add_dependency 'redis', '>= 4.1'
42
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: token_redis_session_store
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - enewbury
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-05-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fakeredis
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.11'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: actionpack
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: redis
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '4.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '4.1'
111
+ description:
112
+ email:
113
+ - enewbury94@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".gitlab-ci.yml"
120
+ - ".idea/.rakeTasks"
121
+ - ".idea/encodings.xml"
122
+ - ".idea/misc.xml"
123
+ - ".idea/modules.xml"
124
+ - ".idea/token_redis_session_store.iml"
125
+ - ".idea/workspace.xml"
126
+ - ".rspec"
127
+ - ".travis.yml"
128
+ - CODE_OF_CONDUCT.md
129
+ - Gemfile
130
+ - Gemfile.lock
131
+ - LICENSE.txt
132
+ - README.md
133
+ - Rakefile
134
+ - bin/console
135
+ - bin/setup
136
+ - lib/token_redis_session_store.rb
137
+ - lib/token_redis_session_store/version.rb
138
+ - token_redis_session_store.gemspec
139
+ homepage: https://gitlab.com/fullmeasure/public/gems/fullmeasure-session-session-store
140
+ licenses:
141
+ - MIT
142
+ metadata:
143
+ allowed_push_host: https://rubygems.org
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubygems_version: 3.0.3
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: A session store that uses session, json serialization, and gets session fullmeasure
163
+ from an http header
164
+ test_files: []