stitches 3.2.3 → 3.3.0

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: a861f11796bfcc697ded1857fe96d0b0dfbc73ab
4
- data.tar.gz: 831d978bdf931a550a6af1fe1779e8216f6f56b0
3
+ metadata.gz: 9e87e719f34bc52ddf14d46560ca160b073648c8
4
+ data.tar.gz: 5919ab13f6949c37fb1be76f93883176d5a49a49
5
5
  SHA512:
6
- metadata.gz: fd50b87dbe2f27d96d287de362ff8ae19479b3c47793d1700d988597b88b408f2ffa56fd4d29ab5a905336fce67fab4824b6caf342d9175f8ad8e11dad702240
7
- data.tar.gz: 1df173eeecc1a8e16640ab1b50c5fe2d406180f381414c6fd1ff606a2a959f56970377f99236c0b9c456b8a1a233c5aa95923af5d5b955cf828bc29cc7951a53
6
+ metadata.gz: 123e883d8a697b656ce8c75c6a1b7fd270bfc7eba4df3b091fe12cfa17dda35f32c15b15e09a981d17bdc1564b19a265f3f01d746825b9bac80f56ba27dd54a4
7
+ data.tar.gz: 8ed0e45e556b957750cf7c6eb3cb93a608909576a22e52fcd1f440be5ebeea5d19017cc40696ff9fdc3dc20067f01f4b5f8b9a23e1155df6f00ec669e4759267
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -1,9 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.1.0
5
- - 2.0.0
6
- - 2.2.0
3
+ - 2.2.2
4
+ - 2.3.1
7
5
  - ruby-head
8
6
  notifications:
9
- email: false
7
+ email: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stitches (3.2.3)
4
+ stitches (3.3.0)
5
5
  apitome
6
6
  pg
7
7
  rails
@@ -11,124 +11,129 @@ PATH
11
11
  GEM
12
12
  remote: https://www.rubygems.org/
13
13
  specs:
14
- actionmailer (4.2.5.2)
15
- actionpack (= 4.2.5.2)
16
- actionview (= 4.2.5.2)
17
- activejob (= 4.2.5.2)
14
+ actioncable (5.0.0.1)
15
+ actionpack (= 5.0.0.1)
16
+ nio4r (~> 1.2)
17
+ websocket-driver (~> 0.6.1)
18
+ actionmailer (5.0.0.1)
19
+ actionpack (= 5.0.0.1)
20
+ actionview (= 5.0.0.1)
21
+ activejob (= 5.0.0.1)
18
22
  mail (~> 2.5, >= 2.5.4)
19
- rails-dom-testing (~> 1.0, >= 1.0.5)
20
- actionpack (4.2.5.2)
21
- actionview (= 4.2.5.2)
22
- activesupport (= 4.2.5.2)
23
- rack (~> 1.6)
24
- rack-test (~> 0.6.2)
25
- rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-dom-testing (~> 2.0)
24
+ actionpack (5.0.0.1)
25
+ actionview (= 5.0.0.1)
26
+ activesupport (= 5.0.0.1)
27
+ rack (~> 2.0)
28
+ rack-test (~> 0.6.3)
29
+ rails-dom-testing (~> 2.0)
26
30
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (4.2.5.2)
28
- activesupport (= 4.2.5.2)
31
+ actionview (5.0.0.1)
32
+ activesupport (= 5.0.0.1)
29
33
  builder (~> 3.1)
30
34
  erubis (~> 2.7.0)
31
- rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ rails-dom-testing (~> 2.0)
32
36
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
- activejob (4.2.5.2)
34
- activesupport (= 4.2.5.2)
35
- globalid (>= 0.3.0)
36
- activemodel (4.2.5.2)
37
- activesupport (= 4.2.5.2)
38
- builder (~> 3.1)
39
- activerecord (4.2.5.2)
40
- activemodel (= 4.2.5.2)
41
- activesupport (= 4.2.5.2)
42
- arel (~> 6.0)
43
- activesupport (4.2.5.2)
37
+ activejob (5.0.0.1)
38
+ activesupport (= 5.0.0.1)
39
+ globalid (>= 0.3.6)
40
+ activemodel (5.0.0.1)
41
+ activesupport (= 5.0.0.1)
42
+ activerecord (5.0.0.1)
43
+ activemodel (= 5.0.0.1)
44
+ activesupport (= 5.0.0.1)
45
+ arel (~> 7.0)
46
+ activesupport (5.0.0.1)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
44
48
  i18n (~> 0.7)
45
- json (~> 1.7, >= 1.7.7)
46
49
  minitest (~> 5.1)
47
- thread_safe (~> 0.3, >= 0.3.4)
48
50
  tzinfo (~> 1.1)
49
51
  apitome (0.1.0)
50
52
  kramdown
51
53
  railties
52
54
  rspec_api_documentation
53
- arel (6.0.3)
55
+ arel (7.1.1)
54
56
  builder (3.2.2)
55
- concurrent-ruby (1.0.1)
57
+ concurrent-ruby (1.0.2)
56
58
  diff-lcs (1.2.5)
57
59
  erubis (2.7.0)
58
- globalid (0.3.6)
60
+ globalid (0.3.7)
59
61
  activesupport (>= 4.1.0)
60
62
  i18n (0.7.0)
61
- json (1.8.3)
62
- kramdown (1.10.0)
63
+ kramdown (1.12.0)
63
64
  loofah (2.0.3)
64
65
  nokogiri (>= 1.5.9)
65
- mail (2.6.3)
66
- mime-types (>= 1.16, < 3)
67
- mime-types (2.99.1)
68
- mini_portile2 (2.0.0)
69
- minitest (5.8.4)
70
- mustache (0.99.8)
71
- nokogiri (1.6.7.2)
72
- mini_portile2 (~> 2.0.0.rc2)
66
+ mail (2.6.4)
67
+ mime-types (>= 1.16, < 4)
68
+ method_source (0.8.2)
69
+ mime-types (3.1)
70
+ mime-types-data (~> 3.2015)
71
+ mime-types-data (3.2016.0521)
72
+ mini_portile2 (2.1.0)
73
+ minitest (5.9.0)
74
+ mustache (1.0.3)
75
+ nio4r (1.2.1)
76
+ nokogiri (1.6.8)
77
+ mini_portile2 (~> 2.1.0)
78
+ pkg-config (~> 1.1.7)
73
79
  pg (0.18.4)
74
- rack (1.6.4)
80
+ pkg-config (1.1.7)
81
+ rack (2.0.1)
75
82
  rack-test (0.6.3)
76
83
  rack (>= 1.0)
77
- rails (4.2.5.2)
78
- actionmailer (= 4.2.5.2)
79
- actionpack (= 4.2.5.2)
80
- actionview (= 4.2.5.2)
81
- activejob (= 4.2.5.2)
82
- activemodel (= 4.2.5.2)
83
- activerecord (= 4.2.5.2)
84
- activesupport (= 4.2.5.2)
84
+ rails (5.0.0.1)
85
+ actioncable (= 5.0.0.1)
86
+ actionmailer (= 5.0.0.1)
87
+ actionpack (= 5.0.0.1)
88
+ actionview (= 5.0.0.1)
89
+ activejob (= 5.0.0.1)
90
+ activemodel (= 5.0.0.1)
91
+ activerecord (= 5.0.0.1)
92
+ activesupport (= 5.0.0.1)
85
93
  bundler (>= 1.3.0, < 2.0)
86
- railties (= 4.2.5.2)
87
- sprockets-rails
88
- rails-deprecated_sanitizer (1.0.3)
89
- activesupport (>= 4.2.0.alpha)
90
- rails-dom-testing (1.0.7)
91
- activesupport (>= 4.2.0.beta, < 5.0)
94
+ railties (= 5.0.0.1)
95
+ sprockets-rails (>= 2.0.0)
96
+ rails-dom-testing (2.0.1)
97
+ activesupport (>= 4.2.0, < 6.0)
92
98
  nokogiri (~> 1.6.0)
93
- rails-deprecated_sanitizer (>= 1.0.1)
94
99
  rails-html-sanitizer (1.0.3)
95
100
  loofah (~> 2.0)
96
- railties (4.2.5.2)
97
- actionpack (= 4.2.5.2)
98
- activesupport (= 4.2.5.2)
101
+ railties (5.0.0.1)
102
+ actionpack (= 5.0.0.1)
103
+ activesupport (= 5.0.0.1)
104
+ method_source
99
105
  rake (>= 0.8.7)
100
106
  thor (>= 0.18.1, < 2.0)
101
- rake (10.5.0)
102
- rspec (3.4.0)
103
- rspec-core (~> 3.4.0)
104
- rspec-expectations (~> 3.4.0)
105
- rspec-mocks (~> 3.4.0)
106
- rspec-core (3.4.3)
107
- rspec-support (~> 3.4.0)
108
- rspec-expectations (3.4.0)
107
+ rake (11.2.2)
108
+ rspec (3.5.0)
109
+ rspec-core (~> 3.5.0)
110
+ rspec-expectations (~> 3.5.0)
111
+ rspec-mocks (~> 3.5.0)
112
+ rspec-core (3.5.2)
113
+ rspec-support (~> 3.5.0)
114
+ rspec-expectations (3.5.0)
109
115
  diff-lcs (>= 1.2.0, < 2.0)
110
- rspec-support (~> 3.4.0)
111
- rspec-mocks (3.4.1)
116
+ rspec-support (~> 3.5.0)
117
+ rspec-mocks (3.5.0)
112
118
  diff-lcs (>= 1.2.0, < 2.0)
113
- rspec-support (~> 3.4.0)
114
- rspec-rails (3.4.2)
115
- actionpack (>= 3.0, < 4.3)
116
- activesupport (>= 3.0, < 4.3)
117
- railties (>= 3.0, < 4.3)
118
- rspec-core (~> 3.4.0)
119
- rspec-expectations (~> 3.4.0)
120
- rspec-mocks (~> 3.4.0)
121
- rspec-support (~> 3.4.0)
122
- rspec-support (3.4.1)
123
- rspec_api_documentation (4.7.0)
119
+ rspec-support (~> 3.5.0)
120
+ rspec-rails (3.5.2)
121
+ actionpack (>= 3.0)
122
+ activesupport (>= 3.0)
123
+ railties (>= 3.0)
124
+ rspec-core (~> 3.5.0)
125
+ rspec-expectations (~> 3.5.0)
126
+ rspec-mocks (~> 3.5.0)
127
+ rspec-support (~> 3.5.0)
128
+ rspec-support (3.5.0)
129
+ rspec_api_documentation (4.8.0)
124
130
  activesupport (>= 3.0.0)
125
- json (~> 1.4, >= 1.4.6)
126
- mustache (~> 0.99, >= 0.99.4)
127
- rspec (>= 3.0.0)
128
- sprockets (3.5.2)
131
+ mustache (~> 1.0, >= 0.99.4)
132
+ rspec (~> 3.0, >= 3.0.0)
133
+ sprockets (3.7.0)
129
134
  concurrent-ruby (~> 1.0)
130
135
  rack (> 1, < 3)
131
- sprockets-rails (3.0.4)
136
+ sprockets-rails (3.2.0)
132
137
  actionpack (>= 4.0)
133
138
  activesupport (>= 4.0)
134
139
  sprockets (>= 3.0.0)
@@ -136,6 +141,9 @@ GEM
136
141
  thread_safe (0.3.5)
137
142
  tzinfo (1.2.2)
138
143
  thread_safe (~> 0.1)
144
+ websocket-driver (0.6.4)
145
+ websocket-extensions (>= 0.1.0)
146
+ websocket-extensions (0.1.2)
139
147
 
140
148
  PLATFORMS
141
149
  ruby
@@ -145,4 +153,4 @@ DEPENDENCIES
145
153
  stitches!
146
154
 
147
155
  BUNDLED WITH
148
- 1.11.2
156
+ 1.13.6
data/README.md CHANGED
@@ -41,6 +41,20 @@ Run database migrations (do `rake db:create` first if you haven't yet set up a d
41
41
  rake db:migrate
42
42
  ```
43
43
 
44
+ ### Upgrading from older verison of Stitches
45
+
46
+ If you have used stitches before the `enabled` field was added to `ApiClients`, you need to add that field to your database. You can do this by running
47
+ the included generator:
48
+
49
+ ```
50
+ rails g stitches:add_enabled_to_api_clients
51
+ ```
52
+
53
+ And then:
54
+
55
+ ```
56
+ rake db:migrate
57
+ ```
44
58
 
45
59
  ## Test the install
46
60
 
@@ -0,0 +1,19 @@
1
+ require 'rails/generators'
2
+
3
+ module Stitches
4
+ class AddEnabledToApiClientsGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+
7
+ source_root(File.expand_path(File.join(File.dirname(__FILE__),"generator_files")))
8
+
9
+ def self.next_migration_number(path)
10
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
11
+ end
12
+
13
+ desc "Upgrade your api_clients table so it uses the `enabled` field"
14
+ def update_api_clients_table
15
+ migration_template "db/migrate/add_enabled_to_api_clients.rb", "db/migrate/add_enabled_to_api_clients.rb"
16
+ end
17
+
18
+ end
19
+ end
@@ -32,7 +32,14 @@ module Stitches
32
32
  if authorization
33
33
  if authorization =~ /#{@configuration.custom_http_auth_scheme}\s+key=(.*)\s*$/
34
34
  key = $1
35
- client = ::ApiClient.where(key: key).first
35
+
36
+ if ApiClient.column_names.include?("enabled")
37
+ client = ApiClient.where(key: key, enabled: true).first
38
+ else
39
+ ActiveSupport::Deprecation.warn('api_keys is missing "enabled" column. Run "rails g stitches:add_enabled_to_api_clients"')
40
+ client = ApiClient.where(key: key).first
41
+ end
42
+
36
43
  if client.present?
37
44
  env[@configuration.env_var_to_hold_api_client_primary_key] = client.id
38
45
  env[@configuration.env_var_to_hold_api_client] = client
@@ -0,0 +1,7 @@
1
+ class AddEnabledToApiClients < ActiveRecord::Migration
2
+ def change
3
+ add_column :api_clients, :enabled, :bool, null: false, default: true
4
+ remove_index :api_clients, [:name ] # existing one would be unique
5
+ add_index :api_clients, [:name ]
6
+ end
7
+ end
@@ -3,9 +3,10 @@ class CreateApiClients < ActiveRecord::Migration
3
3
  create_table :api_clients do |t|
4
4
  t.string :name, null: false
5
5
  t.column :key, "uuid default uuid_generate_v4()", null: false
6
+ t.column :enabled, :bool, null: false, default: true
6
7
  t.column :created_at, "timestamp with time zone default now()", null: false
7
8
  end
8
- add_index :api_clients, [:name], unique: true
9
+ add_index :api_clients, [:name]
9
10
  add_index :api_clients, [:key], unique: true
10
11
  end
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module Stitches
2
- VERSION = '3.2.3'
2
+ VERSION = '3.3.0'
3
3
  end
@@ -12,6 +12,7 @@ require 'stitches/render_timestamps_in_iso8601_in_json'
12
12
  require 'stitches/error'
13
13
  require 'stitches/errors'
14
14
  require 'stitches/api_generator'
15
+ require 'stitches/add_enabled_to_api_clients_generator'
15
16
  require 'stitches/api_version_constraint'
16
17
  require 'stitches/api_key'
17
18
  require 'stitches/valid_mime_type'
@@ -7,6 +7,9 @@ end
7
7
 
8
8
  unless defined? ApiClient
9
9
  class ApiClient
10
+ def self.column_names
11
+ ["enabled"]
12
+ end
10
13
  end
11
14
  end
12
15
 
@@ -17,7 +20,7 @@ describe Stitches::ApiKey do
17
20
  double(ApiClient, id: 42)
18
21
  ]
19
22
  }
20
-
23
+
21
24
  before do
22
25
  Stitches.configuration.reset_to_defaults!
23
26
  Stitches.configuration.custom_http_auth_scheme = 'MyAwesomeInternalScheme'
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.2.3
4
+ version: 3.3.0
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: 2016-07-06 00:00:00.000000000 Z
14
+ date: 2017-01-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -120,6 +120,7 @@ files:
120
120
  - README.md
121
121
  - Rakefile
122
122
  - lib/stitches.rb
123
+ - lib/stitches/add_enabled_to_api_clients_generator.rb
123
124
  - lib/stitches/api_generator.rb
124
125
  - lib/stitches/api_key.rb
125
126
  - lib/stitches/api_version_constraint.rb
@@ -134,6 +135,7 @@ files:
134
135
  - lib/stitches/generator_files/app/controllers/api/v2/pings_controller.rb
135
136
  - lib/stitches/generator_files/app/models/api_client.rb
136
137
  - lib/stitches/generator_files/config/initializers/stitches.rb
138
+ - lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb
137
139
  - lib/stitches/generator_files/db/migrate/create_api_clients.rb
138
140
  - lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb
139
141
  - lib/stitches/generator_files/lib/tasks/generate_api_key.rake
@@ -179,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
181
  version: '0'
180
182
  requirements: []
181
183
  rubyforge_project:
182
- rubygems_version: 2.6.6
184
+ rubygems_version: 2.5.1
183
185
  signing_key:
184
186
  specification_version: 4
185
187
  summary: You'll be in stitches at how easy it is to create a service at Stitch Fix