stitches 4.2.1 → 5.0.0.RC1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +175 -209
- data/.env.example +1 -0
- data/.github/CODEOWNERS +1 -1
- data/.github/workflows/scheduled_cci.yml +14 -0
- data/.gitignore +3 -0
- data/.ruby-version +1 -1
- data/README.md +18 -9
- data/lib/stitches/api_generator.rb +2 -24
- data/lib/stitches/api_key.rb +2 -0
- data/lib/stitches/api_migration_generator.rb +23 -0
- data/lib/stitches/configuration.rb +2 -1
- data/lib/stitches/generator_files/config/initializers/stitches.rb +4 -0
- data/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb +4 -2
- data/lib/stitches/generator_files/spec/features/api_spec.rb.erb +3 -0
- data/lib/stitches/railtie.rb +0 -1
- data/lib/stitches/spec/test_headers.rb +1 -1
- data/lib/stitches/version.rb +1 -1
- data/lib/stitches_norailtie.rb +1 -0
- data/owners.json +1 -1
- data/spec/api_key_middleware_spec.rb +257 -225
- data/spec/configuration_spec.rb +4 -0
- data/spec/fake_app/.ruby-version +1 -1
- data/spec/fake_app/Gemfile +5 -6
- data/spec/fake_app/config/application.rb +1 -3
- data/spec/fake_app/config/database.yml +9 -10
- data/spec/fake_app/config/initializers/assets.rb +0 -3
- data/spec/integration/add_to_rails_app_spec.rb +3 -6
- data/spec/rails_helper.rb +4 -2
- data/stitches.gemspec +2 -1
- metadata +23 -19
- data/Gemfile.rails-4.2 +0 -8
- data/Gemfile.rails-5.0 +0 -8
- data/Gemfile.rails-5.1 +0 -7
- data/Gemfile.rails-5.2 +0 -7
- data/Gemfile.rails-6.0 +0 -7
- data/Gemfile.rails-6.1 +0 -7
- data/build-matrix.json +0 -4
- data/spec/fake_app/db/development.sqlite3 +0 -0
- data/spec/fake_app/db/test.sqlite3 +0 -0
- data/spec/fake_app/doc/api.md +0 -4
@@ -8,11 +8,9 @@ require "active_record/railtie"
|
|
8
8
|
require "active_storage/engine"
|
9
9
|
require "action_controller/railtie"
|
10
10
|
# require "action_mailer/railtie"
|
11
|
-
require "action_mailbox/engine"
|
12
11
|
require "action_text/engine"
|
13
12
|
require "action_view/railtie"
|
14
13
|
# require "action_cable/engine"
|
15
|
-
require "sprockets/railtie"
|
16
14
|
require "rails/test_unit/railtie"
|
17
15
|
|
18
16
|
# Require the gems listed in Gemfile, including any gems
|
@@ -22,7 +20,7 @@ Bundler.require(*Rails.groups)
|
|
22
20
|
module FakeApp
|
23
21
|
class Application < Rails::Application
|
24
22
|
# Initialize configuration defaults for originally generated Rails version.
|
25
|
-
config.load_defaults
|
23
|
+
config.load_defaults 7.0
|
26
24
|
|
27
25
|
# Configuration for the application, engines, and railties goes here.
|
28
26
|
#
|
@@ -1,25 +1,24 @@
|
|
1
|
-
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
#
|
7
1
|
default: &default
|
8
|
-
adapter:
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
9
4
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
5
|
timeout: 5000
|
6
|
+
username: stitchfix_owner
|
7
|
+
password:
|
8
|
+
host: localhost
|
9
|
+
port: 5432
|
11
10
|
|
12
11
|
development:
|
13
12
|
<<: *default
|
14
|
-
database:
|
13
|
+
database: stitches_fake_app_dev
|
15
14
|
|
16
15
|
# Warning: The database defined as "test" will be erased and
|
17
16
|
# re-generated from your development database when you run "rake".
|
18
17
|
# Do not set this db to the same as development or production.
|
19
18
|
test:
|
20
19
|
<<: *default
|
21
|
-
database:
|
20
|
+
database: stitches_fake_app_test
|
22
21
|
|
23
22
|
production:
|
24
23
|
<<: *default
|
25
|
-
database:
|
24
|
+
database: stitches_fake_app_production
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version = '1.0'
|
5
|
-
|
6
3
|
# Add additional assets to the asset load path.
|
7
4
|
# Rails.application.config.assets.paths << Emoji.images_path
|
8
5
|
|
@@ -43,7 +43,7 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
|
|
43
43
|
gem_path = File.expand_path("../..", File.dirname(__FILE__))
|
44
44
|
use_local_stitches = %{echo "gem 'stitches', path: '#{gem_path}'" >> Gemfile}
|
45
45
|
|
46
|
-
Bundler.
|
46
|
+
Bundler.with_unbundled_env do
|
47
47
|
FileUtils.chdir work_dir do
|
48
48
|
run rails_new
|
49
49
|
|
@@ -51,7 +51,7 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
|
|
51
51
|
run use_local_stitches
|
52
52
|
# It's unclear why, but on CI the gems are not found when installed
|
53
53
|
# through bundler however installing them explicitly first fixes it.
|
54
|
-
run "gem install
|
54
|
+
run "gem install rspec-rails rspec_api_documentation"
|
55
55
|
run "bundle install"
|
56
56
|
example.run
|
57
57
|
end
|
@@ -61,6 +61,7 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
|
|
61
61
|
|
62
62
|
it "works as described in the README" do
|
63
63
|
run "bin/rails generate stitches:api"
|
64
|
+
run "bin/rails generate stitches:api_migration"
|
64
65
|
|
65
66
|
# Yuck! So much duplication! BUT: Rails app templates have a notoriously silent failure mode, so mostly
|
66
67
|
# what this is doing is ensuring that the generator inserted stuff when asked and that the very basics of what happens
|
@@ -69,11 +70,9 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
|
|
69
70
|
# It's also in one big block because making a new rails app and running the generator multiple times seems bad.
|
70
71
|
aggregate_failures do
|
71
72
|
expect(File.exist?(rails_root / "app" / "controllers" / "api" / "api_controller.rb")).to eq(true)
|
72
|
-
expect(rails_root / "Gemfile").to contain_gem("apitome")
|
73
73
|
expect(rails_root / "Gemfile").to contain_gem("rspec_api_documentation")
|
74
74
|
expect(rails_root / "config" / "routes.rb").to have_route(namespace: :api, module_scope: :v1, resource: 'ping')
|
75
75
|
expect(rails_root / "config" / "routes.rb").to have_route(namespace: :api, module_scope: :v2, resource: 'ping')
|
76
|
-
expect(rails_root / "config" / "routes.rb").to have_mounted_engine("Apitome::Engine")
|
77
76
|
migrations = Dir["#{rails_root}/db/migrate/*.rb"].sort
|
78
77
|
expect(migrations.size).to eq(2)
|
79
78
|
expect(migrations[0]).to match(/\/\d+_enable_uuid_ossp_extension.rb/)
|
@@ -81,8 +80,6 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
|
|
81
80
|
expect(File.read(rails_root / "spec" / "rails_helper.rb")).to include("config.include RSpec::Rails::RequestExampleGroup, type: :feature")
|
82
81
|
expect(File.read(rails_root / "spec" / "rails_helper.rb")).to include("require 'stitches/spec'")
|
83
82
|
expect(File.read(rails_root / "spec" / "rails_helper.rb")).to include("require 'rspec_api_documentation'")
|
84
|
-
expect(File.read(rails_root / "config" / "initializers" / "apitome.rb")).to include("config.mount_at = nil")
|
85
|
-
expect(File.read(rails_root / "config" / "initializers" / "apitome.rb")).to include("config.title = 'Service Documentation'")
|
86
83
|
expect(File.read(rails_root / "app" / "controllers" / "api" / "api_controller.rb")).to include("rescue_from StandardError")
|
87
84
|
expect(File.read(rails_root / "app" / "controllers" / "api" / "api_controller.rb")).to include("rescue_from ActiveRecord::RecordNotFound")
|
88
85
|
|
data/spec/rails_helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'dotenv'
|
4
|
+
Dotenv.load('.env.test.local')
|
5
|
+
|
3
6
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
4
7
|
require "rails_helper"
|
5
8
|
ENV["RAILS_ENV"] ||= "test"
|
@@ -10,8 +13,7 @@ require File.expand_path("fake_app/config/environment.rb", __dir__)
|
|
10
13
|
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
11
14
|
require "rspec/rails"
|
12
15
|
# Add additional requires below this line. Rails is not loaded until this point!
|
13
|
-
|
14
|
-
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
16
|
+
ActiveRecord::Base.establish_connection adapter: "postgresql", url: ENV["DATABASE_URL"]
|
15
17
|
|
16
18
|
load 'fake_app/db/schema_modern.rb'
|
17
19
|
|
data/stitches.gemspec
CHANGED
@@ -22,9 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_runtime_dependency("pg")
|
23
23
|
s.add_runtime_dependency("lru_redux")
|
24
24
|
|
25
|
+
s.add_development_dependency("dotenv")
|
25
26
|
s.add_development_dependency("rspec", ">= 3")
|
26
27
|
s.add_development_dependency("rspec-rails")
|
27
|
-
s.add_development_dependency("
|
28
|
+
s.add_development_dependency("pg")
|
28
29
|
s.add_development_dependency("rake")
|
29
30
|
s.add_development_dependency("rspec_junit_formatter")
|
30
31
|
end
|
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:
|
4
|
+
version: 5.0.0.RC1
|
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:
|
14
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -55,6 +55,20 @@ dependencies:
|
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: dotenv
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
58
72
|
- !ruby/object:Gem::Dependency
|
59
73
|
name: rspec
|
60
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,7 +98,7 @@ dependencies:
|
|
84
98
|
- !ruby/object:Gem::Version
|
85
99
|
version: '0'
|
86
100
|
- !ruby/object:Gem::Dependency
|
87
|
-
name:
|
101
|
+
name: pg
|
88
102
|
requirement: !ruby/object:Gem::Requirement
|
89
103
|
requirements:
|
90
104
|
- - ">="
|
@@ -137,8 +151,10 @@ extensions: []
|
|
137
151
|
extra_rdoc_files: []
|
138
152
|
files:
|
139
153
|
- ".circleci/config.yml"
|
154
|
+
- ".env.example"
|
140
155
|
- ".github/CODEOWNERS"
|
141
156
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
157
|
+
- ".github/workflows/scheduled_cci.yml"
|
142
158
|
- ".gitignore"
|
143
159
|
- ".ruby-gemset"
|
144
160
|
- ".ruby-version"
|
@@ -146,16 +162,9 @@ files:
|
|
146
162
|
- CODE_OF_CONDUCT.md
|
147
163
|
- CONTRIBUTING.md
|
148
164
|
- Gemfile
|
149
|
-
- Gemfile.rails-4.2
|
150
|
-
- Gemfile.rails-5.0
|
151
|
-
- Gemfile.rails-5.1
|
152
|
-
- Gemfile.rails-5.2
|
153
|
-
- Gemfile.rails-6.0
|
154
|
-
- Gemfile.rails-6.1
|
155
165
|
- LICENSE.txt
|
156
166
|
- README.md
|
157
167
|
- Rakefile
|
158
|
-
- build-matrix.json
|
159
168
|
- lib/stitches.rb
|
160
169
|
- lib/stitches/add_deprecation_generator.rb
|
161
170
|
- lib/stitches/add_disabled_at_to_api_clients_generator.rb
|
@@ -164,6 +173,7 @@ files:
|
|
164
173
|
- lib/stitches/api_client_access_wrapper.rb
|
165
174
|
- lib/stitches/api_generator.rb
|
166
175
|
- lib/stitches/api_key.rb
|
176
|
+
- lib/stitches/api_migration_generator.rb
|
167
177
|
- lib/stitches/api_version_constraint.rb
|
168
178
|
- lib/stitches/configuration.rb
|
169
179
|
- lib/stitches/deprecation.rb
|
@@ -243,15 +253,12 @@ files:
|
|
243
253
|
- spec/fake_app/config/puma.rb
|
244
254
|
- spec/fake_app/config/routes.rb
|
245
255
|
- spec/fake_app/config/storage.yml
|
246
|
-
- spec/fake_app/db/development.sqlite3
|
247
256
|
- spec/fake_app/db/migrate/20210802153118_enable_uuid_ossp_extension.rb
|
248
257
|
- spec/fake_app/db/migrate/20210802153119_create_api_clients.rb
|
249
258
|
- spec/fake_app/db/schema_missing_disabled_at.rb
|
250
259
|
- spec/fake_app/db/schema_missing_enabled.rb
|
251
260
|
- spec/fake_app/db/schema_modern.rb
|
252
261
|
- spec/fake_app/db/seeds.rb
|
253
|
-
- spec/fake_app/db/test.sqlite3
|
254
|
-
- spec/fake_app/doc/api.md
|
255
262
|
- spec/fake_app/lib/tasks/generate_api_key.rake
|
256
263
|
- spec/fake_app/public/404.html
|
257
264
|
- spec/fake_app/public/422.html
|
@@ -289,11 +296,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
296
|
version: '0'
|
290
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
298
|
requirements:
|
292
|
-
- - "
|
299
|
+
- - ">"
|
293
300
|
- !ruby/object:Gem::Version
|
294
|
-
version:
|
301
|
+
version: 1.3.1
|
295
302
|
requirements: []
|
296
|
-
rubygems_version: 3.
|
303
|
+
rubygems_version: 3.4.19
|
297
304
|
signing_key:
|
298
305
|
specification_version: 4
|
299
306
|
summary: You'll be in stitches at how easy it is to create a service at Stitch Fix
|
@@ -344,15 +351,12 @@ test_files:
|
|
344
351
|
- spec/fake_app/config/puma.rb
|
345
352
|
- spec/fake_app/config/routes.rb
|
346
353
|
- spec/fake_app/config/storage.yml
|
347
|
-
- spec/fake_app/db/development.sqlite3
|
348
354
|
- spec/fake_app/db/migrate/20210802153118_enable_uuid_ossp_extension.rb
|
349
355
|
- spec/fake_app/db/migrate/20210802153119_create_api_clients.rb
|
350
356
|
- spec/fake_app/db/schema_missing_disabled_at.rb
|
351
357
|
- spec/fake_app/db/schema_missing_enabled.rb
|
352
358
|
- spec/fake_app/db/schema_modern.rb
|
353
359
|
- spec/fake_app/db/seeds.rb
|
354
|
-
- spec/fake_app/db/test.sqlite3
|
355
|
-
- spec/fake_app/doc/api.md
|
356
360
|
- spec/fake_app/lib/tasks/generate_api_key.rake
|
357
361
|
- spec/fake_app/public/404.html
|
358
362
|
- spec/fake_app/public/422.html
|
data/Gemfile.rails-4.2
DELETED
data/Gemfile.rails-5.0
DELETED
data/Gemfile.rails-5.1
DELETED
data/Gemfile.rails-5.2
DELETED
data/Gemfile.rails-6.0
DELETED
data/Gemfile.rails-6.1
DELETED
data/build-matrix.json
DELETED
Binary file
|
File without changes
|
data/spec/fake_app/doc/api.md
DELETED