Skip to content

Commit 8d6d094

Browse files
authored
feat: Skippable Railties & Release Flow (#81)
* feat: Allow for the Railtie to be skippable * build: Create repeatable release flow
1 parent d53cb21 commit 8d6d094

File tree

9 files changed

+39
-12
lines changed

9 files changed

+39
-12
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
clerk-sdk-ruby (4.0.0.beta4)
4+
clerk-sdk-ruby (4.0.0.beta6)
55
clerk-http-client (= 2.0.0.beta5)
66
concurrent-ruby (~> 1.1)
77
faraday (>= 1.4.1, < 3.0)

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,19 @@ end
166166

167167
This gives your controller and views access to the following methods and more:
168168

169+
- `clerk.sdk.*`
169170
- `clerk.session`
170171
- `clerk.user`
171172
- `clerk.user?`
172173

174+
### Skipping the Railtie
175+
176+
There are cases where you might not want to use the Railtie, for example, only using the SDK in a Rails application. To accomplish this, you can set the `CLERK_SKIP_RAILTIE` environment variable to `true`.
177+
178+
This will prevent the Railtie from being loaded and the Rack middleware from being added to the middleware stack.
179+
180+
You can still configure the SDK as normal, but you will need to call the SDK using `Clerk::SDK.new` instead of the `clerk.sdk` helper.
181+
173182
## Sinatra integration
174183

175184
The SDK enables the use of Extensions to add Clerk support to your Sinatra application.

apps/rails-api/Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PATH
22
remote: ../..
33
specs:
4-
clerk-sdk-ruby (4.0.0.beta4)
5-
clerk-http-client (~> 0.0.1)
4+
clerk-sdk-ruby (4.0.0.beta6)
5+
clerk-http-client (= 2.0.0.beta5)
66
concurrent-ruby (~> 1.1)
77
faraday (>= 1.4.1, < 3.0)
88
jwt (~> 2.5)
@@ -93,7 +93,7 @@ GEM
9393
brakeman (7.0.0)
9494
racc
9595
builder (3.3.0)
96-
clerk-http-client (0.0.1)
96+
clerk-http-client (2.0.0.beta5)
9797
faraday (>= 1.0.1, < 3.0)
9898
faraday-multipart
9999
marcel

apps/rails-full/Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PATH
22
remote: ../..
33
specs:
4-
clerk-sdk-ruby (4.0.0.beta4)
5-
clerk-http-client (~> 0.0.1)
4+
clerk-sdk-ruby (4.0.0.beta6)
5+
clerk-http-client (= 2.0.0.beta5)
66
concurrent-ruby (~> 1.1)
77
faraday (>= 1.4.1, < 3.0)
88
jwt (~> 2.5)
@@ -105,7 +105,7 @@ GEM
105105
rack-test (>= 0.6.3)
106106
regexp_parser (>= 1.5, < 3.0)
107107
xpath (~> 3.2)
108-
clerk-http-client (0.0.1)
108+
clerk-http-client (2.0.0.beta5)
109109
faraday (>= 1.0.1, < 3.0)
110110
faraday-multipart
111111
marcel

bin/release

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
set -eo pipefail
3+
IFS=$'\n\t'
4+
5+
# Get the version number from the generated version file
6+
VERSION=$(ruby -e "require './lib/clerk/version.rb'; puts Clerk::VERSION")
7+
8+
echo "Building and releasing version ${VERSION}"
9+
10+
# Remove any existing gem files
11+
rm clerk-sdk-ruby-*.gem || true
12+
13+
# Build the gem
14+
gem build clerk-sdk-ruby.gemspec
15+
16+
# Publish to RubyGems
17+
gem push "clerk-sdk-ruby-${VERSION}.gem"
18+

lib/clerk/rails.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
require "clerk"
22
require "clerk/authenticatable"
3-
require "clerk/railtie"
3+
require "clerk/railtie" if defined?(Rails::Railtie)

lib/clerk/railtie.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ module Clerk
66
module Rails
77
class Railtie < ::Rails::Railtie
88
initializer "clerk.configure_rails_initialization" do |app|
9-
app.middleware.use Clerk::Rack::Middleware
9+
unless ENV["CLERK_SKIP_RAILTIE"]
10+
app.middleware.use Clerk::Rack::Middleware
11+
end
1012
end
1113
end
1214
end

lib/clerk/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Clerk
4-
VERSION = "4.0.0.beta5"
4+
VERSION = "4.0.0.beta6"
55
end

spec/clerk/sdk_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,3 @@
145145
end
146146
end
147147
end
148-
149-

0 commit comments

Comments
 (0)