diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2017-05-29 14:32:37 +0300 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2017-05-29 14:32:37 +0300 |
commit | 33da8abfef7731d90365717d8a0c4d2f814ad319 (patch) | |
tree | a3af8291aa343ecbc62253ee1de8153ae8b917d4 /tasks | |
parent | f946e42f1d65481e2aca6520684125cdf0b89cba (diff) |
Update the updater task
Fixes #82
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/updater/js.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tasks/updater/js.rb b/tasks/updater/js.rb index 9332d21..b50ab63 100644 --- a/tasks/updater/js.rb +++ b/tasks/updater/js.rb @@ -3,12 +3,7 @@ class Updater def update_javascript_assets log_status 'Updating javascripts...' save_to = @save_to[:js] - contents = {} read_files('js/dist', bootstrap_js_files).each do |name, file| - contents[name] = file. - # Remove the source mapping URL comment as this gem does not bundle source maps. - sub!(%r(^//# sourceMappingURL=#{name}.map\n\z), '') or - fail "Cannot find source mapping URL to remove in #{name}. Last line: #{file.lines.last.inspect}" save_file("#{save_to}/#{name}", file) end log_processed "#{bootstrap_js_files * ' '}" @@ -32,8 +27,10 @@ class Updater def bootstrap_js_files @bootstrap_js_files ||= begin - gruntfile = get_file(file_url 'Gruntfile.js') - JSON.parse(/concat:.*?src: (\[[^\]]+\])/m.match(gruntfile)[1].tr("'", '"')).map { |p| p.sub %r(\Ajs/src/), '' } + package_json = get_file(file_url 'package.json') + JSON.parse(package_json)['scripts']['js-compile-bundle'] + .match(/shx cat (.*?) \|/)[1].split(/\s+/) + .map { |p| p.sub %r(\Ajs/src/), '' } end end end |