Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>
gem 'andand'
-gem 'trollop'
+gem 'optimist'
gem 'faye-websocket'
gem 'themes_for_rails', git: 'https://github.com/curoverse/themes_for_rails'
ref
thor (0.20.3)
thread_safe (0.3.6)
- trollop (2.9.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (2.7.2)
oj
omniauth (~> 1.4.0)
omniauth-oauth2 (~> 1.1)
+ optimist
passenger
pg (~> 0.18)
rails (~> 5.0.0)
test-unit (~> 3.0)
themes_for_rails!
therubyracer
- trollop
uglifier (~> 2.0)
BUNDLED WITH
# The following permit! is necessary even with
# "ActionController::Parameters.permit_all_parameters = true",
# because permit_all does not permit nested attributes.
+ raw_params ||= {}
+
if raw_params
+ raw_params = raw_params.to_hash
raw_params.delete_if { |k, _| self.protected_attributes.include? k }
serialized_attributes.each do |colname, coder|
param = raw_params[colname.to_sym]
end
def initialize raw_params={}, *args
- super(self.class.permit_attribute_params(raw_params.to_hash), *args)
+ super(self.class.permit_attribute_params(raw_params), *args)
end
# Reload "old attributes" for logging, too.
# discover a unique name. It is necessary to handle name choosing at
# this level (as opposed to the client) to ensure that record creation
# never fails due to a race condition.
- err = rn.original_exception
+ err = rn.cause
raise unless err.is_a?(PG::UniqueViolation)
# Unfortunately ActiveRecord doesn't abstract out any of the
end
rescue ActiveRecord::RecordNotFound => e
errors.add :owner_uuid, "is not owned by any user: #{e}"
- return false
+ throw(:abort)
end
if uuid_in_path[x]
if x == owner_uuid
else
errors.add :owner_uuid, "has an ownership cycle"
end
- return false
+ throw(:abort)
end
uuid_in_path[x] = true
end
FILE_TOKEN = /^[[:digit:]]+:[[:digit:]]+:/
def check_signatures
- return false if self.manifest_text.nil?
+ throw(:abort) if self.manifest_text.nil?
return true if current_user.andand.is_admin
end
def check_encoding
- if manifest_text.encoding.name == 'UTF-8' and manifest_text.valid_encoding?
- true
- else
+ if !(manifest_text.encoding.name == 'UTF-8' and manifest_text.valid_encoding?)
begin
# If Ruby thinks the encoding is something else, like 7-bit
# ASCII, but its stored bytes are equal to the (valid) UTF-8
rescue
end
errors.add :manifest_text, "must use UTF-8 encoding"
- false
+ throw(:abort)
end
end
true
rescue ArgumentError => e
errors.add :manifest_text, e.message
- false
+ throw(:abort)
end
end
end
end
- if self.state.in?(States)
- true
- else
+ if !self.state.in?(States)
errors.add :state, "'#{state.inspect} must be one of: [#{States.join ', '}]"
- false
+ throw(:abort)
end
end
def verify_repositories_empty
unless repositories.first.nil?
errors.add(:username, "can't be unset when the user owns repositories")
- false
+ throw(:abort)
end
end
#
# SPDX-License-Identifier: AGPL-3.0
-require 'trollop'
+require 'optimist'
-opts = Trollop::options do
+opts = Optimist::options do
banner 'Fail jobs that have state=="Running".'
banner 'Options:'
opt(:before,
# If get option is used, an existing anonymous user token is returned. If none exist, one is created.
# If the get option is omitted, a new token is created and returned.
-require 'trollop'
+require 'optimist'
-opts = Trollop::options do
+opts = Optimist::options do
banner ''
banner "Usage: get_anonymous_user_token "
banner ''
# Append to src_collection.name: " (reason; salvaged data at new_collection.uuid)"
# Set portable_data_hash to "d41d8cd98f00b204e9800998ecf8427e+0"
-require 'trollop'
+require 'optimist'
require './lib/salvage_collection'
include SalvageCollection
-opts = Trollop::options do
+opts = Optimist::options do
banner ''
banner "Usage: salvage_collection.rb " +
"{uuid} {reason}"
abort 'Error: Ruby >= 1.9.3 required.' if RUBY_VERSION < '1.9.3'
require 'logger'
-require 'trollop'
+require 'optimist'
log = Logger.new STDERR
log.progname = $0.split('/').last
-opts = Trollop::options do
+opts = Optimist::options do
banner ''
banner "Usage: #{log.progname} " +
"{user_uuid_or_email} {user_and_repo_name} {vm_uuid}"
log.level = (ENV['DEBUG'] || opts.debug) ? Logger::DEBUG : Logger::WARN
if ARGV.count != 3
- Trollop::die "required arguments are missing"
+ Optimist::die "required arguments are missing"
end
user_arg, user_repo_name, vm_uuid = ARGV