From 8f1b4854bd23547e355b3a3155766bfc46244894 Mon Sep 17 00:00:00 2001 From: yarko Date: Thu, 30 Jan 2014 12:12:47 -0600 Subject: [PATCH 1/3] assets: add theme path to coffeescript's processing rakefile: fix so assets/coffee use env vars & feature settings --- rakefile | 12 ++++++++++++ rakelib/assets.rake | 12 +++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/rakefile b/rakefile index 2cf442bca9fc..c4ae489dce13 100644 --- a/rakefile +++ b/rakefile @@ -15,6 +15,18 @@ REPORT_DIR = File.join(REPO_ROOT, "reports") # Environment constants SERVICE_VARIANT = ENV['SERVICE_VARIANT'] +# if service variant, honor that; +# - if not, pass the correct ENV tokens for lms or cms +if not SERVICE_VARIANT + # ignore command line environments, e.g. "rake e1=this" + clean_args = ARGV.delete_if { |x| /=/.match(x) } + # consider only the words remaining (parse out separators); + clean_args = clean_args.join(' ').split(/\W/) + # if lms or cms is among command line words, use it's env: + SERVICE_VARIANT = clean_args.include?('lms') ? "lms" : + (clean_args.include?('studio') or clean_args.include?('cms')) ? "cms" : + SERVICE_VARIANT +end CONFIG_PREFIX = SERVICE_VARIANT ? SERVICE_VARIANT + "." : "" ENV_FILE = File.join(ENV_ROOT, CONFIG_PREFIX + "env.json") ENV_TOKENS = File.exists?(ENV_FILE) ? JSON.parse(File.read(ENV_FILE)) : {} diff --git a/rakelib/assets.rake b/rakelib/assets.rake index 98a4f7ba5431..bcd12e3d7385 100644 --- a/rakelib/assets.rake +++ b/rakelib/assets.rake @@ -1,4 +1,5 @@ # Theming constants + USE_CUSTOM_THEME = ENV_TOKENS.has_key?('FEATURES') && ENV_TOKENS['FEATURES']['USE_CUSTOM_THEME'] if USE_CUSTOM_THEME THEME_NAME = ENV_TOKENS['THEME_NAME'] @@ -23,17 +24,22 @@ def xmodule_cmd(watch=false, debug=false) end def coffee_cmd(watch=false, debug=false) + brew_paths = ["lms/", "cms/", "common/"] + if USE_CUSTOM_THEME + # put theme path first just to be safe; + brew_paths.unshift(THEME_ROOT) + end + if watch && Launchy::Application.new.host_os_family.darwin? available_files = Process::getrlimit(:NOFILE)[0] if available_files < MINIMAL_DARWIN_NOFILE_LIMIT Process.setrlimit(:NOFILE, MINIMAL_DARWIN_NOFILE_LIMIT) - end end if watch - "node_modules/.bin/coffee --compile --watch lms/ cms/ common/" + "node_modules/.bin/coffee --compile --watch #{brew_paths.join(' ')}" else - "node_modules/.bin/coffee --compile `find lms/ cms/ common/ -type f -name *.coffee` " + "node_modules/.bin/coffee --compile `find #{brew_paths.join(' ')} -type f -name *.coffee` " end end From 1f34113af3f78ece97cf1d94df13f152339481fc Mon Sep 17 00:00:00 2001 From: yarko Date: Tue, 11 Mar 2014 00:51:13 -0500 Subject: [PATCH 2/3] when custom theme enabled, cms must be able to handle theme path; use same startup.py as lms. --- cms/startup.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) mode change 100644 => 120000 cms/startup.py diff --git a/cms/startup.py b/cms/startup.py deleted file mode 100644 index 13225f4a4942..000000000000 --- a/cms/startup.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -Module with code executed during Studio startup -""" -from django.conf import settings - -# Force settings to run so that the python path is modified -settings.INSTALLED_APPS # pylint: disable=W0104 - -from django_startup import autostartup - - -def run(): - """ - Executed during django startup - """ - autostartup() diff --git a/cms/startup.py b/cms/startup.py new file mode 120000 index 000000000000..5d0a9f8df340 --- /dev/null +++ b/cms/startup.py @@ -0,0 +1 @@ +../lms/startup.py \ No newline at end of file From cd27ee4c1b4a6703978ff62d7b78d62511c07a9b Mon Sep 17 00:00:00 2001 From: yarko Date: Tue, 18 Mar 2014 00:56:37 -0500 Subject: [PATCH 3/3] remove trailing space on line 26; --- rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakefile b/rakefile index c4ae489dce13..1dc47e76e026 100644 --- a/rakefile +++ b/rakefile @@ -23,7 +23,7 @@ if not SERVICE_VARIANT # consider only the words remaining (parse out separators); clean_args = clean_args.join(' ').split(/\W/) # if lms or cms is among command line words, use it's env: - SERVICE_VARIANT = clean_args.include?('lms') ? "lms" : + SERVICE_VARIANT = clean_args.include?('lms') ? "lms" : (clean_args.include?('studio') or clean_args.include?('cms')) ? "cms" : SERVICE_VARIANT end