darjeelink 0.14.5 → 0.14.6

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: 11b58c6d79e63e250e80fccc4dc0ab8aa6e1daf8848e51e14afd9a3637a6dea2
4
- data.tar.gz: 2ab545a7e59ac4a248f773ead73aeb4e35b3937afd3ffb37b912a1c537c6c8ea
3
+ metadata.gz: 4303964ff9a26e9645a23dc23ddf42b0e4c0149d96bf0be0ff190cdabe45a3e9
4
+ data.tar.gz: 923d1bc1d321f08b66cf519bad76ce50c07418558ab15d2b97185071ffc9aee7
5
5
  SHA512:
6
- metadata.gz: 92311cceed07587d5e2ba80c25849e1e7a39d4f7e37351482bd6eaa2d65b47bf712ff25600acae1b6508cab6ed65dc792cf9506b94093d8275005027e620bd75
7
- data.tar.gz: ed319fe3f5aaded52f783defcaedeb9efa2e199cf1a6e060cc23ad68318c872de5b95d49af7146ec4b2c0b2c9758e0afb493edf156c92dea947d8b61ccfcbdf1
6
+ metadata.gz: 701f1be73fdefefed0ae84171fc7ac341bda12b182eaefb48bc1d3654781163b79a9c022dbcbe0097cd6542a8831ede814a251fdf9adf65b3bec6a39c6887053
7
+ data.tar.gz: cd5a66b7216dce4a247a5a3ce586caf75ec259653228e76e31daad7745a708fdacd2de6fb7f35fbfe757027077d90ac8573677663116a07da18cffd3017e45eb
data/README.md CHANGED
@@ -120,9 +120,32 @@ Change the database url to be different to the development one i.e. `postgres://
120
120
  ## Releasing
121
121
  Darjeelink follows [Semantic Versioning](https://semver.org)
122
122
 
123
+ ### Pre-releasing - Staging tests
124
+ There are several ways to test the gem before releasing it.
125
+
126
+ One way, is to check the new development branch into Github, and then use `portkey-app` to test it in a staging environment.
127
+
128
+ - Create a new branch in the `darjeelink` repo with a sensible name related to your intended release: e.g. `darjeelink-v0.14.6-upgrade`.
129
+ - Perform the required upgrades, security patching, etc for the new release.
130
+ - Bump the version number as required (see below).
131
+ - Create a new branch in the `portkey-app` repo with a sensible name related to your intdended release: e.g. `darjeelink-v0.14.6-upgrade`.
132
+ - In the `Gemfile` of the portkey-app repo, change the `darjeelink` gem to point to the branch you just created in the darjeelink repo.
133
+ ```gemfile
134
+ # Actual URL Shortener
135
+ # gem 'darjeelink' <-- Temporarilly change this. Remeber to change it back, and run bundle install to update the Gemfile.lock when done!
136
+ gem 'darjeelink', git: 'https://github.com/38degrees/darjeelink.git',
137
+ branch: 'darjeelink-v0.14.6-upgrade'
138
+ ```
139
+ - Update the `Gemfile.lock` in the `portkey-app` repo by running `bundle install` and commit then push the changes.
140
+ - Deploy your branch of the portkey-app to the staging environment and test the changes.
141
+
142
+ NB: When you have followed the production release steps below and created a GitHub release, you can then update the `Gemfile` in the `portkey-app` repo to point to the new release tag.
143
+
144
+ ### Releasing - Production
145
+
123
146
  Once all necessary changes have made it in to master and you are ready to do a release you need to do these steps.
124
147
 
125
- Note that if you are running in a vagrant VM, most of these steps can be done from within the VM.
148
+ Note that if you are running in a vagrant VM or `docker-shell.sh` constainer, most of these steps can be done from the terminal session.
126
149
 
127
150
  - Update `lib/darjeelink/version.rb` to the new version
128
151
  - Run `bundle install` to pick up the change in Gemfile.lock
@@ -9,25 +9,27 @@ module Darjeelink
9
9
 
10
10
  private
11
11
 
12
- def determine_ip_to_verify
13
- if Rails.application.client_ip_header
14
- request.headers[Rails.application.client_ip_header]
15
- else
16
- request.ip
17
- end
18
- end
19
-
12
+ # Disabling these rubocop rules. This is a simple function and tested in production sinve version 0.14.4.
13
+ #
14
+ # rubocop:disable Metrics/AbcSize
15
+ # rubocop:disable Layout/LineLength
20
16
  # Check user IP address against whitelist from ENV
21
17
  def check_ip_whitelist
22
18
  return unless Rails.env.production?
23
19
  return unless Rails.application.config.permitted_ips
24
20
 
25
- ip_to_verify = determine_ip_to_verify
21
+ ip_to_verify = if Rails.application.config.respond_to?(:client_ip_header) && Rails.application.config.client_ip_header.present?
22
+ request.headers[Rails.application.config.client_ip_header]
23
+ else
24
+ request.ip
25
+ end
26
26
 
27
27
  return if Rails.application.config.permitted_ips.split(',').include? ip_to_verify
28
28
 
29
29
  render plain: 'Access Denied', status: :forbidden
30
30
  end
31
+ # rubocop:enable Metrics/AbcSize
32
+ # rubocop:enable Layout/LineLength
31
33
 
32
34
  # Authenticate against Google OAuth
33
35
  def authenticate
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Darjeelink
4
- VERSION = '0.14.5'
4
+ VERSION = '0.14.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darjeelink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.5
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hulme
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-13 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth