Skip to content

Commit

Permalink
remove line
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Aug 7, 2024
1 parent f9b4a64 commit a1b2fea
Show file tree
Hide file tree
Showing 34 changed files with 149 additions and 146 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'
ruby '3.3.4'

gem 'rails', '~> 7.1.3.4'
gem 'rails', '~> 7.2.0-rc1'
gem 'pg', '~> 1.3.4'
gem 'puma', '~> 6.4.2'
gem 'bcrypt', '~> 3.1.7'
Expand Down Expand Up @@ -52,7 +52,7 @@ gem 'kaminari', '~> 1.2.0'
# Postgres/DB extensions
gem 'active_record_union'
gem 'active_record_distinct_on', '~> 1.6'
gem 'activerecord_where_assoc', '~> 1.1.4'
gem 'activerecord_where_assoc', '~> 1.1.5'
gem 'ar_lazy_preload', '~> 2.0'
gem 'strong_migrations'

Expand Down Expand Up @@ -111,7 +111,7 @@ group :development, :test do
gem 'byebug', platform: :mri
gem 'dotenv-rails'
gem 'timecop', '~> 0.9.5'
gem 'bullet', '~> 7.1.6'
gem 'bullet', '~> 7.2'
gem 'parallel_tests', '~> 4.2.1'
gem 'cuke_modeler', '~> 3.19' # for running `parallel_test --group-by scenarios`
gem 'faker', '~> 2.20.0'
Expand Down
142 changes: 70 additions & 72 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,46 @@ GEM
concurrent-ruby (~> 1.0)
action_policy (0.6.3)
ruby-next-core (>= 0.14.0)
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
actioncable (7.2.0.rc1)
actionpack (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (7.2.0.rc1)
actionpack (= 7.2.0.rc1)
activejob (= 7.2.0.rc1)
activerecord (= 7.2.0.rc1)
activestorage (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
mail (>= 2.8.0)
actionmailer (7.2.0.rc1)
actionpack (= 7.2.0.rc1)
actionview (= 7.2.0.rc1)
activejob (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
actionpack (7.2.0.rc1)
actionview (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.4)
actionpack (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
useragent (~> 0.16)
actiontext (7.2.0.rc1)
actionpack (= 7.2.0.rc1)
activerecord (= 7.2.0.rc1)
activestorage (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
actionview (7.2.0.rc1)
activesupport (= 7.2.0.rc1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
Expand All @@ -68,33 +63,34 @@ GEM
activerecord (>= 6.1, < 7.2)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
activejob (7.2.0.rc1)
activesupport (= 7.2.0.rc1)
globalid (>= 0.3.6)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
activemodel (7.2.0.rc1)
activesupport (= 7.2.0.rc1)
activerecord (7.2.0.rc1)
activemodel (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
timeout (>= 0.4.0)
activerecord_where_assoc (1.1.4)
activerecord_where_assoc (1.1.5)
activerecord (>= 4.1.0)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activesupport (= 7.1.3.4)
activestorage (7.2.0.rc1)
actionpack (= 7.2.0.rc1)
activejob (= 7.2.0.rc1)
activerecord (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
marcel (~> 1.0)
activesupport (7.1.3.4)
activesupport (7.2.0.rc1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
anbt-sql-formatter (0.1.0)
Expand Down Expand Up @@ -122,7 +118,7 @@ GEM
bcrypt (3.1.17)
bigdecimal (3.1.8)
builder (3.2.4)
bullet (7.1.6)
bullet (7.2.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.3)
Expand Down Expand Up @@ -283,6 +279,7 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
lograge (0.12.0)
actionpack (>= 4)
activesupport (>= 4)
Expand All @@ -309,7 +306,6 @@ GEM
multi_test (0.1.2)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
mutex_m (0.2.0)
net-imap (0.4.12)
date
net-protocol
Expand Down Expand Up @@ -356,20 +352,20 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
actionmailer (= 7.1.3.4)
actionpack (= 7.1.3.4)
actiontext (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activemodel (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
rails (7.2.0.rc1)
actioncable (= 7.2.0.rc1)
actionmailbox (= 7.2.0.rc1)
actionmailer (= 7.2.0.rc1)
actionpack (= 7.2.0.rc1)
actiontext (= 7.2.0.rc1)
actionview (= 7.2.0.rc1)
activejob (= 7.2.0.rc1)
activemodel (= 7.2.0.rc1)
activerecord (= 7.2.0.rc1)
activestorage (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
bundler (>= 1.15.0)
railties (= 7.1.3.4)
railties (= 7.2.0.rc1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
Expand All @@ -380,10 +376,10 @@ GEM
rails-pattern_matching (0.2.0)
activemodel
activerecord
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
railties (7.2.0.rc1)
actionpack (= 7.2.0.rc1)
activesupport (= 7.2.0.rc1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
Expand Down Expand Up @@ -438,6 +434,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
securerandom (0.3.1)
semverse (3.0.2)
sendgrid-actionmailer (3.2.0)
mail (~> 2.7)
Expand Down Expand Up @@ -492,6 +489,7 @@ GEM
concurrent-ruby (~> 1.0)
uniform_notifier (1.16.0)
uri (0.12.2)
useragent (0.16.10)
webmock (3.14.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand All @@ -512,13 +510,13 @@ DEPENDENCIES
action_policy (~> 0.6.3)
active_record_distinct_on (~> 1.6)
active_record_union
activerecord_where_assoc (~> 1.1.4)
activerecord_where_assoc (~> 1.1.5)
anbt-sql-formatter
ar_lazy_preload (~> 2.0)
aws-sdk-s3 (~> 1)
barnes
bcrypt (~> 3.1.7)
bullet (~> 7.1.6)
bullet (~> 7.2)
byebug
cucumber-rails (~> 2.5)
cuke_modeler (~> 3.19)
Expand Down Expand Up @@ -552,7 +550,7 @@ DEPENDENCIES
rack-attack (~> 6.6)
rack-cors
rack-timeout
rails (~> 7.1.3.4)
rails (~> 7.2.0.pre.rc1)
rails-pattern_matching
redis (~> 4.7.1)
request_migrations (~> 1.1)
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ You can...
3. modify Keygen to add additional functionality.
4. fork Keygen into a private repo.

There's no clause that requires you to Open Source modifications made to Keygen
or other derivative works.

If the FCL happens to not work for your company or use-case, please [reach out][sales].

The license is available [here](https://keygen.sh/license/).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def show
attr_reader :package

def set_package
Current.resource = @package = FindByAliasService.call(
@package = Current.resource = FindByAliasService.call(
authorized_scope(current_account.release_packages.pypi),
id: params[:package],
aliases: :key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def show
attr_reader :package

def set_package
Current.resource = @package = FindByAliasService.call(
@package = Current.resource = FindByAliasService.call(
authorized_scope(current_account.release_packages.tauri),
id: params[:package],
aliases: :key,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/release_engines_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show
def set_engine
scoped_engines = authorized_scope(current_account.release_engines)

Current.resource = @engine = FindByAliasService.call(
@engine = Current.resource = FindByAliasService.call(
scoped_engines,
id: params[:id],
aliases: :key,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/release_packages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def destroy
def set_package
scoped_packages = authorized_scope(current_account.release_packages)

Current.resource = @package = FindByAliasService.call(
@package = Current.resource = FindByAliasService.call(
scoped_packages,
id: params[:id],
aliases: :key,
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/accountable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def has_account(default: nil, **kwargs)

# Hook into both initialization and validation to ensure the current account
# is applied to new records (given no :account was provided).
#
# We're not using belongs_to(default:) because it only adds a before_validation
# callback, but we want to also do it after_initialize because new children
# may rely on the account being set on their parent.
after_initialize -> { self.account_id ||= Current.account&.id },
unless: -> { account_id_attribute_assigned? || account_attribute_assigned? },
if: -> { new_record? && account_id.nil? }
Expand Down
9 changes: 6 additions & 3 deletions app/models/concerns/environmental.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ module Environmental
#
# Use :default to automatically configure a default environment for the model.
# Accepts a proc that resolves into an Environment or environment ID.
def has_environment(default: nil)
belongs_to :environment,
optional: true
def has_environment(default: nil, **kwargs)
belongs_to :environment, optional: true, **kwargs

tracks_attributes :environment_id,
:environment

# Hook into both initialization and validation to ensure the current environment
# is applied to new records (given no :environment was provided).
#
# We're not using belongs_to(default:) because it only adds a before_validation
# callback, but we want to also do it after_initialize because new children
# may rely on the environment being set on their parent.
after_initialize -> { self.environment_id ||= Current.environment&.id },
unless: -> { environment_id_attribute_assigned? || environment_attribute_assigned? },
if: -> { new_record? && environment.nil? }
Expand Down
3 changes: 3 additions & 0 deletions app/models/concerns/roleable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def define_roleable_association_and_delgate
accepts_nested_attributes_for :role, update_only: true
tracks_nested_attributes_for :role

validates :role,
presence: { message: 'must exist' }

delegate :permissions, :permission_ids, :role_permissions,
:role_permissions_attributes_assigned?, :role_permissions_attributes,
allow_nil: true,
Expand Down
6 changes: 6 additions & 0 deletions app/models/current.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ def account=(account)
self.token = nil
self.resource = nil
end

def account_id = account&.id
def environment_id = environment&.id
def bearer_id = bearer&.id
def token_id = token&.id
def resource_id = resource&.id
end
2 changes: 1 addition & 1 deletion app/models/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def owned = where(bearer: proxy_association.owner)

# TODO(ezekg) Should deleting queue up a cancelable background job?
has_many :webhook_endpoints, dependent: :destroy_async
has_many :webhook_event, dependent: :destroy_async
has_many :webhook_events, dependent: :destroy_async
has_many :entitlements, dependent: :destroy_async
has_many :groups, dependent: :destroy_async
has_many :products, dependent: :destroy_async
Expand Down
Loading

0 comments on commit a1b2fea

Please sign in to comment.