Skip to content

Commit

Permalink
stake: working megamode, fix code building
Browse files Browse the repository at this point in the history
  • Loading branch information
tongueroo committed Oct 20, 2018
1 parent 0e9a890 commit 86be762
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion exe/jets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# traps: INT - ^C
['INT', 'TERM', 'QUIT'].each do |signal|
trap(signal) do
puts "Detected stop signal 1"
puts "Detected stop signal"
sleep 0.2
exit
end
Expand Down
23 changes: 11 additions & 12 deletions lib/jets/builders/code_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,9 @@ def build
copy_project
Dir.chdir(full(tmp_code)) do
# These commands run from project root
start_code_setup
code_setup
package_ruby
finish_code_setup
setup_tmp
calculate_md5s # must be called before generate_node_shims and create_zip_files
generate_node_shims
create_zip_files
code_finish
end
end
time :build
Expand Down Expand Up @@ -153,23 +149,26 @@ def symlink_to_tmp(folder)
FileUtils.ln_sf("/tmp/#{folder}", "/#{full(tmp_code)}/#{folder}")
end

def start_code_setup
def code_setup
reconfigure_development_webpacker
end
time :start_code_setup

def finish_code_setup
return if poly_only?
time :code_setup

def code_finish
store_s3_base_url
setup_tmp
calculate_md5s # must be called before generate_node_shims and create_zip_files
generate_node_shims
create_zip_files
end
time :finish_code_setup
time :code_finish

# Store s3 base url is needed for asset serving from s3 later. Need to package this
# as part of the code so we have a reference to it.
# At this point the minimal stack exists, so we can grab it with the AWS API.
# We do not want to grab this as part of the live request because it is slow.
def store_s3_base_url
return if poly_only?
IO.write("#{full(tmp_code)}/config/s3_base_url.txt", s3_base_url)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/jets/builders/node-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ function log(text, level="info") {

const downloadTmp = async () => {
var bucket = '<%= @vars.s3_bucket %>'; // demo-dev-s3bucket-1inlzkvujq8zb
var key = 'jets/code/<%= @vars.rack_zip %>'; // jets/code/rack-acab864b.zip
var dest = '/tmp/<%= @vars.rack_zip %>'; // /tmp/rack-acab864b.zip
var key = 'jets/code/<%= @vars.rack_zip %>'; // jets/code/rack-checksum.zip
var dest = '/tmp/<%= @vars.rack_zip %>'; // /tmp/rack-checksum.zip
await download(bucket, key, dest);
await sh(`unzip -qo ${dest} -d /tmp/rack`);
await sh("ls /tmp/rack*");

key = 'jets/code/<%= @vars.bundled_zip %>'; // jets/code/bundled-8cc261ff.zip
dest = '/tmp/<%= @vars.bundled_zip %>'; // /tmp/bundled-8cc261ff.zip
key = 'jets/code/<%= @vars.bundled_zip %>'; // jets/code/bundled-checksum.zip
dest = '/tmp/<%= @vars.bundled_zip %>'; // /tmp/bundled-checksum.zip
await download(bucket, key, dest);
await sh(`unzip -qo ${dest} -d /tmp/bundled`);
await sh("ls /tmp/bundled*");
Expand Down
6 changes: 2 additions & 4 deletions lib/jets/builders/shim_vars/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ def s3_bucket

def rack_zip
checksum = Jets::Builders::Md5.checksums["stage/rack"]
"jets/code/rack-#{checksum}.zip"
# File.basename(IO.read("#{stage_area}/ref/rack.txt")).strip
"rack-#{checksum}.zip"
end

def bundled_zip
checksum = Jets::Builders::Md5.checksums["stage/bundled"]
"jets/code/bundled-#{checksum}.zip"
# File.basename(IO.read("#{stage_area}/ref/bundled.txt")).strip
"bundled-#{checksum}.zip"
end

def stage_area
Expand Down
2 changes: 1 addition & 1 deletion lib/jets/builders/tidy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def rm_rf(path)

# These directories will be removed regardless of dir level
def always_removals
%w[.git spec tmp cache]
%w[.git spec tmp]
end

def top_level_removals
Expand Down

0 comments on commit 86be762

Please sign in to comment.