Skip to content

Commit

Permalink
staging content changes (-robo-commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
deploy-code-org committed Jan 11, 2019
1 parent dc4d0ba commit dbbef0b
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 32 deletions.
48 changes: 36 additions & 12 deletions dashboard/lib/tasks/asset_sync.rake
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
namespace :assets do
desc 'Synchronize assets to S3'
task sync: :environment do
require 'cdo/rake_utils'
# AWS CLI implements an optimized `sync` utility without any Ruby SDK equivalent.
cmd = "aws s3 sync #{dashboard_dir}/public/assets s3://#{CDO.assets_bucket}/#{CDO.assets_bucket_prefix}/assets --acl public-read --cache-control 'max-age=31536000'"
RakeUtils.system cmd
def manifest
app = Rails.application
app.assets = Sprockets::Railtie.build_environment(app)
Sprockets::Railtie.build_manifest(app)
end

desc 'Synchronize newly-added assets to S3'
task sync: :changed do
next if @changed_paths.empty?
puts "Copying #{@changed_paths.length} new assets to s3://#{CDO.assets_bucket}/#{CDO.assets_bucket_prefix}/assets/ : #{@changed_paths}"
require 'aws-sdk-s3'
require 'parallel'
bucket = Aws::S3::Resource.new.bucket(CDO.assets_bucket)
Parallel.each(@changed_paths, in_threads: 16) do |key, path|
bucket.object("#{CDO.assets_bucket_prefix}/assets/#{key}").upload_file(path, acl: 'public-read', cache_control: 'max-age=31536000')

This comment has been minimized.

Copy link
@breville

breville Jan 14, 2019

Member

Do we need to specify content_type here?

end
rescue
puts "Deleting #{@changed_paths.length} new assets because S3 sync failed.
Rerun `assets:precompile` to regenerate new assets and try again."
FileUtils.rm @changed_paths.values
raise
end

# Precompile application.js with js_compressor.
task precompile_application_js: :environment do
app = Rails.application
app.config.assets.js_compressor = :uglifier
app.assets = Sprockets::Railtie.build_environment(app)
Sprockets::Railtie.build_manifest(app).compile('application.js')
Rails.application.config.assets.js_compressor = :uglifier
manifest.compile('application.js')
end

desc 'Copy digested assets to non-digested file paths'
Expand All @@ -25,7 +38,7 @@ namespace :assets do
# this is necessary because webpack doesn't have any knowledge of
# the rails digests, so any images that get imported in javascript
# will reference the undigested file paths in the production js bundles.
# webpack adds it's own hash to filenames for imported images to get
# webpack adds its own hash to filenames for imported images to get
# cache busting behavior, so there is absolutely no need for the rails
# digest to be added to these files. Unfortunately, there is no way to
# tell rails which files to digest and which to not digest, so we
Expand All @@ -35,13 +48,24 @@ namespace :assets do
assets.each do |file|
next if File.directory?(file) || file !~ regex
non_digested = file.gsub(regex, '\1\2')
next if File.exist?(non_digested)
puts "Copying file #{file} to #{non_digested}"
FileUtils.cp(file, non_digested)
end
end

task record_manifest_files: :environment do
@manifest_files = manifest.files
end

task changed: :record_manifest_files do
m = manifest
@changed_paths = (m.files.to_a - @manifest_files.to_a).
map {|key, _| [key, File.join(m.dir, key)]}.to_h
end
end

Rake::Task['assets:precompile'].enhance do
Rake::Task['assets:precompile'].enhance([:record_manifest_files]) do
Rake::Task['assets:precompile_application_js'].invoke
Rake::Task['assets:no_digests'].invoke
Rake::Task['assets:sync'].invoke if CDO.cdn_enabled
Expand Down
2 changes: 1 addition & 1 deletion pegasus/data/cdo-cs-statistics.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Slide3_Diversity_K12,https://www.facebook.com/Code.org/photos/a.899372753492362.
Slide4_CS_Foundational,https://www.facebook.com/Code.org/photos/a.899372753492362.1073741858.309754825787494/1689600024469627/?type=3&theater
Slide5_CS_Education,https://www.facebook.com/Code.org/photos/a.899372753492362.1073741858.309754825787494/1689597964469833/?type=3&theater
Slide6_Computing_Jobs,https://www.facebook.com/Code.org/photos/a.899372753492362.1073741858.309754825787494/1664423290320634/?type=3&theater
Slide_States_Standards,https://www.facebook.com/Code.org/photos/a.899372753492362/1975221555907471/?type=3&theater
Slide_States_Standards,https://www.facebook.com/Code.org/photos/a.899372753492362/2013170245445935/?type=3&theater
Slide7_States_Map,https://www.facebook.com/Code.org/photos/a.899372753492362/1982113641884929/?type=3&theater
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ theme: responsive

## Change the face of computer science education - become a Code.org facilitator.

Code.org counts on engaging, committed, and knowledgeable facilitators to develop and support the next generation of computer science (CS) educators.
Code.org counts on engaging, committed, and knowledgeable facilitators to develop and support the next generation of computer science educators.

Applications for the Code.org Facilitator Development Program will open January 14, 2019. **If you are interested in joining the program in 2019-2020, please sign up below to receive a reminder when applications open.**
Ready to take your leadership to the next level?

<a href="https://goo.gl/forms/IPyERiuLCRG6jF0G3", target=_"blank"><button>Tell me when applications open!</button></a>
[<button>Apply now!</button></a>](https://studio.code.org/pd/application/facilitator)

Our online applications take 25-30 minutes to complete, and are not optimized for mobile devices. The deadline to apply for the 2019-20 Facilitator Development Program is **January 31, 2019.**

[/col-50]

Expand Down Expand Up @@ -178,37 +180,44 @@ Have questions? We have answers!

Check out our <a href="https://docs.google.com/document/d/e/2PACX-1vQzx_dR5g68Zzg7atSIZ_y8_tlSXln8dqBrW0oh1dQkTb6M56cdk3N9ozxgci4vJCdm6h3uwZ4douK4/pub", target=_"blank">FAQs</a> or write to us at facilitators@code.org

## Interested in applying?
## Apply now!

Applications for the Code.org Facilitator Development Program will open January 14, 2019. **If you are interested in joining the program in 2019-2020, please sign up below to receive a reminder when applications open.**
Ready to apply? Follow these steps:

<a href="https://goo.gl/forms/IPyERiuLCRG6jF0G3", target=_"blank"><button>Tell me when applications open!</button></a>
1. Check out our program specific commitments:
* <a href="https://code.org/files/facilitator/csf-commitments.pdf", target=_"blank">Computer Science Fundamentals Facilitator Development</a> - Grades K-5
* <a href="https://code.org/files/facilitator/csd-commitments.pdf", target=_"blank">Computer Science Discoveries Facilitator Development</a> - Grades 6-10
* <a href="https://code.org/files/facilitator/csp-commitments.pdf", target=_"blank">Computer Science Principles Facilitator Development</a> - Grades 9-12

1. Set aside 25-30 minutes to complete the online application. Note that our application is not optimized for mobile devices; we suggest completing it on a laptop or desktop.

In the meantime, be sure to visit our curriculum pages for additional information about our three courses.
[<button>Apply now!</button></a>](https://studio.code.org/pd/application/facilitator)

- [CS Fundamentals - Grades K-5](/educate/curriculum/elementary-school)
- [CS Discoveries - Grades 6-10](/educate/csd)
- [CS Principles - Grades 9-12](/educate/csp)
The deadline to apply for the 2019-20 Facilitator Development Program is **January 31, 2019.** Any appliaction submitted after January 31 will be considered if space is available.

In addition, we recommend that you make sure you're able to receive emails from facilitators@code.org at the email address you will use for your application. If this address is blocked by your district's firewall, please contact the appropriate IT representative at your school district to whitelist the address.


<!--
## Apply now!
Applications for the Code.org Facilitator Development Program will open January 14, 2019. **If you are interested in joining the program in 2019-2020, please sign up below to receive a reminder when applications open.**
Ready to apply? Follow these steps:
<a href="https://goo.gl/forms/IPyERiuLCRG6jF0G3", target=_"blank"><button>Tell me when applications open!</button></a>
1. Check out our program specific commitments:
* <a href="https://code.org/files/facilitator/csf-commitments.pdf", target=_"blank">Computer Science Fundamentals Facilitator Development</a> - Grades K-5
* <a href="https://code.org/files/facilitator/csd-commitments.pdf", target=_"blank">Computer Science Discoveries Facilitator Development</a> - Grades 6-10
* <a href="https://code.org/files/facilitator/csp-commitments.pdf", target=_"blank">Computer Science Principles Facilitator Development</a> - Grades 9-12
## Interested in applying?
1. Set aside 25-30 minutes to complete the online application. Note that our application is not optimized for mobile devices; we suggest completing it on a laptop or desktop.
Applications for the Code.org Facilitator Development Program will open January 14, 2019. **If you are interested in joining the program in 2019-2020, please sign up below to receive a reminder when applications open.**
<button>Apply now!</button></a>
<a href="https://goo.gl/forms/IPyERiuLCRG6jF0G3", target=_"blank"><button>Tell me when applications open!</button></a>
In the meantime, be sure to visit our curriculum pages for additional information about our three courses.
- [CS Fundamentals - Grades K-5](/educate/curriculum/elementary-school)
- [CS Discoveries - Grades 6-10](/educate/csd)
- [CS Principles - Grades 9-12](/educate/csp)
In addition, we recommend that you make sure you're able to receive emails from facilitators@code.org at the email address you will use for your application. If this address is blocked by your district's firewall, please contact the appropriate IT representative at your school district to whitelist the address.
-->

Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dbbef0b

Please sign in to comment.