File tree Expand file tree Collapse file tree 6 files changed +29
-18
lines changed Expand file tree Collapse file tree 6 files changed +29
-18
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def check_imports
2020 def resync_with_remotes
2121 last_checked_at = session [ :synced_remotes_at ]
2222 if last_checked_at . nil? || last_checked_at < 15 . minutes . ago
23- PullAllFromGit . perform_later
23+ PullAllFromGit . perform_later unless Arquivo . static?
2424 end
2525 session [ :synced_remotes_at ] = Time . current
2626 end
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ def index
1212 # GET /entries/1.json
1313 def show
1414 if @entry . document?
15+ # TODO: why import these at all why not just open the frigging thing?
1516 blob = @entry . files . blobs . first
1617 expires_in ActiveStorage . service_urls_expire_in
1718 redirect_to rails_blob_path ( blob , disposition : params [ :disposition ] )
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ def find_or_create_notebook
2929 notebook = Notebook . find_by ( name : notebook_name )
3030 if notebook . nil?
3131 notebook = Notebook . create ( name : notebook_name ,
32- import_path : notebook_path )
32+ import_path : notebook_path ,
33+ skip_local_sync : true )
3334 else
3435 notebook . update ( import_path : notebook_path )
3536 end
@@ -70,16 +71,10 @@ def process_import_path(notebook)
7071
7172 filename = File . basename ( identifier )
7273 if !entry . files . blobs . find_by ( filename : filename )
73- # TODO 2023-11-23: mimic the same blob lifecycle handling from create_blob_and_file to avoid the async stuff noted below.
7474 blob = ActiveStorage ::Blob . create_and_upload! ( io : File . open ( file_path ) ,
75- filename : filename )
76-
77- # run analysis step synchronously, so we skip the async job.
78- # for reasons i don't comprehend, in dev mode at least
79- # ActiveStorage::AnalyzeJob just hangs there indefinitely, doing
80- # naught to improve our lot, and this is very frustrating and further
81- # i have close to zero desire to debug ActiveJob async shenanigans
82- blob . analyze
75+ filename : filename ,
76+ metadata : { "analyzed" => true } )
77+
8378 entry . files . create ( blob_id : blob . id , created_at : blob . created_at )
8479 end
8580 end
Original file line number Diff line number Diff line change 22require 'socket'
33
44Rails . application . configure do
5+ if Arquivo . static?
6+ # TODO WRITE A TEST TO CHECK IF STUFF IN /ASSETS MAKE SIT THRU
7+ # TO STATIC GENERATE
8+ config . assets . compile = false
9+ end
510 config . hosts << "arquivo.io"
611
712 # until we figure out how to multitenant this,
Original file line number Diff line number Diff line change 33Rails . application . configure do
44 config . hosts << "arquivo.io"
55 config . hosts << "arquivo.localhost"
6+ if Arquivo . static?
7+ config . hosts << "localhost"
8+ end
69
710 # until we figure out how to multitenant this,
811 config . active_storage . routes_prefix = ENV [ "ARQUIVO_USER" ] || "/phillmv/_"
Original file line number Diff line number Diff line change 11namespace :static do
22 desc 'Generate static site in ./out/ directory'
33 task :import => :environment do
4- SyncFromDisk . new ( ENV [ "NOTEBOOK_PATH" ] ) . import!
4+ if !Arquivo . static?
5+ puts "Buddy, we're not in static mode! Quitting..."
6+ exit 1
7+ end
8+
9+ sync_path = ENV [ "MAWL_INPUT_PATH" ] || "/mawl-input"
10+ SyncFromDisk . new ( sync_path ) . import!
511 end
612
713 task :generate do
8- if ENV [ "MAWB_OUTPUT" ]
9- folder = ENV [ "MAWB_OUTPUT" ]
10- else
11- folder = "out"
14+ if !Arquivo . static?
15+ puts "Buddy, we're not in static mode! Quitting..."
16+ exit 1
1217 end
1318
14- Dir . mkdir folder unless File . exist? folder
15- Dir . chdir folder do
19+ output_path = ENV [ "MAWL_OUTPUT_PATH" ] || "/output"
20+
21+ Dir . mkdir output_path unless File . exist? output_path
22+ Dir . chdir output_path do
1623 puts `wget --version`
1724 puts "######\n wget --domains localhost --recursive --page-requisites --html-extension --convert-links -nH localhost:3000 localhost:3000/hidden_entries"
1825 `wget --domains localhost --recursive --page-requisites --html-extension --convert-links -nH localhost:3000 localhost:3000/hidden_entries`
You can’t perform that action at this time.
0 commit comments