stitches 3.7.3 → 3.8.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
  SHA256:
3
- metadata.gz: 5fa18e703222c9f9f2cc2b750cbf06a1bf9ddac8d473e6c2775d3d0cd840e59e
4
- data.tar.gz: 550563efbfc95a84ff7c9375cbd4cd6d45eff8621370780f90760ddecc4afa3e
3
+ metadata.gz: f22af42820e6175c739a77f2f6945dd3d6aea8f94b43509303ed27874e315ca4
4
+ data.tar.gz: fee8fce193a17741483531c884cd20638ad92e1b5ce423a0673d85ee467aa5f3
5
5
  SHA512:
6
- metadata.gz: 0d81db63050704736cc9aaaebc3ccc0f06bcb271a36b734c195f9b5298121c18fd43c529e32ec2ba2dcf2e76c8dda411fc245d8229a4a2df21889de87dded7d7
7
- data.tar.gz: cd636756307dd9395860278f80f9fea1638ceef28105d91cc319c80db74de58809e7e6e396f1e706b123705c7905a46d0a5e3655c7c84cd077fe6eab9808c577
6
+ metadata.gz: 24c0456e68046e5a7a3d9cd045f35fe3095659a25da0e77b5d623ff64c759893a5c46a9367c898d58287312a29b85a186613cdaeda09558036ffa698d2e68fd1
7
+ data.tar.gz: e019d85dd736bf28b5e751ffef132cae093019877f6c5aa743e0a39f4b51e1d7da37051aa8ee9ad799db13d27fd24d8cfb1df7b8472ba2491c198ac8cdc0f27c
@@ -8,6 +8,7 @@ jobs:
8
8
  - image: circleci/ruby:2.6.3
9
9
  steps:
10
10
  - checkout
11
+ - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
11
12
  - run: bundle install --full-index
12
13
  - run:
13
14
  name: Artifactory login
@@ -24,6 +25,7 @@ jobs:
24
25
  working_directory: "~/stitches"
25
26
  steps:
26
27
  - checkout
28
+ - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
27
29
  - run: bundle install --full-index
28
30
  - run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
29
31
  --format=doc
@@ -45,6 +47,7 @@ jobs:
45
47
  working_directory: "~/stitches"
46
48
  steps:
47
49
  - checkout
50
+ - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
48
51
  - run: bundle install --full-index
49
52
  - run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
50
53
  --format=doc
@@ -66,6 +69,7 @@ jobs:
66
69
  working_directory: "~/stitches"
67
70
  steps:
68
71
  - checkout
72
+ - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
69
73
  - run: bundle install --full-index
70
74
  - run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
71
75
  --format=doc
@@ -87,6 +91,7 @@ jobs:
87
91
  working_directory: "~/stitches"
88
92
  steps:
89
93
  - checkout
94
+ - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
90
95
  - run: bundle install --full-index
91
96
  - run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
92
97
  --format=doc
data/.gitignore CHANGED
@@ -9,4 +9,5 @@ config/database.yml
9
9
  .jhw-cache
10
10
  **.orig
11
11
  Gemfile.lock
12
+ Gemfile.*.lock
12
13
  .projections.json
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.6.3
@@ -5,17 +5,3 @@
5
5
  ## Solution
6
6
 
7
7
  «Brief description of how you solved the problem»
8
-
9
- ## Checklist
10
-
11
- ### Before Merging
12
-
13
- - [ ] If there is an RC on this branch, revert the version change in `version.rb`
14
-
15
- ### After Merging
16
-
17
- See the [gem release process](https://github.com/stitchfix/eng-wiki/blob/master/technical-topics/updating-gem-versions.md) for a detailed list, but the gist of it is:
18
-
19
- - [ ] Fetch `master` locally and run the applicable `rake version:*` task **on `master`** to bump the version
20
- - [ ] Run `rake release` **on `master`** to release the new version on Gemfury
21
- - [ ] Add [release notes](https://github.com/stitchfix/messaging/releases) - **this is very important in helping other engineers understand what changed in the new version**
data/README.md CHANGED
@@ -29,8 +29,6 @@ bundle install
29
29
  Then, set it up:
30
30
 
31
31
  ```
32
- > bin/rails generate rspec:install
33
- > bin/rails generate apitome:install
34
32
  > bin/rails generate stitches:api
35
33
  > bundle exec rake db:migrate
36
34
  ```
@@ -1,4 +1,2 @@
1
1
  require 'stitches_norailtie'
2
2
  require 'stitches/railtie'
3
- # Add new stitches ruby files to the stitches_norailtie file instead of here
4
- require 'apitome'
@@ -4,7 +4,7 @@ module Stitches
4
4
  class ApiGenerator < Rails::Generators::Base
5
5
  include Rails::Generators::Migration
6
6
 
7
- source_root(File.expand_path(File.join(File.dirname(__FILE__),"generator_files")))
7
+ source_root(File.expand_path(File.join(File.dirname(__FILE__), "generator_files")))
8
8
 
9
9
  def self.next_migration_number(path)
10
10
  Time.now.utc.strftime("%Y%m%d%H%M%S")
@@ -12,14 +12,21 @@ module Stitches
12
12
 
13
13
  desc "Bootstraps your API service with a basic ping controller and spec to ensure everything is setup properly"
14
14
  def bootstrap_api
15
- inject_into_file "Gemfile", after: /^gem ['"]rails['"].*$/ do<<-GEM
16
-
17
- gem "apitome"
18
- gem "responders"
19
- gem "rspec_api_documentation", group: [ :development, :test ]
20
- gem "capybara", group: [ :development, :test ]
21
- GEM
15
+ gem "stitches"
16
+ gem "apitome"
17
+ gem_group :development, :test do
18
+ gem "rspec"
19
+ gem "rspec-rails"
20
+ gem "rspec_api_documentation"
22
21
  end
22
+
23
+ run "bundle install"
24
+ generate "apitome:install"
25
+ generate "rspec:install"
26
+
27
+ gsub_file 'config/initializers/apitome.rb', /config.mount_at = .*$/, "config.mount_at = nil"
28
+ gsub_file 'config/initializers/apitome.rb', /config.title = .*$/, "config.title = 'Service Documentation'"
29
+
23
30
  inject_into_file "config/routes.rb", before: /^end/ do<<-ROUTES
24
31
  namespace :api do
25
32
  scope module: :v1, constraints: Stitches::ApiVersionConstraint.new(1) do
@@ -32,15 +39,14 @@ namespace :api do
32
39
  # as well as for your client to be able to validate this as well.
33
40
  end
34
41
  end
35
- api_docs = Rack::Auth::Basic.new(Apitome::Engine ) do |_,password|
42
+
43
+ api_docs = Rack::Auth::Basic.new(Apitome::Engine) do |_, password|
36
44
  password == ENV['HTTP_AUTH_PASSWORD']
37
45
  end
38
46
  mount api_docs, at: "docs"
39
47
  ROUTES
40
48
  end
41
49
 
42
- run 'bundle install'
43
-
44
50
  copy_file "app/controllers/api.rb"
45
51
  copy_file "app/controllers/api/api_controller.rb"
46
52
  copy_file "app/controllers/api/v1.rb"
@@ -53,8 +59,6 @@ mount api_docs, at: "docs"
53
59
  template "spec/features/api_spec.rb.erb", "spec/features/api_spec.rb"
54
60
  copy_file "spec/acceptance/ping_v1_spec.rb", "spec/acceptance/ping_v1_spec.rb"
55
61
 
56
- run 'bundle install'
57
-
58
62
  migration_template "db/migrate/enable_uuid_ossp_extension.rb", "db/migrate/enable_uuid_ossp_extension.rb"
59
63
  sleep 1 # allow clock to tick so we get different numbers
60
64
  migration_template "db/migrate/create_api_clients.rb", "db/migrate/create_api_clients.rb"
@@ -70,26 +74,23 @@ require 'stitches/spec'
70
74
 
71
75
  append_to_file 'spec/rails_helper.rb' do<<-RSPEC_API
72
76
  require 'rspec_api_documentation'
77
+
73
78
  RspecApiDocumentation.configure do |config|
74
- config.format = :json
75
- config.request_headers_to_include = %w(
76
- Accept
77
- Content-Type
78
- Authorization
79
- If-Modified-Since
80
- )
81
- config.response_headers_to_include = %w(
82
- Last-Modified
83
- ETag
84
- )
85
- config.api_name = "YOUR SERVICE NAME HERE"
79
+ config.format = :json
80
+ config.request_headers_to_include = %w(
81
+ Accept
82
+ Content-Type
83
+ Authorization
84
+ If-Modified-Since
85
+ )
86
+ config.response_headers_to_include = %w(
87
+ Last-Modified
88
+ ETag
89
+ )
90
+ config.api_name = "YOUR SERVICE NAME HERE"
86
91
  end
87
- RSPEC_API
92
+ RSPEC_API
88
93
  end
89
- run "rails g apitome:install"
90
- gsub_file 'config/initializers/apitome.rb', /config.mount_at = .*$/, "config.mount_at = nil"
91
- gsub_file 'config/initializers/apitome.rb', /config.title = .*$/, "config.title = 'Service Documentation'"
92
-
93
94
  end
94
95
  end
95
96
  end
@@ -1,3 +1,3 @@
1
1
  module Stitches
2
- VERSION = '3.7.3'
2
+ VERSION = '3.8.0'
3
3
  end
@@ -5,9 +5,10 @@ require "open3"
5
5
  RSpec.describe "Adding Stitches to a New Rails App", :integration do
6
6
  let(:work_dir) { Dir.mktmpdir }
7
7
  let(:rails_app_name) { "swamp-thing" }
8
+ let(:rails_root) { Pathname(work_dir) / rails_app_name }
8
9
 
9
10
  def run(command)
10
- stdout, stderr, stat = Open3.capture3(command)
11
+ stdout, stderr, stat = Open3.capture3({ 'BUNDLE_GEMFILE' => rails_root.join('Gemfile').to_path }, command)
11
12
  success = stat.success? && stdout !~ /Could not find generator/im
12
13
 
13
14
  if ENV["DEBUG"] == 'true' || !success
@@ -37,21 +38,30 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
37
38
  "--no-rc",
38
39
  "--skip-bundle",
39
40
  ].join(" ")
40
- FileUtils.chdir work_dir do
41
- run rails_new
42
- FileUtils.chdir rails_app_name do
43
- example.run
41
+
42
+ # Use this local version of stitches rather than the one on Rubygems
43
+ gem_path = File.expand_path("../..", File.dirname(__FILE__))
44
+ use_local_stitches = %{echo "gem 'stitches', path: '#{gem_path}'" >> Gemfile}
45
+
46
+ Bundler.with_clean_env do
47
+ FileUtils.chdir work_dir do
48
+ run rails_new
49
+
50
+ FileUtils.chdir rails_app_name do
51
+ run use_local_stitches
52
+ # It's unclear why, but on CI the gems are not found when installed
53
+ # through bundler however installing them explicitly first fixes it.
54
+ run "gem install apitome rspec-rails rspec_api_documentation"
55
+ run "bundle install"
56
+ example.run
57
+ end
44
58
  end
45
59
  end
46
60
  end
47
61
 
48
62
  it "works as described in the README" do
49
- run "bin/rails generate rspec:install"
50
- run "bin/rails generate apitome:install"
51
63
  run "bin/rails generate stitches:api"
52
64
 
53
- rails_root = Pathname(work_dir) / rails_app_name
54
-
55
65
  # Yuck! So much duplication! BUT: Rails app templates have a notoriously silent failure mode, so mostly
56
66
  # what this is doing is ensuring that the generator inserted stuff when asked and that the very basics of what happens
57
67
  # during generation are there. It's gross, and I'm sorry.
@@ -60,9 +70,7 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
60
70
  aggregate_failures do
61
71
  expect(File.exist?(rails_root / "app" / "controllers" / "api" / "api_controller.rb")).to eq(true)
62
72
  expect(rails_root / "Gemfile").to contain_gem("apitome")
63
- expect(rails_root / "Gemfile").to contain_gem("responders")
64
73
  expect(rails_root / "Gemfile").to contain_gem("rspec_api_documentation")
65
- expect(rails_root / "Gemfile").to contain_gem("capybara")
66
74
  expect(rails_root / "config" / "routes.rb").to have_route(namespace: :api, module_scope: :v1, resource: 'ping')
67
75
  expect(rails_root / "config" / "routes.rb").to have_route(namespace: :api, module_scope: :v2, resource: 'ping')
68
76
  expect(rails_root / "config" / "routes.rb").to have_mounted_engine("Apitome::Engine")
@@ -81,11 +89,7 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
81
89
  end
82
90
 
83
91
  it "inserts the deprecation module into ApiController" do
84
- run "bin/rails generate rspec:install"
85
- run "bin/rails generate apitome:install"
86
92
  run "bin/rails generate stitches:api"
87
-
88
- rails_root = Pathname(work_dir) / rails_app_name
89
93
  api_controller = rails_root / "app" / "controllers" / "api" / "api_controller.rb"
90
94
 
91
95
  api_controller_contents = File.read(api_controller).split(/\n/)
@@ -106,11 +110,8 @@ RSpec.describe "Adding Stitches to a New Rails App", :integration do
106
110
  end
107
111
 
108
112
  it "inserts can update old configuration" do
109
- run "bin/rails generate rspec:install"
110
- run "bin/rails generate apitome:install"
111
113
  run "bin/rails generate stitches:api"
112
114
 
113
- rails_root = Pathname(work_dir) / rails_app_name
114
115
  initializer = rails_root / "config" / "initializers" / "stitches.rb"
115
116
 
116
117
  initializer_contents = File.read(initializer).split(/\n/)
@@ -20,10 +20,8 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_runtime_dependency("rails")
22
22
  s.add_runtime_dependency("pg")
23
- s.add_runtime_dependency("rspec", ">= 3")
24
- s.add_runtime_dependency("rspec-rails", "~> 3")
25
- s.add_runtime_dependency("apitome")
26
23
 
24
+ s.add_development_dependency("rspec", ">= 3")
27
25
  s.add_development_dependency("rake")
28
26
  s.add_development_dependency("rspec_junit_formatter")
29
27
  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: 3.7.3
4
+ version: 3.8.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: 2019-05-16 00:00:00.000000000 Z
14
+ date: 2019-08-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -48,41 +48,13 @@ dependencies:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '3'
51
- type: :runtime
51
+ type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '3'
58
- - !ruby/object:Gem::Dependency
59
- name: rspec-rails
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - "~>"
63
- - !ruby/object:Gem::Version
64
- version: '3'
65
- type: :runtime
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '3'
72
- - !ruby/object:Gem::Dependency
73
- name: apitome
74
- requirement: !ruby/object:Gem::Requirement
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: '0'
79
- type: :runtime
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
58
  - !ruby/object:Gem::Dependency
87
59
  name: rake
88
60
  requirement: !ruby/object:Gem::Requirement
@@ -212,8 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
184
  - !ruby/object:Gem::Version
213
185
  version: '0'
214
186
  requirements: []
215
- rubyforge_project:
216
- rubygems_version: 2.7.6
187
+ rubygems_version: 3.0.3
217
188
  signing_key:
218
189
  specification_version: 4
219
190
  summary: You'll be in stitches at how easy it is to create a service at Stitch Fix