stitches 3.8.0 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +30 -30
- data/Gemfile.rails-5.1 +1 -2
- data/Gemfile.rails-5.2 +1 -2
- data/Gemfile.rails-6.0 +7 -0
- data/lib/stitches/api_key.rb +12 -1
- data/lib/stitches/generator_files/spec/features/api_spec.rb.erb +10 -2
- data/lib/stitches/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac1389298b9ccff356bb73c3e925501265eddb4d68932ac7bc6e41ab35535353
|
4
|
+
data.tar.gz: c800e4a091a67181e065cb0d42c45a7a730b710ce4a83fb513b6606ea7e6e47d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 439faf8691f51448dad6b45b35c77a63e5b31075181a55e6fe03ec1381bfe91841cc2a73172390d6e32b5f1f38f7fd3ea069b15c98d8086f4fd21b1c0842b241
|
7
|
+
data.tar.gz: 8c435dc519da97c5cc3aec267dffcb0ffb96e2479b98c14ac44217b5dd4de50afdd818c18063f7d126e7cb56a97f197bd592235591fe9e982243f12314b633d0
|
data/.circleci/config.yml
CHANGED
@@ -5,7 +5,7 @@ version: 2
|
|
5
5
|
jobs:
|
6
6
|
release:
|
7
7
|
docker:
|
8
|
-
- image: circleci/ruby:2.6.
|
8
|
+
- image: circleci/ruby:2.6.4
|
9
9
|
steps:
|
10
10
|
- checkout
|
11
11
|
- run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
|
@@ -17,11 +17,11 @@ jobs:
|
|
17
17
|
- run:
|
18
18
|
name: Build/release gem to artifactory
|
19
19
|
command: bundle exec rake push_artifactory
|
20
|
-
ruby-2.6.
|
20
|
+
ruby-2.6.4-rails-6.0:
|
21
21
|
docker:
|
22
|
-
- image: circleci/ruby:2.6.
|
22
|
+
- image: circleci/ruby:2.6.4
|
23
23
|
environment:
|
24
|
-
BUNDLE_GEMFILE: Gemfile.rails-
|
24
|
+
BUNDLE_GEMFILE: Gemfile.rails-6.0
|
25
25
|
working_directory: "~/stitches"
|
26
26
|
steps:
|
27
27
|
- checkout
|
@@ -35,15 +35,15 @@ jobs:
|
|
35
35
|
fi
|
36
36
|
- run:
|
37
37
|
name: Notify Pager Duty
|
38
|
-
command: bundle exec y-notify "#eng-platform"
|
38
|
+
command: bundle exec y-notify "#eng-platform-alerts"
|
39
39
|
when: on_fail
|
40
40
|
- store_test_results:
|
41
41
|
path: "/tmp/test-results"
|
42
|
-
ruby-2.5.
|
42
|
+
ruby-2.5.6-rails-6.0:
|
43
43
|
docker:
|
44
|
-
- image: circleci/ruby:2.5.
|
44
|
+
- image: circleci/ruby:2.5.6
|
45
45
|
environment:
|
46
|
-
BUNDLE_GEMFILE: Gemfile.rails-
|
46
|
+
BUNDLE_GEMFILE: Gemfile.rails-6.0
|
47
47
|
working_directory: "~/stitches"
|
48
48
|
steps:
|
49
49
|
- checkout
|
@@ -57,15 +57,15 @@ jobs:
|
|
57
57
|
fi
|
58
58
|
- run:
|
59
59
|
name: Notify Pager Duty
|
60
|
-
command: bundle exec y-notify "#eng-platform"
|
60
|
+
command: bundle exec y-notify "#eng-platform-alerts"
|
61
61
|
when: on_fail
|
62
62
|
- store_test_results:
|
63
63
|
path: "/tmp/test-results"
|
64
|
-
ruby-2.6.
|
64
|
+
ruby-2.6.4-rails-5.2:
|
65
65
|
docker:
|
66
|
-
- image: circleci/ruby:2.6.
|
66
|
+
- image: circleci/ruby:2.6.4
|
67
67
|
environment:
|
68
|
-
BUNDLE_GEMFILE: Gemfile.rails-5.
|
68
|
+
BUNDLE_GEMFILE: Gemfile.rails-5.2
|
69
69
|
working_directory: "~/stitches"
|
70
70
|
steps:
|
71
71
|
- checkout
|
@@ -79,15 +79,15 @@ jobs:
|
|
79
79
|
fi
|
80
80
|
- run:
|
81
81
|
name: Notify Pager Duty
|
82
|
-
command: bundle exec y-notify "#eng-platform"
|
82
|
+
command: bundle exec y-notify "#eng-platform-alerts"
|
83
83
|
when: on_fail
|
84
84
|
- store_test_results:
|
85
85
|
path: "/tmp/test-results"
|
86
|
-
ruby-2.5.
|
86
|
+
ruby-2.5.6-rails-5.2:
|
87
87
|
docker:
|
88
|
-
- image: circleci/ruby:2.5.
|
88
|
+
- image: circleci/ruby:2.5.6
|
89
89
|
environment:
|
90
|
-
BUNDLE_GEMFILE: Gemfile.rails-5.
|
90
|
+
BUNDLE_GEMFILE: Gemfile.rails-5.2
|
91
91
|
working_directory: "~/stitches"
|
92
92
|
steps:
|
93
93
|
- checkout
|
@@ -101,7 +101,7 @@ jobs:
|
|
101
101
|
fi
|
102
102
|
- run:
|
103
103
|
name: Notify Pager Duty
|
104
|
-
command: bundle exec y-notify "#eng-platform"
|
104
|
+
command: bundle exec y-notify "#eng-platform-alerts"
|
105
105
|
when: on_fail
|
106
106
|
- store_test_results:
|
107
107
|
path: "/tmp/test-results"
|
@@ -112,31 +112,31 @@ workflows:
|
|
112
112
|
- release:
|
113
113
|
context: org-global
|
114
114
|
requires:
|
115
|
-
- ruby-2.6.
|
116
|
-
- ruby-2.5.
|
117
|
-
- ruby-2.6.
|
118
|
-
- ruby-2.5.
|
115
|
+
- ruby-2.6.4-rails-6.0
|
116
|
+
- ruby-2.5.6-rails-6.0
|
117
|
+
- ruby-2.6.4-rails-5.2
|
118
|
+
- ruby-2.5.6-rails-5.2
|
119
119
|
filters:
|
120
120
|
tags:
|
121
|
-
only: /^[0-9]+\.[0-9]+\.[0-9](
|
121
|
+
only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?RC[-\.]?\d*)?$/
|
122
122
|
branches:
|
123
123
|
ignore: /.*/
|
124
|
-
- ruby-2.6.
|
124
|
+
- ruby-2.6.4-rails-6.0:
|
125
125
|
context: org-global
|
126
126
|
filters:
|
127
127
|
tags:
|
128
128
|
only: &1 /.*/
|
129
|
-
- ruby-2.5.
|
129
|
+
- ruby-2.5.6-rails-6.0:
|
130
130
|
context: org-global
|
131
131
|
filters:
|
132
132
|
tags:
|
133
133
|
only: *1
|
134
|
-
- ruby-2.6.
|
134
|
+
- ruby-2.6.4-rails-5.2:
|
135
135
|
context: org-global
|
136
136
|
filters:
|
137
137
|
tags:
|
138
138
|
only: *1
|
139
|
-
- ruby-2.5.
|
139
|
+
- ruby-2.5.6-rails-5.2:
|
140
140
|
context: org-global
|
141
141
|
filters:
|
142
142
|
tags:
|
@@ -150,11 +150,11 @@ workflows:
|
|
150
150
|
only:
|
151
151
|
- master
|
152
152
|
jobs:
|
153
|
-
- ruby-2.6.
|
153
|
+
- ruby-2.6.4-rails-6.0:
|
154
154
|
context: org-global
|
155
|
-
- ruby-2.5.
|
155
|
+
- ruby-2.5.6-rails-6.0:
|
156
156
|
context: org-global
|
157
|
-
- ruby-2.6.
|
157
|
+
- ruby-2.6.4-rails-5.2:
|
158
158
|
context: org-global
|
159
|
-
- ruby-2.5.
|
159
|
+
- ruby-2.5.6-rails-5.2:
|
160
160
|
context: org-global
|
data/Gemfile.rails-5.1
CHANGED
data/Gemfile.rails-5.2
CHANGED
data/Gemfile.rails-6.0
ADDED
data/lib/stitches/api_key.rb
CHANGED
@@ -22,7 +22,7 @@ module Stitches
|
|
22
22
|
|
23
23
|
def initialize(app,options = {})
|
24
24
|
super(app,options)
|
25
|
-
@realm =
|
25
|
+
@realm = rails_app_module
|
26
26
|
end
|
27
27
|
|
28
28
|
protected
|
@@ -57,6 +57,17 @@ module Stitches
|
|
57
57
|
|
58
58
|
private
|
59
59
|
|
60
|
+
# TODO: (jdlubrano)
|
61
|
+
# Once Rails 5 support is no longer necessary, we can simply call
|
62
|
+
# Rails.application.class.module_parent. The module_parent method
|
63
|
+
# does not exist in Rails <= 5, though, so we need to gracefully fallback
|
64
|
+
# Rails.application.class.parent for Rails versions predating Rails 6.0.0.
|
65
|
+
def rails_app_module
|
66
|
+
application_class = Rails.application.class
|
67
|
+
parent = application_class.try(:module_parent) || application_class.parent
|
68
|
+
parent.to_s
|
69
|
+
end
|
70
|
+
|
60
71
|
class UnauthorizedResponse < Rack::Response
|
61
72
|
def initialize(reason,realm,custom_http_auth_scheme)
|
62
73
|
super("Unauthorized - #{reason}", 401, { "WWW-Authenticate" => "#{custom_http_auth_scheme} realm=#{realm}" })
|
@@ -123,14 +123,22 @@ feature "general API stuff" do
|
|
123
123
|
failure_message do
|
124
124
|
correct_code,_ = evaluate_response(response)
|
125
125
|
if correct_code
|
126
|
-
"Expected WWW-Authenticate header to be 'CustomKeyAuth realm=#{
|
126
|
+
"Expected WWW-Authenticate header to be 'CustomKeyAuth realm=#{realm}', but was #{response['WWW-Authenticate']}"
|
127
127
|
else
|
128
128
|
"Expected response to be 401, but was #{response.response_code}"
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
+
def realm
|
133
|
+
<% if ::Rails::VERSION::MAJOR >= 6 -%>
|
134
|
+
Rails.application.class.module_parent.to_s
|
135
|
+
<% else %>
|
136
|
+
Rails.application.class.parent.to_s
|
137
|
+
<% end %>
|
138
|
+
end
|
139
|
+
|
132
140
|
def evaluate_response(response)
|
133
|
-
[response.response_code == 401, response.headers["WWW-Authenticate"] == "CustomKeyAuth realm=#{
|
141
|
+
[response.response_code == 401, response.headers["WWW-Authenticate"] == "CustomKeyAuth realm=#{realm}"]
|
134
142
|
end
|
135
143
|
end
|
136
144
|
end
|
data/lib/stitches/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stitches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- Gemfile.rails-5.0
|
108
108
|
- Gemfile.rails-5.1
|
109
109
|
- Gemfile.rails-5.2
|
110
|
+
- Gemfile.rails-6.0
|
110
111
|
- LICENSE.txt
|
111
112
|
- PULL_REQUEST_TEMPLATE.md
|
112
113
|
- README.md
|