show_your_cookies 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84464d6e4d728ac8a4e59d0ad90bf9f4b4ce12c4
4
+ data.tar.gz: 72ba8b496da18f12c4259ca656915cb0b4033652
5
+ SHA512:
6
+ metadata.gz: a0ef8880ce39d806e35b02a7e37dce3c17d0c91f35025da19c641aab63979a2b3223c3f446de4d049a0d8ac3f42710249c68fafd95e19e5346e6081b12f8ee0a
7
+ data.tar.gz: efdd2c455163a44ebfa2b37b54873e0b39f4387d2bb9a3a9df1fb0a1dfef1186739772fc6db13917bb69af1cec712de388d97fb031dd1f8b840e6c7b6b2eb0ed
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in show_your_cookies.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Hiroshi Yoshida
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.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # ShowYourCookies
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'show_your_cookies', group: :development
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ ## Usage
16
+
17
+ After install this gem, logging session like below.
18
+
19
+ ![](https://cloud.githubusercontent.com/assets/1663465/6933232/75dbbf30-d85f-11e4-92ce-c4149878df58.png)
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it ( https://github.com/hrysd/show_your_cookies/fork )
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
26
+ 4. Push to the branch (`git push origin my-new-feature`)
27
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "show_your_cookies"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,13 @@
1
+ module ShowYourCookies
2
+ module ActionController
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_filter :show_your_cookies
7
+ end
8
+
9
+ def show_your_cookies
10
+ ActiveSupport::Notifications.instrument 'cookies.show_your_cookies', cookies: session.to_hash
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ module ShowYourCookies
2
+ class LogSubscriber < ActiveSupport::LogSubscriber
3
+ def cookies(event)
4
+ return unless logger.debug?
5
+
6
+ payload = event.payload
7
+ name = "#{color('COOKIES:', YELLOW, true)}"
8
+
9
+ debug " #{name} #{payload[:cookies]}"
10
+ end
11
+
12
+ def logger
13
+ ShowYourCookies.logger
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ module ShowYourCookies
2
+ class Railtie < ::Rails::Railtie
3
+ initializer 'show_your_cookies.subscribe' do |_|
4
+ ShowYourCookies.attach_event
5
+ end
6
+
7
+ ActiveSupport.on_load(:action_controller) do
8
+ include ShowYourCookies::ActionController
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module ShowYourCookies
2
+ VERSION = '0.1.1'
3
+ end
@@ -0,0 +1,16 @@
1
+ require 'active_support'
2
+
3
+ require 'show_your_cookies/version'
4
+ require 'show_your_cookies/action_controller'
5
+ require 'show_your_cookies/log_subscriber'
6
+ require 'show_your_cookies/railtie'
7
+
8
+ module ShowYourCookies
9
+ mattr_accessor :logger
10
+
11
+ def self.attach_event
12
+ self.logger = Rails.logger
13
+
14
+ ShowYourCookies::LogSubscriber.attach_to 'show_your_cookies'
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'show_your_cookies/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'show_your_cookies'
8
+ spec.version = ShowYourCookies::VERSION
9
+ spec.authors = ['Hiroshi Yoshida']
10
+ spec.email = ['hrysd22@gmail.com']
11
+
12
+ spec.summary = %q{Show your cookies}
13
+ spec.description = %q{Show your cookies}
14
+ spec.homepage = 'https://github.com/hrysd/show_your_cookies'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ if spec.respond_to?(:metadata)
23
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
+ end
25
+
26
+ spec.add_dependency 'activesupport'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: show_your_cookies
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Hiroshi Yoshida
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
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
+ description: Show your cookies
56
+ email:
57
+ - hrysd22@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - lib/show_your_cookies.rb
72
+ - lib/show_your_cookies/action_controller.rb
73
+ - lib/show_your_cookies/log_subscriber.rb
74
+ - lib/show_your_cookies/railtie.rb
75
+ - lib/show_your_cookies/version.rb
76
+ - show_your_cookies.gemspec
77
+ homepage: https://github.com/hrysd/show_your_cookies
78
+ licenses:
79
+ - MIT
80
+ metadata:
81
+ allowed_push_host: https://rubygems.org
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.4.5
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Show your cookies
102
+ test_files: []