majoun 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +37 -0
- data/.rspec +4 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +17 -0
- data/CONTRIBUTING.md +11 -0
- data/Changelog.md +1 -0
- data/Gemfile +12 -0
- data/Gemfile.devtools +71 -0
- data/Guardfile +18 -0
- data/LICENSE +20 -0
- data/README.md +24 -0
- data/Rakefile +6 -0
- data/TODO.md +1 -0
- data/config/devtools.yml +2 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/reek.yml +110 -0
- data/config/rubocop.yml +78 -0
- data/config/yardstick.yml +2 -0
- data/lib/cookie.rb +89 -0
- data/lib/cookie/header.rb +70 -0
- data/lib/cookie/header/attribute.rb +172 -0
- data/lib/cookie/registry.rb +53 -0
- data/lib/cookie/version.rb +8 -0
- data/majoun.gemspec +25 -0
- data/spec/integration/public_api_spec.rb +186 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/unit/cookie/decrypt_spec.rb +19 -0
- data/spec/unit/cookie/encrypt_spec.rb +19 -0
- data/spec/unit/cookie/header/attribute/set/each_spec.rb +22 -0
- data/spec/unit/cookie/header/attribute/set/empty/merge_spec.rb +13 -0
- data/spec/unit/cookie/header/attribute/set/empty/to_s_spec.rb +11 -0
- data/spec/unit/cookie/version_spec.rb +7 -0
- metadata +149 -0
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## Rubinius
|
17
|
+
*.rbc
|
18
|
+
.rbx
|
19
|
+
|
20
|
+
## PROJECT::GENERAL
|
21
|
+
*.gem
|
22
|
+
coverage
|
23
|
+
profiling
|
24
|
+
turbulence
|
25
|
+
rdoc
|
26
|
+
pkg
|
27
|
+
tmp
|
28
|
+
doc
|
29
|
+
log
|
30
|
+
.yardoc
|
31
|
+
measurements
|
32
|
+
|
33
|
+
## BUNDLER
|
34
|
+
.bundle
|
35
|
+
Gemfile.lock
|
36
|
+
|
37
|
+
## PROJECT::SPECIFIC
|
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
cookie
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
before_install: gem install bundler
|
3
|
+
bundler_args: --without yard guard benchmarks
|
4
|
+
script: "bundle exec rake ci"
|
5
|
+
rvm:
|
6
|
+
- 1.9.3
|
7
|
+
- 2.0.0
|
8
|
+
- ruby-head
|
9
|
+
- rbx-19mode
|
10
|
+
matrix:
|
11
|
+
include:
|
12
|
+
- rvm: jruby-19mode
|
13
|
+
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
14
|
+
- rvm: jruby-head
|
15
|
+
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
16
|
+
allow_failures:
|
17
|
+
- rvm: ruby-head
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Contributing
|
2
|
+
------------
|
3
|
+
|
4
|
+
* If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it.
|
5
|
+
* Fork the project.
|
6
|
+
* Make your feature addition or bug fix.
|
7
|
+
* Follow this [style guide](https://github.com/dkubb/styleguide).
|
8
|
+
* Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
|
9
|
+
* Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
10
|
+
* Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
|
11
|
+
* Send me a pull request. Bonus points for topic branches.
|
data/Changelog.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# v0.0.1 (Not yet released)
|
data/Gemfile
ADDED
data/Gemfile.devtools
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
gem 'rake', '~> 10.2.1'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'rspec-core', '~> 2.14.8'
|
7
|
+
gem 'yard', '~> 0.8.7.4'
|
8
|
+
|
9
|
+
platform :rbx do
|
10
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
group :yard do
|
15
|
+
gem 'kramdown', '~> 1.3.3'
|
16
|
+
end
|
17
|
+
|
18
|
+
group :guard do
|
19
|
+
gem 'guard', '~> 2.6.0'
|
20
|
+
gem 'guard-bundler', '~> 2.0.0'
|
21
|
+
gem 'guard-rspec', '~> 4.2.8'
|
22
|
+
gem 'guard-rubocop', '~> 1.0.2'
|
23
|
+
|
24
|
+
# file system change event handling
|
25
|
+
gem 'listen', '~> 2.7.1'
|
26
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
27
|
+
gem 'rb-fsevent', '~> 0.9.4', require: false
|
28
|
+
gem 'rb-inotify', '~> 0.9.3', require: false
|
29
|
+
|
30
|
+
# notification handling
|
31
|
+
gem 'libnotify', '~> 0.8.2', require: false
|
32
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
33
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
34
|
+
end
|
35
|
+
|
36
|
+
group :metrics do
|
37
|
+
gem 'coveralls', '~> 0.7.0'
|
38
|
+
gem 'flay', '~> 2.4.0'
|
39
|
+
gem 'flog', '~> 4.2.0'
|
40
|
+
gem 'reek', '~> 1.3.7'
|
41
|
+
gem 'rubocop', '~> 0.19.1'
|
42
|
+
gem 'simplecov', '~> 0.8.2'
|
43
|
+
gem 'yardstick', '~> 0.9.9'
|
44
|
+
|
45
|
+
platforms :mri do
|
46
|
+
gem 'mutant', '~> 0.5.9'
|
47
|
+
gem 'mutant-rspec', '~> 0.5.3'
|
48
|
+
end
|
49
|
+
|
50
|
+
platforms :ruby_19, :ruby_20 do
|
51
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
52
|
+
end
|
53
|
+
|
54
|
+
platform :rbx do
|
55
|
+
gem 'json', '~> 1.8.1'
|
56
|
+
gem 'racc', '~> 1.4.11'
|
57
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
58
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
59
|
+
gem 'rubysl-prettyprint', '~> 2.0.3'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
group :benchmarks do
|
64
|
+
gem 'rbench', '~> 0.2.3'
|
65
|
+
end
|
66
|
+
|
67
|
+
platform :jruby do
|
68
|
+
group :jruby do
|
69
|
+
gem 'jruby-openssl', '~> 0.8.5'
|
70
|
+
end
|
71
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
guard :bundler do
|
4
|
+
watch('Gemfile')
|
5
|
+
end
|
6
|
+
|
7
|
+
guard :rspec, :all_on_start => false, :all_after_pass => false, :cli => '--fail-fast --seed 1' do
|
8
|
+
# run all specs if the spec_helper or supporting files files are modified
|
9
|
+
watch('spec/spec_helper.rb') { 'spec/unit' }
|
10
|
+
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec/unit' }
|
11
|
+
|
12
|
+
# run unit specs if associated lib code is modified
|
13
|
+
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
|
14
|
+
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec/unit' }
|
15
|
+
|
16
|
+
# run a spec if it is modified
|
17
|
+
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
18
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Martin Gamsjaeger (snusnu)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# majoun
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/cookie.png)][gem]
|
4
|
+
[![Build Status](https://secure.travis-ci.org/snusnu/cookie.png?branch=master)][travis]
|
5
|
+
[![Dependency Status](https://gemnasium.com/snusnu/cookie.png)][gemnasium]
|
6
|
+
[![Code Climate](https://codeclimate.com/github/snusnu/cookie.png)][codeclimate]
|
7
|
+
|
8
|
+
[gem]: https://rubygems.org/gems/cookie
|
9
|
+
[travis]: https://travis-ci.org/snusnu/cookie
|
10
|
+
[gemnasium]: https://gemnasium.com/snusnu/cookie
|
11
|
+
[codeclimate]: https://codeclimate.com/github/snusnu/cookie
|
12
|
+
|
13
|
+
## Credits
|
14
|
+
|
15
|
+
* [snusnu](https://github.com/snusnu)
|
16
|
+
* [mbj](https://github.com/mbj)
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
21
|
+
|
22
|
+
## Copyright
|
23
|
+
|
24
|
+
Copyright © 2013 Martin Gamsjaeger (snusnu). See [LICENSE](LICENSE) for details.
|
data/Rakefile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*
|
data/config/devtools.yml
ADDED
data/config/flay.yml
ADDED
data/config/flog.yml
ADDED
data/config/mutant.yml
ADDED
data/config/reek.yml
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
Attribute:
|
3
|
+
enabled: false
|
4
|
+
exclude: []
|
5
|
+
BooleanParameter:
|
6
|
+
enabled: true
|
7
|
+
exclude: []
|
8
|
+
ClassVariable:
|
9
|
+
enabled: true
|
10
|
+
exclude: []
|
11
|
+
ControlParameter:
|
12
|
+
enabled: true
|
13
|
+
exclude:
|
14
|
+
- Cookie::Header::Attribute::Unary#self.build # factory interface
|
15
|
+
DataClump:
|
16
|
+
enabled: true
|
17
|
+
exclude: []
|
18
|
+
max_copies: 2
|
19
|
+
min_clump_size: 2
|
20
|
+
DuplicateMethodCall:
|
21
|
+
enabled: true
|
22
|
+
exclude: []
|
23
|
+
max_calls: 1
|
24
|
+
allow_calls: []
|
25
|
+
FeatureEnvy:
|
26
|
+
enabled: true
|
27
|
+
exclude:
|
28
|
+
- Cookie::Header::Delete#initialize # FIXME refactor
|
29
|
+
IrresponsibleModule:
|
30
|
+
enabled: true
|
31
|
+
exclude: []
|
32
|
+
LongParameterList:
|
33
|
+
enabled: true
|
34
|
+
exclude:
|
35
|
+
- Cookie::Header#self.build
|
36
|
+
max_params: 2
|
37
|
+
overrides:
|
38
|
+
initialize:
|
39
|
+
max_params: 2
|
40
|
+
LongYieldList:
|
41
|
+
enabled: true
|
42
|
+
exclude: []
|
43
|
+
max_params: 2
|
44
|
+
NestedIterators:
|
45
|
+
enabled: true
|
46
|
+
exclude: []
|
47
|
+
max_allowed_nesting: 1
|
48
|
+
ignore_iterators: []
|
49
|
+
NilCheck:
|
50
|
+
enabled: true
|
51
|
+
exclude: []
|
52
|
+
RepeatedConditional:
|
53
|
+
enabled: true
|
54
|
+
exclude: []
|
55
|
+
max_ifs: 1
|
56
|
+
TooManyInstanceVariables:
|
57
|
+
enabled: true
|
58
|
+
exclude: []
|
59
|
+
max_instance_variables: 2
|
60
|
+
TooManyMethods:
|
61
|
+
enabled: true
|
62
|
+
exclude:
|
63
|
+
- Cookie::Header
|
64
|
+
max_methods: 10
|
65
|
+
TooManyStatements:
|
66
|
+
enabled: true
|
67
|
+
exclude:
|
68
|
+
- each
|
69
|
+
- Cookie::Registry#self.cookie_hash
|
70
|
+
- Cookie::Header::Attribute::Set#self.coerce
|
71
|
+
max_statements: 2
|
72
|
+
UncommunicativeMethodName:
|
73
|
+
enabled: true
|
74
|
+
exclude: []
|
75
|
+
reject:
|
76
|
+
- !ruby/regexp /^[a-z]$/
|
77
|
+
- !ruby/regexp /[0-9]$/
|
78
|
+
- !ruby/regexp /[A-Z]/
|
79
|
+
accept: []
|
80
|
+
UncommunicativeModuleName:
|
81
|
+
enabled: true
|
82
|
+
exclude: []
|
83
|
+
reject:
|
84
|
+
- !ruby/regexp /^.$/
|
85
|
+
- !ruby/regexp /[0-9]$/
|
86
|
+
accept: []
|
87
|
+
UncommunicativeParameterName:
|
88
|
+
enabled: true
|
89
|
+
exclude: []
|
90
|
+
reject:
|
91
|
+
- !ruby/regexp /^.$/
|
92
|
+
- !ruby/regexp /[0-9]$/
|
93
|
+
- !ruby/regexp /[A-Z]/
|
94
|
+
accept: []
|
95
|
+
UncommunicativeVariableName:
|
96
|
+
enabled: true
|
97
|
+
exclude: []
|
98
|
+
reject:
|
99
|
+
- !ruby/regexp /^.$/
|
100
|
+
- !ruby/regexp /[0-9]$/
|
101
|
+
- !ruby/regexp /[A-Z]/
|
102
|
+
accept: []
|
103
|
+
UnusedParameters:
|
104
|
+
enabled: true
|
105
|
+
exclude: []
|
106
|
+
UtilityFunction:
|
107
|
+
enabled: true
|
108
|
+
exclude:
|
109
|
+
- Cookie::Header::Delete#initialize # FIXME refactor
|
110
|
+
max_helper_calls: 0
|
data/config/rubocop.yml
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
AllCops:
|
2
|
+
Includes:
|
3
|
+
- '**/*.rake'
|
4
|
+
- 'Gemfile'
|
5
|
+
- 'Gemfile.devtools'
|
6
|
+
Excludes:
|
7
|
+
- '**/vendor/**'
|
8
|
+
- '**/benchmarks/**'
|
9
|
+
|
10
|
+
# Avoid parameter lists longer than five parameters.
|
11
|
+
ParameterLists:
|
12
|
+
Max: 3
|
13
|
+
CountKeywordArgs: true
|
14
|
+
|
15
|
+
# Avoid more than `Max` levels of nesting.
|
16
|
+
BlockNesting:
|
17
|
+
Max: 3
|
18
|
+
|
19
|
+
# Align with the style guide.
|
20
|
+
CollectionMethods:
|
21
|
+
PreferredMethods:
|
22
|
+
collect: 'map'
|
23
|
+
inject: 'reduce'
|
24
|
+
find: 'detect'
|
25
|
+
find_all: 'select'
|
26
|
+
|
27
|
+
# Do not force public/protected/private keyword to be indented at the same
|
28
|
+
# level as the def keyword. My personal preference is to outdent these keywords
|
29
|
+
# because I think when scanning code it makes it easier to identify the
|
30
|
+
# sections of code and visually separate them. When the keyword is at the same
|
31
|
+
# level I think it sort of blends in with the def keywords and makes it harder
|
32
|
+
# to scan the code and see where the sections are.
|
33
|
+
AccessControl:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# Limit line length
|
37
|
+
LineLength:
|
38
|
+
Max: 141 # only specs violate 79
|
39
|
+
|
40
|
+
# Disable documentation checking until a class needs to be documented once
|
41
|
+
Documentation:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
# Do not favor modifier if/unless usage when you have a single-line body
|
45
|
+
IfUnlessModifier:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
# Allow case equality operator (in limited use within the specs)
|
49
|
+
CaseEquality:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
# Constants do not always have to use SCREAMING_SNAKE_CASE
|
53
|
+
ConstantName:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
# Not all trivial readers/writers can be defined with attr_* methods
|
57
|
+
TrivialAccessors:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
# Do not prefer do/end over {} for multiline blocks
|
61
|
+
Blocks:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
# Do not favor aligned parameters in method calls
|
65
|
+
AlignParameters:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
HashSyntax:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
SpaceInsideBrackets:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Lambda:
|
75
|
+
Enabled: false # i personally like the look of multiline ->(arg) {} lambdas
|
76
|
+
|
77
|
+
AndOr:
|
78
|
+
Enabled: false # we agree to use and/or for control flow
|