2014-01-24 23:58:37 +08:00
|
|
|
require 'json'
|
2013-05-29 00:55:17 +08:00
|
|
|
|
2011-10-14 04:57:20 +08:00
|
|
|
namespace :js do
|
2013-04-24 07:42:05 +08:00
|
|
|
|
2016-11-12 07:03:43 +08:00
|
|
|
desc "Build client_apps"
|
client app: canvas_quiz_statistics
This commit brings in canvas_quiz_statistics, a client app that can be
embedded in Canvas.
Closes CNVS-14781, CNVS-14846, CNVS-14847, CNVS-14850
> What's done
- full build integration, meaning the app runs with ?optimized_js=1:
+ JavaScript "built" source gets piped into the r.js build pipeline
like any other Canvas JS source in public/javascripts/*
+ SCSS sources get picked up by the sass-compiler like Canvas style
sources and they get compiled from the grounds-up
+ I18n: phrases are extracted properly, with default values and
options, by our i18n rake tasks
- new rake task js:build_client_apps that builds client apps and
injects them as input to the rest of the JS build process
- support for using Canvas JS packages, like d3, jQuery, and Backbone
- support for using Canvas SASS variables & helpers
- super i18n support: use raw I18n.t() calls like you are in Canvas,
with development-time interpolation, as well as super new
Handlebars-like block-style translations in React, perfect for very
long phrases (mini-articles)
> Docs and References
The code was originally developed in its own github repository. While I
won't be pushing code to that repo anymore, the Wiki will still house
the docs until we find a better place.
- Repo: https://github.com/amireh/canvas_quiz_statistics
- Development guide: http://bit.ly/1sNOhER
- Integration guide: http://bit.ly/1m9kA9V
> TESTING
- login as a teacher
- go to /courses/:course_id/quizzes/:quiz_id/statistics_cqs
+ make sure you see something that looks like the Ember stats
+ click one of those little "?" help icons, you get a dialog:
- verify the contents within the dialog are actual English text,
not code gibberish
- there's also a link at the end of that dialog, click it and
verify it takes you to an Instructure help article
- build the assets: `bundle exec rake canvas:compile_assets` then:
+ add ?optimized_js=1 to the URL and reload the page:
- verify the app still works
Change-Id: Ic474650dfb06a1c22869ed9680dd04d1ca0f651d
Reviewed-on: https://gerrit.instructure.com/39105
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Reviewed-by: Adam Ard <aard@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-06 15:04:23 +08:00
|
|
|
task :build_client_apps do
|
|
|
|
require 'config/initializers/client_app_symlinks'
|
|
|
|
|
|
|
|
Dir.glob('./client_apps/*/').each do |app_dir|
|
|
|
|
app_name = File.basename(app_dir)
|
|
|
|
|
|
|
|
Dir.chdir(app_dir) do
|
|
|
|
puts "Building client app '#{app_name}'"
|
|
|
|
|
2014-09-17 02:40:59 +08:00
|
|
|
if File.exists?('./package.json')
|
2017-08-13 02:25:33 +08:00
|
|
|
output = `yarn install`
|
client app: canvas_quiz_statistics
This commit brings in canvas_quiz_statistics, a client app that can be
embedded in Canvas.
Closes CNVS-14781, CNVS-14846, CNVS-14847, CNVS-14850
> What's done
- full build integration, meaning the app runs with ?optimized_js=1:
+ JavaScript "built" source gets piped into the r.js build pipeline
like any other Canvas JS source in public/javascripts/*
+ SCSS sources get picked up by the sass-compiler like Canvas style
sources and they get compiled from the grounds-up
+ I18n: phrases are extracted properly, with default values and
options, by our i18n rake tasks
- new rake task js:build_client_apps that builds client apps and
injects them as input to the rest of the JS build process
- support for using Canvas JS packages, like d3, jQuery, and Backbone
- support for using Canvas SASS variables & helpers
- super i18n support: use raw I18n.t() calls like you are in Canvas,
with development-time interpolation, as well as super new
Handlebars-like block-style translations in React, perfect for very
long phrases (mini-articles)
> Docs and References
The code was originally developed in its own github repository. While I
won't be pushing code to that repo anymore, the Wiki will still house
the docs until we find a better place.
- Repo: https://github.com/amireh/canvas_quiz_statistics
- Development guide: http://bit.ly/1sNOhER
- Integration guide: http://bit.ly/1m9kA9V
> TESTING
- login as a teacher
- go to /courses/:course_id/quizzes/:quiz_id/statistics_cqs
+ make sure you see something that looks like the Ember stats
+ click one of those little "?" help icons, you get a dialog:
- verify the contents within the dialog are actual English text,
not code gibberish
- there's also a link at the end of that dialog, click it and
verify it takes you to an Instructure help article
- build the assets: `bundle exec rake canvas:compile_assets` then:
+ add ?optimized_js=1 to the URL and reload the page:
- verify the app still works
Change-Id: Ic474650dfb06a1c22869ed9680dd04d1ca0f651d
Reviewed-on: https://gerrit.instructure.com/39105
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Reviewed-by: Adam Ard <aard@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-06 15:04:23 +08:00
|
|
|
unless $?.exitstatus == 0
|
2016-11-12 07:03:43 +08:00
|
|
|
puts "INSTALL FAILURE:\n#{output}"
|
client app: canvas_quiz_statistics
This commit brings in canvas_quiz_statistics, a client app that can be
embedded in Canvas.
Closes CNVS-14781, CNVS-14846, CNVS-14847, CNVS-14850
> What's done
- full build integration, meaning the app runs with ?optimized_js=1:
+ JavaScript "built" source gets piped into the r.js build pipeline
like any other Canvas JS source in public/javascripts/*
+ SCSS sources get picked up by the sass-compiler like Canvas style
sources and they get compiled from the grounds-up
+ I18n: phrases are extracted properly, with default values and
options, by our i18n rake tasks
- new rake task js:build_client_apps that builds client apps and
injects them as input to the rest of the JS build process
- support for using Canvas JS packages, like d3, jQuery, and Backbone
- support for using Canvas SASS variables & helpers
- super i18n support: use raw I18n.t() calls like you are in Canvas,
with development-time interpolation, as well as super new
Handlebars-like block-style translations in React, perfect for very
long phrases (mini-articles)
> Docs and References
The code was originally developed in its own github repository. While I
won't be pushing code to that repo anymore, the Wiki will still house
the docs until we find a better place.
- Repo: https://github.com/amireh/canvas_quiz_statistics
- Development guide: http://bit.ly/1sNOhER
- Integration guide: http://bit.ly/1m9kA9V
> TESTING
- login as a teacher
- go to /courses/:course_id/quizzes/:quiz_id/statistics_cqs
+ make sure you see something that looks like the Ember stats
+ click one of those little "?" help icons, you get a dialog:
- verify the contents within the dialog are actual English text,
not code gibberish
- there's also a link at the end of that dialog, click it and
verify it takes you to an Instructure help article
- build the assets: `bundle exec rake canvas:compile_assets` then:
+ add ?optimized_js=1 to the URL and reload the page:
- verify the app still works
Change-Id: Ic474650dfb06a1c22869ed9680dd04d1ca0f651d
Reviewed-on: https://gerrit.instructure.com/39105
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Reviewed-by: Adam Ard <aard@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-06 15:04:23 +08:00
|
|
|
raise "Package installation failure for client app #{app_name}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-13 02:25:33 +08:00
|
|
|
puts "\tRunning 'yarn run build'..."
|
2016-11-12 07:03:43 +08:00
|
|
|
output = `./script/build`
|
|
|
|
unless $?.exitstatus == 0
|
|
|
|
puts "BUILD FAILURE:\n#{output}"
|
|
|
|
raise "Build script failed for client app #{app_name}"
|
client app: canvas_quiz_statistics
This commit brings in canvas_quiz_statistics, a client app that can be
embedded in Canvas.
Closes CNVS-14781, CNVS-14846, CNVS-14847, CNVS-14850
> What's done
- full build integration, meaning the app runs with ?optimized_js=1:
+ JavaScript "built" source gets piped into the r.js build pipeline
like any other Canvas JS source in public/javascripts/*
+ SCSS sources get picked up by the sass-compiler like Canvas style
sources and they get compiled from the grounds-up
+ I18n: phrases are extracted properly, with default values and
options, by our i18n rake tasks
- new rake task js:build_client_apps that builds client apps and
injects them as input to the rest of the JS build process
- support for using Canvas JS packages, like d3, jQuery, and Backbone
- support for using Canvas SASS variables & helpers
- super i18n support: use raw I18n.t() calls like you are in Canvas,
with development-time interpolation, as well as super new
Handlebars-like block-style translations in React, perfect for very
long phrases (mini-articles)
> Docs and References
The code was originally developed in its own github repository. While I
won't be pushing code to that repo anymore, the Wiki will still house
the docs until we find a better place.
- Repo: https://github.com/amireh/canvas_quiz_statistics
- Development guide: http://bit.ly/1sNOhER
- Integration guide: http://bit.ly/1m9kA9V
> TESTING
- login as a teacher
- go to /courses/:course_id/quizzes/:quiz_id/statistics_cqs
+ make sure you see something that looks like the Ember stats
+ click one of those little "?" help icons, you get a dialog:
- verify the contents within the dialog are actual English text,
not code gibberish
- there's also a link at the end of that dialog, click it and
verify it takes you to an Instructure help article
- build the assets: `bundle exec rake canvas:compile_assets` then:
+ add ?optimized_js=1 to the URL and reload the page:
- verify the app still works
Change-Id: Ic474650dfb06a1c22869ed9680dd04d1ca0f651d
Reviewed-on: https://gerrit.instructure.com/39105
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Reviewed-by: Adam Ard <aard@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-06 15:04:23 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
puts "Client app '#{app_name}' was built successfully."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-18 11:52:39 +08:00
|
|
|
maintain_client_app_symlinks
|
client app: canvas_quiz_statistics
This commit brings in canvas_quiz_statistics, a client app that can be
embedded in Canvas.
Closes CNVS-14781, CNVS-14846, CNVS-14847, CNVS-14850
> What's done
- full build integration, meaning the app runs with ?optimized_js=1:
+ JavaScript "built" source gets piped into the r.js build pipeline
like any other Canvas JS source in public/javascripts/*
+ SCSS sources get picked up by the sass-compiler like Canvas style
sources and they get compiled from the grounds-up
+ I18n: phrases are extracted properly, with default values and
options, by our i18n rake tasks
- new rake task js:build_client_apps that builds client apps and
injects them as input to the rest of the JS build process
- support for using Canvas JS packages, like d3, jQuery, and Backbone
- support for using Canvas SASS variables & helpers
- super i18n support: use raw I18n.t() calls like you are in Canvas,
with development-time interpolation, as well as super new
Handlebars-like block-style translations in React, perfect for very
long phrases (mini-articles)
> Docs and References
The code was originally developed in its own github repository. While I
won't be pushing code to that repo anymore, the Wiki will still house
the docs until we find a better place.
- Repo: https://github.com/amireh/canvas_quiz_statistics
- Development guide: http://bit.ly/1sNOhER
- Integration guide: http://bit.ly/1m9kA9V
> TESTING
- login as a teacher
- go to /courses/:course_id/quizzes/:quiz_id/statistics_cqs
+ make sure you see something that looks like the Ember stats
+ click one of those little "?" help icons, you get a dialog:
- verify the contents within the dialog are actual English text,
not code gibberish
- there's also a link at the end of that dialog, click it and
verify it takes you to an Instructure help article
- build the assets: `bundle exec rake canvas:compile_assets` then:
+ add ?optimized_js=1 to the URL and reload the page:
- verify the app still works
Change-Id: Ic474650dfb06a1c22869ed9680dd04d1ca0f651d
Reviewed-on: https://gerrit.instructure.com/39105
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Reviewed-by: Adam Ard <aard@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-06 15:04:23 +08:00
|
|
|
end
|
|
|
|
|
2017-11-30 01:52:38 +08:00
|
|
|
desc "Build development webpack js"
|
|
|
|
task :webpack_development do
|
2017-10-10 03:40:51 +08:00
|
|
|
require 'config/initializers/plugin_symlinks'
|
2017-11-30 01:52:38 +08:00
|
|
|
puts "--> Building DEVELOPMENT webpack bundles"
|
|
|
|
system "yarn run webpack-development"
|
|
|
|
raise "Error running js:webpack_development: \nABORTING" if $?.exitstatus != 0
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Build production webpack js"
|
|
|
|
task :webpack_production do
|
|
|
|
require 'config/initializers/plugin_symlinks'
|
|
|
|
puts "--> Building PRODUCTION webpack bundles"
|
|
|
|
system "yarn run webpack-production"
|
|
|
|
raise "Error running js:webpack_production: \nABORTING" if $?.exitstatus != 0
|
2014-10-10 06:56:09 +08:00
|
|
|
end
|
|
|
|
|
2016-11-12 07:58:37 +08:00
|
|
|
desc "Ensure up-to-date node environment"
|
2017-08-13 02:25:33 +08:00
|
|
|
task :yarn_install do
|
2016-11-12 07:58:37 +08:00
|
|
|
puts "node is: #{`node -v`.strip} (#{`which node`.strip})"
|
2017-10-18 23:50:52 +08:00
|
|
|
system "yarn install --frozen-lockfile"
|
2017-04-07 21:25:09 +08:00
|
|
|
unless $?.success?
|
|
|
|
raise 'error running yarn install'
|
|
|
|
end
|
2016-11-12 07:58:37 +08:00
|
|
|
end
|
2016-11-16 07:49:20 +08:00
|
|
|
|
2011-10-14 04:57:20 +08:00
|
|
|
end
|