Skip to content

Commit

Permalink
feat(rack-cors): update rack cors to ~> 1.1
Browse files Browse the repository at this point in the history
closes #265
  • Loading branch information
rjherrera authored and LuisFros committed Feb 21, 2020
1 parent f6aa505 commit 70c7dd9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Features:
- Split specs by timings in CircleCI [#263](https://github.com/platanus/potassium/pull/263)
- Update ruby to 2.7.0 [#264](https://github.com/platanus/potassium/pull/264)
- Add tailwindcss [#266](https://github.com/platanus/potassium/pull/266)
- Update rack-cors to 1.1 [#269](https://github.com/platanus/potassium/pull/269)

Fix:
- Correctly use cache for bundle dependencies in CircleCI build [#244](https://github.com/platanus/potassium/pull/244) and [#258](https://github.com/platanus/potassium/pull/258)
Expand Down
32 changes: 17 additions & 15 deletions lib/potassium/recipes/rack_cors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ def install
end

def create
gather_gem('rack-cors', '~> 0.4.0')
gather_gem('rack-cors', '~> 1.1')
recipe = self
after(:gem_install) do
rack_cors_config =
<<~RUBY
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*',
headers: :any,
expose: ['X-Page', 'X-PageTotal'],
methods: [:get, :post, :delete, :put, :options]
end
end
application recipe.rack_cors_config
end
end

RUBY
def rack_cors_config
<<~RUBY
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*',
headers: :any,
expose: ['X-Page', 'X-PageTotal'],
methods: [:get, :post, :delete, :put, :options]
end
end
application rack_cors_config
end
RUBY
end
end

0 comments on commit 70c7dd9

Please sign in to comment.