response 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 2df2679f6688ba11f2c48d6ea83f4aa844b74509
4
- data.tar.gz: 12a33786958b3267a207a2c48bd24da61297f945
3
+ metadata.gz: 594421f32ae4ecca4902485826463b93f0b60ee0
4
+ data.tar.gz: aa5481f15f6443f0ef5cfc88851b1d3a88d4cf82
5
5
  SHA512:
6
- metadata.gz: d760eb7961469ba60a98339c61286445706ecb0c62f5919b66c9232176eadc11a6a0a88835bed905083c1f90f66a256fc510d2a098def75ac77219f4a763ac67
7
- data.tar.gz: 086b4bf3bc5239e7f6639af630258592a44ba871f49c466d68c2d3e9b0be036f82dac5ef84d8737621b41510db27a5f98ef3dab372cb3a997e0a5bf25dbccda5
6
+ metadata.gz: df0fdb98b71b167c8763391bca7161b51ad25ebd5aec93dd37da2eca5661099695fcf7f0ae949a99da34690a32a55d544242af1e71a1f416359a86c27c44b45e
7
+ data.tar.gz: f1dd2fd0a82f1224be814e7353d2b1b5b364b5fdaf701637bffebb15017653b73b2602554a2cd1d6d2835d2722008b2111c54927d15b75808500020e263bb052
@@ -0,0 +1,7 @@
1
+ AllCops:
2
+ Include:
3
+ - 'Gemfile'
4
+ Exclude:
5
+ - 'Gemfile.devtools'
6
+ - 'vendor/**'
7
+ - 'benchmarks/**'
@@ -4,9 +4,8 @@ script: bundle exec rake ci
4
4
  rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
- - rbx-19mode
7
+ - 2.1.2
8
+ - rbx-2
8
9
  - jruby-19mode
9
- - jruby-head
10
10
  matrix:
11
- allow_failures:
12
- rvm: ruby-head
11
+ allow_failures: rbx-2
data/Gemfile CHANGED
@@ -2,5 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'devtools', :git => 'https://github.com/rom-rb/devtools.git'
6
- eval File.read('Gemfile.devtools')
5
+ gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
6
+ eval_gemfile 'Gemfile.devtools'
@@ -1,47 +1,63 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.1.0'
5
- gem 'rspec', '~> 2.14.1'
6
- gem 'yard', '~> 0.8.7'
4
+ gem 'rake', '~> 10.3.2'
5
+ gem 'rspec', '~> 3.0.0'
6
+ gem 'rspec-its', '~> 1.0.1'
7
+ gem 'yard', '~> 0.8.7.4'
8
+
9
+ platform :rbx do
10
+ gem 'rubysl-singleton', '~> 2.0.0'
11
+ end
7
12
  end
8
13
 
9
14
  group :yard do
10
- gem 'kramdown', '~> 1.2.0'
15
+ gem 'kramdown', '~> 1.3.3'
11
16
  end
12
17
 
13
18
  group :guard do
14
- gem 'guard', '~> 1.8.1'
15
- gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 3.0.2'
17
- gem 'guard-rubocop', '~> 0.2.0'
18
- gem 'guard-mutant', '~> 0.0.1'
19
+ gem 'guard', '~> 2.6.1'
20
+ gem 'guard-bundler', '~> 2.0.0'
21
+ gem 'guard-rspec', '~> 4.2.9'
22
+ gem 'guard-rubocop', '~> 1.1.0'
19
23
 
20
24
  # file system change event handling
21
- gem 'listen', '~> 1.3.0'
25
+ gem 'listen', '~> 2.7.7'
22
26
  gem 'rb-fchange', '~> 0.0.6', require: false
23
- gem 'rb-fsevent', '~> 0.9.3', require: false
24
- gem 'rb-inotify', '~> 0.9.0', require: false
27
+ gem 'rb-fsevent', '~> 0.9.4', require: false
28
+ gem 'rb-inotify', '~> 0.9.5', require: false
25
29
 
26
30
  # notification handling
27
- gem 'libnotify', '~> 0.8.0', require: false
31
+ gem 'libnotify', '~> 0.8.3', require: false
28
32
  gem 'rb-notifu', '~> 0.0.4', require: false
29
33
  gem 'terminal-notifier-guard', '~> 1.5.3', require: false
30
34
  end
31
35
 
32
36
  group :metrics do
33
- gem 'coveralls', '~> 0.6.7'
34
- gem 'flay', '~> 2.4.0'
35
- gem 'flog', '~> 4.1.1'
36
- gem 'reek', '~> 1.3.2'
37
- gem 'rubocop', '~> 0.13.0'
37
+ gem 'coveralls', '~> 0.7.0'
38
+ gem 'flay', '~> 2.5.0'
39
+ gem 'flog', '~> 4.2.1'
40
+ gem 'reek', '~> 1.3.7'
41
+ gem 'rubocop', '~> 0.23.0'
38
42
  gem 'simplecov', '~> 0.7.1'
39
- gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
43
+ gem 'yardstick', '~> 0.9.9'
44
+
45
+ platforms :mri do
46
+ gem 'mutant', '~> 0.6.0'
47
+ gem 'mutant-rspec', '~> 0.6.0'
48
+ end
40
49
 
41
50
  platforms :ruby_19, :ruby_20 do
42
- gem 'mutant', git: 'https://github.com/mbj/mutant.git'
43
51
  gem 'yard-spellcheck', '~> 0.1.5'
44
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
45
61
  end
46
62
 
47
63
  group :benchmarks do
@@ -50,6 +66,6 @@ end
50
66
 
51
67
  platform :jruby do
52
68
  group :jruby do
53
- gem 'jruby-openssl', '~> 0.8.5'
69
+ gem 'jruby-openssl', '~> 0.9.4'
54
70
  end
55
71
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Markus Schirp
1
+ Copyright (c) 2014 Markus Schirp
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,6 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.0.0
4
+ test:
5
+ override:
6
+ - bundle exec rake ci
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 16
3
- total_score: 40
3
+ total_score: 46
@@ -0,0 +1,82 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ AllCops:
4
+ Include:
5
+ - '**/*.rake'
6
+ - 'Gemfile'
7
+ - 'Gemfile.triage'
8
+
9
+ # Avoid parameter lists longer than five parameters.
10
+ ParameterLists:
11
+ Max: 3
12
+ CountKeywordArgs: true
13
+
14
+ MethodLength:
15
+ CountComments: false
16
+ Max: 15
17
+
18
+ # Avoid more than `Max` levels of nesting.
19
+ BlockNesting:
20
+ Max: 3
21
+
22
+ # Align with the style guide.
23
+ CollectionMethods:
24
+ PreferredMethods:
25
+ collect: 'map'
26
+ inject: 'reduce'
27
+ find: 'detect'
28
+ find_all: 'select'
29
+
30
+ # Limit line length
31
+ LineLength:
32
+ Max: 113 # TODO: lower to 79 once the rubocop branch in shared/Gemfile is removed
33
+
34
+ ClassLength:
35
+ Max: 204
36
+
37
+ # Disabled because of indenting with private keyword in class bodies.
38
+ IndentationWidth:
39
+ Enabled: false
40
+
41
+ # I like raise more
42
+ SignalException:
43
+ Enabled: false
44
+
45
+ # False positive in unparser source
46
+ OneLineConditional:
47
+ Enabled: false
48
+
49
+ Documentation:
50
+ Enabled: false
51
+
52
+ # Disable documentation checking until a class needs to be documented once
53
+ Documentation:
54
+ Enabled: false
55
+
56
+ # Do not favor modifier if/unless usage when you have a single-line body
57
+ IfUnlessModifier:
58
+ Enabled: false
59
+
60
+ # Allow case equality operator (in limited use within the specs)
61
+ CaseEquality:
62
+ Enabled: false
63
+
64
+ # Constants do not always have to use SCREAMING_SNAKE_CASE
65
+ ConstantName:
66
+ Enabled: false
67
+
68
+ # Not all trivial readers/writers can be defined with attr_* methods
69
+ TrivialAccessors:
70
+ Enabled: false
71
+
72
+ # Do not prefer do/end over {} for multiline blocks
73
+ Blocks:
74
+ Enabled: false
75
+
76
+ # I like to have an empty line before closing the currently opened body
77
+ EmptyLinesAroundBody:
78
+ Enabled: false
79
+
80
+ # I like my style more
81
+ AccessModifierIndentation:
82
+ Enabled: false
@@ -1,4 +1,4 @@
1
- #encoding: utf-8
1
+ # encoding: utf-8
2
2
 
3
3
  require 'time'
4
4
  require 'ice_nine'
@@ -120,7 +120,7 @@ class Response
120
120
 
121
121
  # Return response with merged headers
122
122
  #
123
- # @param [Hash] headers
123
+ # @param [Hash] new_headers
124
124
  # the headers to merge
125
125
  #
126
126
  # @example
@@ -134,8 +134,8 @@ class Response
134
134
  # @return [Response]
135
135
  # returns new response with merged header
136
136
  #
137
- def merge_headers(headers)
138
- self.class.new(status, self.headers.merge(headers), body)
137
+ def merge_headers(new_headers)
138
+ self.class.new(status, headers.merge(new_headers), body)
139
139
  end
140
140
 
141
141
  # Return rack compatible array after asserting response is valid
@@ -261,9 +261,7 @@ private
261
261
  # @api private
262
262
  #
263
263
  def assert_valid
264
- unless valid?
265
- raise InvalidError, "Not a valid response: #{inspect}"
266
- end
264
+ raise InvalidError, "Not a valid response: #{inspect}" unless valid?
267
265
  end
268
266
  end
269
267
 
@@ -35,7 +35,14 @@ class Response
35
35
  # @api public
36
36
  #
37
37
  def self.build(location)
38
- super(self::STATUS, {'Location' => location, 'Content-Type' => TEXT_PLAIN}, "You are beeing redirected to: #{location}")
38
+ super(
39
+ self::STATUS,
40
+ {
41
+ 'Location' => location,
42
+ 'Content-Type' => TEXT_PLAIN
43
+ },
44
+ "You are beeing redirected to: #{location}"
45
+ )
39
46
  end
40
47
 
41
48
  # Response with default status code of 302
@@ -5,15 +5,15 @@ class Response
5
5
 
6
6
  private_class_method :new
7
7
 
8
- OK = new(200, 'OK' )
9
- CREATED = new(201, 'Created' )
10
- NOT_FOUND = new(404, 'Not Found' )
11
- NOT_MODIFIED = new(304, 'Not Modified' )
12
- FOUND = new(302, 'Found' )
13
- MOVED_PERMANENTLY = new(301, 'Moved Permanently' )
14
- BAD_REQUEST = new(400, 'Bad Request' )
15
- NOT_AUTHORIZED = new(401, 'Not Authorized' )
16
- FORBIDDEN = new(403, 'Forbidden' )
8
+ OK = new(200, 'OK')
9
+ CREATED = new(201, 'Created')
10
+ NOT_FOUND = new(404, 'Not Found')
11
+ NOT_MODIFIED = new(304, 'Not Modified')
12
+ FOUND = new(302, 'Found')
13
+ MOVED_PERMANENTLY = new(301, 'Moved Permanently')
14
+ BAD_REQUEST = new(400, 'Bad Request')
15
+ NOT_AUTHORIZED = new(401, 'Not Authorized')
16
+ FORBIDDEN = new(403, 'Forbidden')
17
17
  INTERNAL_SERVER_ERROR = new(500, 'Internal Server Error')
18
18
 
19
19
  # Return status code
@@ -2,20 +2,21 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'response'
5
- gem.version = '0.0.4'
5
+ gem.version = '0.0.5'
6
6
  gem.authors = [ 'Markus Schirp' ]
7
7
  gem.email = [ 'mbj@schir-dso.com' ]
8
8
  gem.description = 'Build rack responses with functional style'
9
9
  gem.summary = gem.description
10
10
  gem.homepage = 'https://github.com/mbj/response'
11
+ gem.license = 'MIT'
11
12
 
12
13
  gem.require_paths = [ 'lib' ]
13
14
  gem.files = `git ls-files`.split("\n")
14
15
  gem.test_files = `git ls-files -- {spec}/*`.split("\n")
15
16
  gem.extra_rdoc_files = %w[LICENSE README.md TODO]
16
17
 
17
- gem.add_dependency('ice_nine', '~> 0.9.0')
18
- gem.add_dependency('adamantium', '~> 0.1.0')
18
+ gem.add_dependency('ice_nine', '~> 0.11.0')
19
+ gem.add_dependency('adamantium', '~> 0.2.0')
19
20
  gem.add_dependency('equalizer', '~> 0.0.7')
20
21
  gem.add_dependency('abstract_type', '~> 0.0.6')
21
22
  gem.add_dependency('concord', '~> 0.1.4')
@@ -3,6 +3,3 @@
3
3
  require 'response'
4
4
  require 'devtools'
5
5
  Devtools.init_spec_helper
6
-
7
- RSpec.configure do |config|
8
- end
@@ -17,7 +17,13 @@ describe Response, '.build' do
17
17
  context 'with block' do
18
18
  let(:yields) { [] }
19
19
  let(:value) { double('Value') }
20
- let(:block) { lambda { |response| yields << response; value } }
20
+
21
+ let(:block) do
22
+ lambda do |response|
23
+ yields << response
24
+ value
25
+ end
26
+ end
21
27
 
22
28
  it 'should return value from block' do
23
29
  should be(value)
@@ -23,4 +23,3 @@ describe Response, '#content_type' do
23
23
  it_should_behave_like 'an idempotent method'
24
24
  end
25
25
  end
26
-
@@ -17,4 +17,3 @@ describe Response, '#merge_headers' do
17
17
 
18
18
  it_should_behave_like 'a functional command method'
19
19
  end
20
-
@@ -6,7 +6,7 @@ describe Response::Redirect::Found, '#build' do
6
6
 
7
7
  let(:object) { described_class }
8
8
 
9
- let(:location) { double('Location', :to_s => 'THE-LOCATION') }
9
+ let(:location) { double('Location', to_s: 'THE-LOCATION') }
10
10
 
11
11
  its(:status) { should be(Response::Status::FOUND) }
12
12
  its(:headers) { should eql('Location' => location, 'Content-Type' => 'text/plain; charset=UTF-8') }
@@ -19,10 +19,9 @@ describe Response::Redirect::Permanent, '#build' do
19
19
 
20
20
  let(:object) { described_class }
21
21
 
22
- let(:location) { double('Location', :to_s => 'THE-LOCATION') }
22
+ let(:location) { double('Location', to_s: 'THE-LOCATION') }
23
23
 
24
24
  its(:status) { should be(Response::Status::MOVED_PERMANENTLY) }
25
25
  its(:headers) { should eql('Location' => location, 'Content-Type' => 'text/plain; charset=UTF-8') }
26
26
  its(:body) { should eql('You are beeing redirected to: THE-LOCATION') }
27
27
  end
28
-
@@ -27,6 +27,14 @@ describe Response, '#valid?' do
27
27
  it_should_behave_like 'an idempotent method'
28
28
  end
29
29
 
30
+ context 'without headers' do
31
+ let(:object) { described_class.build(Response::Status::OK, Response::Undefined, double('Body')) }
32
+
33
+ it { should be(false) }
34
+
35
+ it_should_behave_like 'an idempotent method'
36
+ end
37
+
30
38
  context 'without status and body' do
31
39
  let(:object) { described_class.build }
32
40
 
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: response
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-15 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ice_nine
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.0
19
+ version: 0.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.0
26
+ version: 0.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: adamantium
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.0
33
+ version: 0.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.0
40
+ version: 0.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: equalizer
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.0.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.0.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: abstract_type
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.0.6
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.0.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: concord
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.1.4
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.1.4
83
83
  description: Build rack responses with functional style
@@ -90,9 +90,10 @@ extra_rdoc_files:
90
90
  - README.md
91
91
  - TODO
92
92
  files:
93
- - .gitignore
94
- - .rspec
95
- - .travis.yml
93
+ - ".gitignore"
94
+ - ".rspec"
95
+ - ".rubocop.yml"
96
+ - ".travis.yml"
96
97
  - Changelog.md
97
98
  - Gemfile
98
99
  - Gemfile.devtools
@@ -101,12 +102,14 @@ files:
101
102
  - README.md
102
103
  - Rakefile
103
104
  - TODO
105
+ - circle.yml
104
106
  - config/devtools.yml
105
107
  - config/flay.yml
106
108
  - config/flog.yml
107
109
  - config/mutant.yml
108
110
  - config/reek.yml
109
111
  - config/roodi.yml
112
+ - config/rubocop.yml
110
113
  - config/yardstick.yml
111
114
  - lib/response.rb
112
115
  - lib/response/html.rb
@@ -139,7 +142,8 @@ files:
139
142
  - spec/unit/response/with_status_spec.rb
140
143
  - spec/unit/response/xml/class_methods/build_spec.rb
141
144
  homepage: https://github.com/mbj/response
142
- licenses: []
145
+ licenses:
146
+ - MIT
143
147
  metadata: {}
144
148
  post_install_message:
145
149
  rdoc_options: []
@@ -147,17 +151,17 @@ require_paths:
147
151
  - lib
148
152
  required_ruby_version: !ruby/object:Gem::Requirement
149
153
  requirements:
150
- - - '>='
154
+ - - ">="
151
155
  - !ruby/object:Gem::Version
152
156
  version: '0'
153
157
  required_rubygems_version: !ruby/object:Gem::Requirement
154
158
  requirements:
155
- - - '>='
159
+ - - ">="
156
160
  - !ruby/object:Gem::Version
157
161
  version: '0'
158
162
  requirements: []
159
163
  rubyforge_project:
160
- rubygems_version: 2.0.2
164
+ rubygems_version: 2.2.2
161
165
  signing_key:
162
166
  specification_version: 4
163
167
  summary: Build rack responses with functional style