Skip to content

Commit

Permalink
faker update, remove DEPENDENCIES_NEXT from deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Aug 29, 2023
1 parent d8a9b73 commit 36ca057
Show file tree
Hide file tree
Showing 21 changed files with 164 additions and 142 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ ARG SETTINGS__BULKRAX__ENABLED="false"
# DEPENDENCIES_NEXT=1 yarn install && \
# SOLR_URL=localhost DEPENDENCIES_NEXT=1 RAILS_ENV=production SECRET_KEY_BASE=fake-key-for-asset-building-only DB_ADAPTER=nulldb bundle exec rake assets:precompile"

# RUN sh -l -c " \
# yarn install && \
# SOLR_URL=localhost RAILS_ENV=production SECRET_KEY_BASE=fake-key-for-asset-building-only DB_ADAPTER=nulldb bundle exec rake assets:precompile"
RUN sh -l -c " \
yarn install && \
SOLR_URL=localhost RAILS_ENV=production SECRET_KEY_BASE=fake-key-for-asset-building-only DB_ADAPTER=nulldb bundle exec rake assets:precompile"

CMD ./bin/web

Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ group :development do
# gem 'spring'
# gem 'spring-watcher-listen', '~> 2.0.0'
gem "letter_opener"
gem 'faker'
gem 'faker', '~> 3.0'
# gem 'xray-rails' # should be commented out when actively using sidekiq.
end

Expand All @@ -93,7 +93,7 @@ gem 'carrierwave', '~> 1.3'
gem 'mysql2', '~> 0.5.3'
gem 'nokogiri'
gem 'bootstrap-multiselect-rails'
gem 'pbcore', '~> 0.3.0'
gem 'pbcore', github: 'scientist-softserv/pbcore', branch: 'fake_out'
gem 'curb'
# gem 'sony_ci_api', '~> 0.2.1'
# gem 'hyrax-iiif_av', '>= 0.2.0'
Expand Down
23 changes: 14 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ GIT
valkyrie (~> 3.0.1)
view_component (~> 2.74.1)

GIT
remote: https://github.com/scientist-softserv/pbcore.git
revision: 21677654f820dac3c8642b63e775ee2342a84114
branch: fake_out
specs:
pbcore (0.3.2)
factory_bot (~> 4.11)
nokogiri (~> 1.10)
sax-machine (~> 1.3)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -409,8 +419,8 @@ GEM
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
faker (1.9.6)
i18n (>= 0.7)
faker (3.2.1)
i18n (>= 1.8.11, < 2)
faraday (1.3.1)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
Expand Down Expand Up @@ -699,11 +709,6 @@ GEM
ast (~> 2.4.1)
racc
parslet (2.0.0)
pbcore (0.3.2)
factory_bot (~> 4.11)
faker (~> 1.9)
nokogiri (~> 1.10)
sax-machine (~> 1.3)
popper_js (1.16.1)
posix-spawn (0.3.15)
pry (0.14.2)
Expand Down Expand Up @@ -1141,7 +1146,7 @@ DEPENDENCIES
devise-guests (~> 0.6)
dotenv-rails
factory_bot_rails (~> 4.0)
faker
faker (~> 3.0)
fcrepo_wrapper
httparty (~> 0.21)
hydra-role-management (= 1.1.0)
Expand All @@ -1153,7 +1158,7 @@ DEPENDENCIES
listen (>= 3.0.5, < 3.2)
mysql2 (~> 0.5.3)
nokogiri
pbcore (~> 0.3.0)
pbcore!
pry-byebug
puma (~> 4.3)
rails (~> 6.0)
Expand Down
23 changes: 14 additions & 9 deletions Gemfile_next.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
GIT
remote: https://github.com/scientist-softserv/pbcore.git
revision: 21677654f820dac3c8642b63e775ee2342a84114
branch: fake_out
specs:
pbcore (0.3.2)
factory_bot (~> 4.11)
nokogiri (~> 1.10)
sax-machine (~> 1.3)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -164,8 +174,8 @@ GEM
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
faker (1.9.6)
i18n (>= 0.7)
faker (3.2.1)
i18n (>= 1.8.11, < 2)
faraday (2.7.10)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
Expand Down Expand Up @@ -233,11 +243,6 @@ GEM
parser (3.2.2.3)
ast (~> 2.4.1)
racc
pbcore (0.3.2)
factory_bot (~> 4.11)
faker (~> 1.9)
nokogiri (~> 1.10)
sax-machine (~> 1.3)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -438,7 +443,7 @@ DEPENDENCIES
devise-guests (~> 0.6)
dotenv-rails
factory_bot_rails (~> 4.0)
faker
faker (~> 3.0)
fcrepo_wrapper
httparty (~> 0.21)
jbuilder (~> 2.5)
Expand All @@ -447,7 +452,7 @@ DEPENDENCIES
listen (>= 3.0.5, < 3.2)
mysql2 (~> 0.5.3)
nokogiri
pbcore (~> 0.3.0)
pbcore!
pry-byebug
puma (~> 4.3)
rails-controller-testing
Expand Down
2 changes: 1 addition & 1 deletion app/input/multiple_date_input.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class MultipleDateInput < MultiValueInput
def build_field(value, index)
options = build_field_options(value, index)
options[:pattern] = AMS::NonExactDateService.regex.to_s
options[:pattern] = AMS::NonExactDateService.regex_string
options[:class] += ["datepicker","multi_value","multi-text-field"]

@builder.text_field(attribute_name, options)
Expand Down
2 changes: 1 addition & 1 deletion app/input/multiple_dates_with_types_input.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class MultipleDatesWithTypesInput < AMS::MultiTypedInput

def text_input_html_options(value, index)
super.merge( { pattern: AMS::NonExactDateService.regex.to_s } )
super.merge( { pattern: AMS::NonExactDateService.regex_string } )
end

def type_choices
Expand Down
2 changes: 1 addition & 1 deletion app/services/aapb/batch_ingest/zipped_pbcore_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def extraction_path
# TODO: fetch extraction path from Batch ingest config, if present.
@extraction_path ||= Rails.root.join("tmp", "imports", "batch_ingest", "#{Time.now.to_i}#{rand(1000)}")
ensure
FileUtils.mkdir_p @extraction_path unless Dir.exists? @extraction_path
FileUtils.mkdir_p @extraction_path unless Dir.exist? @extraction_path
end
end
end
Expand Down
19 changes: 5 additions & 14 deletions app/services/ams/non_exact_date_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@ module AMS
module NonExactDateService
def self.regex
regex = /\A[1-9][0-9]{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))\z|\A[1-9][0-9]{3}-(?:0[1-9]|1[0-2])\z|\A[1-9][0-9]{3}\z/;
class << regex
def to_s
super.gsub('\\A' , '^').
gsub('\\Z' , '$').
gsub('\\z' , '$').
gsub(/^\// , '').
gsub(/\/[a-z]*$/ , '').
gsub(/\(\?#.+\)/ , '').
gsub(/\(\?-\w+:/ , '(').
gsub(/\s/ , '')
end
end
return regex
end

def self.regex_string
"(^[1-9][0-9]{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$|^[1-9][0-9]{3}-(?:0[1-9]|1[0-2])$|^[1-9][0-9]{3}$)"
end

def self.valid?(value)
Expand All @@ -29,4 +20,4 @@ def self.invalid?(val)
return !self.valid?(val)
end
end
end
end
4 changes: 2 additions & 2 deletions app/views/records/edit_fields/_digitization_date.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if f.object.multiple? key %>
<%= f.input :digitization_date, as: :multiple_date,wrapper_html: { class: 'multi_value' }, input_html: { class: 'form-control' }, disabled:f.object.respond_to?(:disabled?) && f.object.disabled?(key), required: f.object.required?(key) %>
<% else %>
<%= f.input :digitization_date, input_html: { class: 'datepicker', pattern:AMS::NonExactDateService.regex.to_s }, disabled:f.object.respond_to?(:disabled?) && f.object.disabled?(key), html5: true, required: f.object.required?(key) %>
<% end %>
<%= f.input :digitization_date, input_html: { class: 'datepicker', pattern:AMS::NonExactDateService.regex_string }, disabled:f.object.respond_to?(:disabled?) && f.object.disabled?(key), html5: true, required: f.object.required?(key) %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if f.object.multiple? key %>
<%= f.input :digitization_date, as: :multiple_date,wrapper_html: { class: 'multi_value' }, input_html: { class: 'form-control' }, disabled:f.object.respond_to?(:disabled?) && f.object.disabled?(key), required: f.object.required?(key) %>
<% else %>
<%= f.input :digitization_date, input_html: { class: 'datepicker', pattern:AMS::NonExactDateService.regex.to_s }, disabled:f.object.respond_to?(:disabled?) && f.object.disabled?(key), html5: true, required: f.object.required?(key) %>
<% end %>
<%= f.input :digitization_date, input_html: { class: 'datepicker', pattern:AMS::NonExactDateService.regex_string }, disabled:f.object.respond_to?(:disabled?) && f.object.disabled?(key), html5: true, required: f.object.required?(key) %>
<% end %>
2 changes: 1 addition & 1 deletion bin/decrypt-secrets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Dir.chdir(File.join(parent_dir))
"ops/provision/.env.*"
].each do |files|
Dir.glob(files).each do |file|
if File.exists?(file + ".enc")
if File.exist?(file + ".enc")
cmd = "sops --decrypt #{file}.enc > #{file}"
puts cmd
`#{cmd}`
Expand Down
2 changes: 1 addition & 1 deletion bin/scripts/destroy_assets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ puts "Rails done loading."

# Fetch the file containing all the Asset IDs to destroy.
asset_ids_file_path = ARGV.first.to_s
raise ArgumentError, "File '#{asset_ids_file_path}' does not exist" unless File.exists? asset_ids_file_path
raise ArgumentError, "File '#{asset_ids_file_path}' does not exist" unless File.exist? asset_ids_file_path

# Fetch the Asset IDs from the file.
asset_ids = File.readlines asset_ids_file_path, chomp: true
Expand Down
2 changes: 1 addition & 1 deletion bin/scripts/destroy_tombstones
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ puts "Rails done loading."

# Fetch the file containing all the Tombstone IDs to destroy.
tombstone_ids_file_path = ARGV.first.to_s
raise ArgumentError, "File '#{tombstone_ids_file_path}' does not exist" unless File.exists? tombstone_ids_file_path
raise ArgumentError, "File '#{tombstone_ids_file_path}' does not exist" unless File.exist? tombstone_ids_file_path

# Fetch the Asset IDs from the file.
tombstone_ids = File.readlines tombstone_ids_file_path, chomp: true
Expand Down
2 changes: 1 addition & 1 deletion bin/scripts/print_bulkrax_duration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
total_objects_in_all_importers += total_objects_imported
total_time_for_all_importers += duration_in_seconds

report = CSV.read(file, :headers => true) if File.exists?(file)
report = CSV.read(file, :headers => true) if File.exist?(file)
if ARGV[0] && ARGV[0].include?('--generate')
headers = ["Importer ID", "Importer Type", "Total Objects Imported", "Duration in seconds", "Average", "Last Concurrency Value", "Last Run Date"]

Expand Down
Loading

0 comments on commit 36ca057

Please sign in to comment.