stitches 4.2.2 → 5.0.0.RC1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +175 -209
  3. data/.env.example +1 -0
  4. data/.github/CODEOWNERS +1 -1
  5. data/.github/workflows/scheduled_cci.yml +14 -0
  6. data/.gitignore +3 -0
  7. data/.ruby-version +1 -1
  8. data/README.md +18 -9
  9. data/lib/stitches/api_generator.rb +1 -13
  10. data/lib/stitches/api_key.rb +2 -0
  11. data/lib/stitches/api_migration_generator.rb +23 -0
  12. data/lib/stitches/configuration.rb +2 -1
  13. data/lib/stitches/generator_files/config/initializers/stitches.rb +4 -0
  14. data/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb +4 -2
  15. data/lib/stitches/generator_files/spec/features/api_spec.rb.erb +3 -0
  16. data/lib/stitches/railtie.rb +0 -1
  17. data/lib/stitches/spec/test_headers.rb +1 -1
  18. data/lib/stitches/version.rb +1 -1
  19. data/lib/stitches_norailtie.rb +1 -0
  20. data/owners.json +1 -1
  21. data/spec/api_key_middleware_spec.rb +257 -225
  22. data/spec/configuration_spec.rb +4 -0
  23. data/spec/fake_app/.ruby-version +1 -1
  24. data/spec/fake_app/Gemfile +5 -5
  25. data/spec/fake_app/config/application.rb +1 -3
  26. data/spec/fake_app/config/database.yml +9 -10
  27. data/spec/fake_app/config/initializers/assets.rb +0 -3
  28. data/spec/integration/add_to_rails_app_spec.rb +2 -1
  29. data/spec/rails_helper.rb +4 -2
  30. data/stitches.gemspec +2 -1
  31. metadata +23 -17
  32. data/Gemfile.rails-4.2 +0 -8
  33. data/Gemfile.rails-5.0 +0 -8
  34. data/Gemfile.rails-5.1 +0 -7
  35. data/Gemfile.rails-5.2 +0 -7
  36. data/Gemfile.rails-6.0 +0 -7
  37. data/Gemfile.rails-6.1 +0 -7
  38. data/build-matrix.json +0 -4
  39. data/spec/fake_app/db/development.sqlite3 +0 -0
  40. data/spec/fake_app/db/test.sqlite3 +0 -0
@@ -1,14 +1,14 @@
1
1
  source 'https://rubygems.org'
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
- ruby '2.7.3'
4
+ ruby '3.2.3'
5
5
 
6
6
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
7
- gem 'rails', '~> 6.1.4'
8
- # Use sqlite3 as the database for Active Record
9
- gem 'sqlite3', '~> 1.4'
7
+ gem 'rails', '~> 7.1.3'
8
+ # Use postgres as the database for Active Record
9
+ gem 'pg'
10
10
  # Use Puma as the app server
11
- gem 'puma', '~> 5.0'
11
+ gem 'puma'
12
12
  # Use SCSS for stylesheets
13
13
  gem 'sass-rails', '>= 6'
14
14
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
@@ -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 6.0
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: sqlite3
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: db/development.sqlite3
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: db/test.sqlite3
20
+ database: stitches_fake_app_test
22
21
 
23
22
  production:
24
23
  <<: *default
25
- database: db/production.sqlite3
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.with_clean_env do
46
+ Bundler.with_unbundled_env do
47
47
  FileUtils.chdir work_dir do
48
48
  run rails_new
49
49
 
@@ -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
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("sqlite3")
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.2.2
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: 2021-10-11 00:00:00.000000000 Z
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: sqlite3
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,14 +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
262
  - spec/fake_app/lib/tasks/generate_api_key.rake
255
263
  - spec/fake_app/public/404.html
256
264
  - spec/fake_app/public/422.html
@@ -288,11 +296,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
296
  version: '0'
289
297
  required_rubygems_version: !ruby/object:Gem::Requirement
290
298
  requirements:
291
- - - ">="
299
+ - - ">"
292
300
  - !ruby/object:Gem::Version
293
- version: '0'
301
+ version: 1.3.1
294
302
  requirements: []
295
- rubygems_version: 3.1.4
303
+ rubygems_version: 3.4.19
296
304
  signing_key:
297
305
  specification_version: 4
298
306
  summary: You'll be in stitches at how easy it is to create a service at Stitch Fix
@@ -343,14 +351,12 @@ test_files:
343
351
  - spec/fake_app/config/puma.rb
344
352
  - spec/fake_app/config/routes.rb
345
353
  - spec/fake_app/config/storage.yml
346
- - spec/fake_app/db/development.sqlite3
347
354
  - spec/fake_app/db/migrate/20210802153118_enable_uuid_ossp_extension.rb
348
355
  - spec/fake_app/db/migrate/20210802153119_create_api_clients.rb
349
356
  - spec/fake_app/db/schema_missing_disabled_at.rb
350
357
  - spec/fake_app/db/schema_missing_enabled.rb
351
358
  - spec/fake_app/db/schema_modern.rb
352
359
  - spec/fake_app/db/seeds.rb
353
- - spec/fake_app/db/test.sqlite3
354
360
  - spec/fake_app/lib/tasks/generate_api_key.rake
355
361
  - spec/fake_app/public/404.html
356
362
  - spec/fake_app/public/422.html
data/Gemfile.rails-4.2 DELETED
@@ -1,8 +0,0 @@
1
- # DO NOT MODIFY - this is managed by Git Reduce in goro
2
- #
3
- source 'https://gem.fury.io/me/'
4
- source 'https://www.rubygems.org'
5
-
6
- gemspec
7
-
8
- gem 'rails', '~> 4.2.0'
data/Gemfile.rails-5.0 DELETED
@@ -1,8 +0,0 @@
1
- # DO NOT MODIFY - this is managed by Git Reduce in goro
2
- #
3
- source 'https://gem.fury.io/me/'
4
- source 'https://www.rubygems.org'
5
-
6
- gemspec
7
-
8
- gem 'rails', '~> 5.0.0'
data/Gemfile.rails-5.1 DELETED
@@ -1,7 +0,0 @@
1
- # DO NOT MODIFY - this is managed by Git Reduce in goro
2
- #
3
- source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
4
-
5
- gemspec
6
-
7
- gem 'rails', '~> 5.1.0'
data/Gemfile.rails-5.2 DELETED
@@ -1,7 +0,0 @@
1
- # DO NOT MODIFY - this is managed by Git Reduce in goro
2
- #
3
- source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
4
-
5
- gemspec
6
-
7
- gem 'rails', '~> 5.2.0'
data/Gemfile.rails-6.0 DELETED
@@ -1,7 +0,0 @@
1
- # DO NOT MODIFY - this is managed by Git Reduce in goro
2
- #
3
- source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
4
-
5
- gemspec
6
-
7
- gem 'rails', '~> 6.0.0'
data/Gemfile.rails-6.1 DELETED
@@ -1,7 +0,0 @@
1
- # DO NOT MODIFY - this is managed by Git Reduce in goro
2
- #
3
- source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
4
-
5
- gemspec
6
-
7
- gem 'rails', '~> 6.1.0'
data/build-matrix.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "build_matrix": {
3
- }
4
- }
Binary file
File without changes