Skip to content

Commit

Permalink
updates the build process / builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Oct 13, 2013
1 parent 1641e97 commit d705ddc
Show file tree
Hide file tree
Showing 22 changed files with 6,081 additions and 5,994 deletions.
49 changes: 25 additions & 24 deletions Rakefile
Expand Up @@ -19,8 +19,7 @@ namespace :build do
locales: 'mercury/locales.js',
regions: 'mercury/regions.js',
base: 'mercury/mercury.js',
config: 'mercury/config.js',
other: []
config: 'mercury/config.js'
}

desc "Compile coffeescripts into javascripts"
Expand All @@ -30,10 +29,25 @@ namespace :build do
config = env.find_asset(javascripts[:config])
base = env.find_asset(javascripts[:base])

# base javascripts and configuration
puts " base: mercury.js"
File.open(output_path.join('mercury.js'), 'w') do |file|
file.write(config.source)
file.write(base.source)
end

# minified base javascripts and not minified configuration
puts " base: mercury.min.js"
File.open(output_path.join('mercury.min.js'), 'w') do |file|
file.write(config.source)
file.write(Uglifier.compile(base.source, squeeze: true))
end

# write dependencies
env.find_asset(javascripts[:dependencies]).send(:required_assets).each do |asset|
filename = File.basename(asset.logical_path)
next if filename == 'dependencies.js'
puts " dependency: #{filename}"

asset.write_to(output_path.join('dependencies', filename))
end
Expand All @@ -42,6 +56,7 @@ namespace :build do
env.find_asset(javascripts[:locales]).send(:required_assets).each do |asset|
filename = File.basename(asset.logical_path)
next if filename == 'locales.js'
puts " locale: #{filename}"

asset.write_to(output_path.join('locales', filename))
end
Expand All @@ -50,42 +65,26 @@ namespace :build do
env.find_asset(javascripts[:regions]).send(:required_assets).each do |asset|
filename = File.basename(asset.logical_path)
next if filename == 'regions.js'
next unless asset.logical_path =~ /^mercury/
puts " region: #{filename}"

Rails.application.config.assets.debug = false
asset = env.find_asset(asset.logical_path)
asset.write_to(output_path.join('regions', filename))
Rails.application.config.assets.debug = true

File.open(output_path.join('regions', filename.gsub(/\.js$/, '.min.js')), 'w') do |file|
file.write(Uglifier.compile(asset.source, squeeze: true))
end
end

# base javascripts and configuration
File.open(output_path.join('mercury.js'), 'w') do |file|
file.write(config.source)
file.write(base.source)
end

# minified base javascripts and not minified configuration
File.open(output_path.join('mercury.min.js'), 'w') do |file|
file.write(config.source)
file.write(Uglifier.compile(base.source, squeeze: true))
end

# compile other javascripts
javascripts[:other].each do |path|
asset = env.find_asset(path)
asset.write_to(output_path.join(path))

File.open(output_path.join(path.gsub('.js', '.min.js')), 'w') do |file|
file.write(Uglifier.compile(asset.source, squeeze: true))
end
end
end

desc "Compile sass files into css"
task :stylesheets => :environment do
puts 'Building stylesheets...'

stylesheets.each do |path|
puts " base: #{path}"
asset = env.find_asset(path)
asset.write_to(output_path.join(path))

Expand Down Expand Up @@ -117,6 +116,7 @@ namespace :build do
puts 'Building fonts...'

fontcustom.each do |config|
puts " fontcustom: #{config}"
`fontcustom compile --config lib/fonts/glyphs/#{config}`
end
end
Expand All @@ -128,6 +128,7 @@ namespace :build do
FileUtils.mkdir_p(output_path.join('assets'))
for path in asset_paths
for file in Dir[Rails.root.join('lib', path)]
puts " #{File.directory?(file) ? 'path' : 'file'}: #{File.basename(file)}"
FileUtils.cp_r file, output_path.join('assets')
end
end
Expand Down
Binary file modified distro/assets/mercury-icons.eot
Binary file not shown.
2 changes: 1 addition & 1 deletion distro/assets/mercury-icons.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified distro/assets/mercury-icons.ttf
Binary file not shown.
Binary file modified distro/assets/mercury-icons.woff
Binary file not shown.
1 change: 1 addition & 0 deletions distro/dependencies/liquidmetal-1.2.1.js
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2009-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
*/


var LiquidMetal = (function() {
var SCORE_NO_MATCH = 0.0;
var SCORE_MATCH = 1.0;
Expand Down
7 changes: 6 additions & 1 deletion distro/mercury.bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion distro/mercury.css
Expand Up @@ -381,6 +381,8 @@ This file contains all of the required css for the Mercury interface as well as
.mercury-dialog input[type="radio"],
.mercury-dialog input[type="checkbox"] {
width: auto; }
.mercury-dialog input[type="search"] {
border-radius: 20px; }
.mercury-dialog select,
.mercury-dialog input[type="file"] {
width: auto;
Expand Down Expand Up @@ -2005,10 +2007,27 @@ mercury .mercury-toolbar .mercury-color-palette {
color: #fff;
margin: 1px 0 -1px -1px; }

mercury .mercury-snippets-panel ul {
mercury .mercury-history-panel ul {
margin: 0;
padding: 0;
list-style: none; }
mercury .mercury-history-panel ul li {
padding: 5px 0;
border-bottom: 1px solid #666;
font-size: 80%;
color: #ccc; }
mercury .mercury-history-panel ul li h4 {
margin: 0;
font-size: 120%;
text-shadow: 1px 1px #000;
color: #eee; }
mercury .mercury-history-panel ul li h4 a {
color: #ddd !important; }

mercury .mercury-snippets-panel ul {
margin: 15px 0 0;
padding: 0;
list-style: none; }
mercury .mercury-snippets-panel ul li {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
Expand Down
102 changes: 86 additions & 16 deletions distro/mercury.js
Expand Up @@ -868,8 +868,11 @@ Copyright (c) 2013 Jeremy Jackson

moduleKeywords = ['included', 'extended', 'private'];

Module.extend = function(object) {
Module.extend = function(object, apply) {
var method, module, name, _ref;
if (apply == null) {
apply = 'extended';
}
if (!object) {
throw new Error('extend expects an object');
}
Expand All @@ -881,11 +884,14 @@ Copyright (c) 2013 Jeremy Jackson
}
this[name] = method;
}
return (_ref = module.extended) != null ? _ref.apply(this) : void 0;
return (_ref = module[apply]) != null ? _ref.apply(this) : void 0;
};

Module.include = function(object) {
Module.include = function(object, apply) {
var method, module, name, _ref;
if (apply == null) {
apply = 'included';
}
if (!object) {
throw new Error('include expects an object');
}
Expand All @@ -897,7 +903,15 @@ Copyright (c) 2013 Jeremy Jackson
}
this.prototype[name] = method;
}
return (_ref = module.included) != null ? _ref.apply(this.prototype) : void 0;
return (_ref = module[apply]) != null ? _ref.apply(this.prototype) : void 0;
};

Module.mixin = function(object) {
if (object.klass) {
this.extend(object.klass);
delete object.klass;
}
return this.include(object);
};

Module.proxy = function(callback) {
Expand All @@ -908,7 +922,13 @@ Copyright (c) 2013 Jeremy Jackson
};

function Module() {
var mixin, _i, _len, _ref;
this.__handlers__ = $.extend(true, {}, this.__handlers__);
_ref = (this.mixins || []).concat(this.constructor.mixins || []);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
mixin = _ref[_i];
Mercury.Module.extend.call(this, mixin, 'included');
}
if (typeof this.init === "function") {
this.init.apply(this, arguments);
}
Expand Down Expand Up @@ -2966,6 +2986,27 @@ Copyright (c) 2013 Jeremy Jackson
return new (Mercury.Region[type] || Mercury.Region)(el);
};

Region.addBehavior = function(name, options) {
var toolbar;
if (options == null) {
options = {};
}
if (options.action) {
this.addAction(name, options.action);
}
if (options.context) {
this.addContext(name, options.context);
}
if (options.data) {
this.addData(name, options.data);
}
if (options.toolbar) {
toolbar = {};
toolbar[name] = options.toolbar;
return this.addToolbar(name, toolbar);
}
};

Region.addAction = function(action, handler) {
var actions;
if (typeof action === 'object') {
Expand Down Expand Up @@ -3546,6 +3587,39 @@ Copyright (c) 2013 Jeremy Jackson
}
};

}).call(this);
(function() {
Mercury.View.Modules.FilterableList = {
included: function() {
return this.on('show', this.buildFilterable);
},
buildFilterable: function() {
if (!LiquidMetal) {
return this.$('input.mercury-filter').hide();
}
console.debug('testing');
return this.delegateEvents({
'keyup input.mercury-filter': this.onFilter,
'search input.mercury-filter': this.onFilter
});
},
onFilter: function(e) {
var item, value, _i, _len, _ref, _results;
value = $(e.target).val();
_ref = this.$('li[data-filter]');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
if (LiquidMetal.score((item = $(item)).data('filter'), value) <= 0.5) {
_results.push(item.hide());
} else {
_results.push(item.show());
}
}
return _results;
}
};

}).call(this);
(function() {
Mercury.View.Modules.InterfaceMaskable = {
Expand Down Expand Up @@ -7072,24 +7146,22 @@ Copyright (c) 2013 Jeremy Jackson
return _ref;
}

Panel.prototype.mixins = [Mercury.View.Modules.FilterableList];

Panel.prototype.template = 'history';

Panel.prototype.className = 'mercury-history-panel';

Panel.prototype.title = 'Page Version History';

Panel.prototype.width = 250;
Panel.prototype.width = 300;

Panel.prototype.hidden = true;

return Panel;

})(Mercury.Panel);

JST['/mercury/templates/history'] || (JST['/mercury/templates/history'] = function() {
return "<input type=\"text\" class=\"search-input\"/>\n<p>The History Plugin expects a server implementation.</p>\n<p>Since this is a demo, it wasn't included, but you can check the <a href=\"https://github.com/jejacks0n/mercury-rails\">mercury-rails project</a> on github for examples of how to integrate it with your server technology.</p>";
});

}).call(this);
(function() {
var Plugin, _ref,
Expand Down Expand Up @@ -7499,6 +7571,8 @@ Copyright (c) 2013 Jeremy Jackson
return _ref;
}

Panel.prototype.mixins = [Mercury.View.Modules.FilterableList];

Panel.prototype.template = 'snippets';

Panel.prototype.className = 'mercury-snippets-panel';
Expand All @@ -7510,12 +7584,8 @@ Copyright (c) 2013 Jeremy Jackson
Panel.prototype.hidden = true;

Panel.prototype.events = {
'click input': function(e) {
'click input.btn': function(e) {
return this.trigger('insert:snippet', $(e.target).closest('[data-value]').data('value'));
},
'mousedown': function() {
this.revertInterfaceFocus();
return Mercury.trigger('dialogs:hide');
}
};

Expand All @@ -7538,11 +7608,11 @@ Copyright (c) 2013 Jeremy Jackson
JST['/mercury/templates/snippets'] = function() {
var controls, name, ret, snippet, _ref1;
controls = "<div class=\"mercury-snippet-actions\">Drag or <input type=\"button\" value=\"Insert\" class=\"btn\"></div>";
ret = '<ul>';
ret = '<input type="search" class="mercury-filter"><ul>';
_ref1 = Mercury.Snippet.all();
for (name in _ref1) {
snippet = _ref1[name];
ret += "<li data-value=\"" + name + "\">" + snippet.title + "<em>" + snippet.description + "</em>" + controls + "</li>";
ret += "<li data-filter=\"" + name + "\" data-value=\"" + name + "\">" + snippet.title + "<em>" + snippet.description + "</em>" + controls + "</li>";
}
return ret + '</ul>';
};
Expand Down
10 changes: 5 additions & 5 deletions distro/mercury.min.js

Large diffs are not rendered by default.

0 comments on commit d705ddc

Please sign in to comment.