Update the madlib for compass 0.12 and compass-rails.

This commit is contained in:
Chris Eppstein 2012-01-30 18:50:33 -08:00
parent e4681e2672
commit ee1adf9535
2 changed files with 47 additions and 12 deletions

View File

@ -4,15 +4,38 @@ function showInstallCommand() {
var notes = []; var notes = [];
var project_name = "<myproject>"; var project_name = "<myproject>";
var can_be_bare = true; var can_be_bare = true;
var in_working_dir = false;
var use_bundler = false;
if ($("#app-type").val() != "rails") {
commands.push("$ gem install compass"); commands.push("$ gem install compass");
}
if (cmd == "init") { if (cmd == "init") {
commands.push("$ cd " + project_name); commands.push("$ cd " + project_name);
in_working_dir = true
project_name = "."; project_name = ".";
$(".creating").hide();
} else {
$(".creating").show();
if ($("#project_name").val() != "")
project_name = $("#project_name").val();
}
if ($("#app-type").val() == "rails") {
notes.push("<p class='note warning'>Rails 2.3 and 3.0 users require additional installation steps. For full rails installation and upgrade instructions please refer to the compass-rails <a href='https://github.com/Compass/compass-rails/blob/master/README.md'>README</a>.</p>");
use_bundler = true;
} }
if ($("#app-type").val() == "rails") { if ($("#app-type").val() == "rails") {
if (cmd == "create") { if (cmd == "create") {
commands.push("$ rails new " + project_name); commands.push("$ rails new " + project_name);
commands.push("$ cd " + project_name);
in_working_dir = true
project_name = ".";
} }
commands.push("> Edit Gemfile and add this:");
commands.push(" group :assets do");
commands.push(" gem 'compass-rails'");
commands.push(" # Add any compass extensions here");
commands.push(" end");
commands.push("$ bundle");
cmd = "init rails"; cmd = "init rails";
can_be_bare = false; can_be_bare = false;
} else if ($("#app-type").val() == "other") { } else if ($("#app-type").val() == "other") {
@ -28,9 +51,12 @@ function showInstallCommand() {
var framework = $("#framework").val(); var framework = $("#framework").val();
var create_command; var create_command;
if (cmd == "install") { if (cmd == "install") {
create_command = "$ compass install " + framework + " " + project_name; create_command = "$ compass install " + framework;
} else { } else {
create_command = "$ compass " + cmd + " " + project_name; create_command = "$ compass " + cmd;
}
if (!in_working_dir) {
create_command = create_command + " " + project_name;
} }
if (framework != "compass" && framework != "bare" && cmd != "install") { if (framework != "compass" && framework != "bare" && cmd != "install") {
create_command = create_command + " --using " + framework; create_command = create_command + " --using " + framework;
@ -46,14 +72,20 @@ function showInstallCommand() {
} }
if ($("#options").val() == "customized") { if ($("#options").val() == "customized") {
$("#directories").show(); $("#directories").show();
create_command = create_command + if ($("#sassdir").val() != "")
" --sass-dir \"" + $("#sassdir").val() + "\"" + create_command += " --sass-dir \"" + $("#sassdir").val() + "\"";
" --css-dir \"" + $("#cssdir").val() + "\"" + if ($("#cssdir").val() != "")
" --javascripts-dir \"" + $("#jsdir").val() + "\"" + create_command += " --css-dir \"" + $("#cssdir").val() + "\"";
" --images-dir \"" + $("#imagesdir").val() + "\""; if ($("#jsdir").val() != "")
create_command += " --javascripts-dir \"" + $("#jsdir").val() + "\"";
if ($("#imagesdir").val() != "")
create_command += " --images-dir \"" + $("#imagesdir").val() + "\"";
} else { } else {
$("#directories").hide(); $("#directories").hide();
} }
if (use_bundler) {
create_command = "$ bundle exec " + create_command.replace(/\$ /,'');
}
commands.push(create_command); commands.push(create_command);
var instructions = "<pre><code>" + commands.join("\n") + "</code></pre>"; var instructions = "<pre><code>" + commands.join("\n") + "</code></pre>";
if (instructions.match(/&lt;/)) { if (instructions.match(/&lt;/)) {

View File

@ -30,6 +30,9 @@ body_id: install
%option{:value => "rails"} rails %option{:value => "rails"} rails
%option{:value => "other"} other %option{:value => "other"} other
project project
%span.creating
named
%input#project_name(placeholder="<myproject>")
with with
%select#framework %select#framework
%option{:value => "compass"} compass's %option{:value => "compass"} compass's
@ -48,14 +51,14 @@ body_id: install
%option{:value => "customized"} customize my project's %option{:value => "customized"} customize my project's
directory structure<span id="directories" style="display:none;"> directory structure<span id="directories" style="display:none;">
using using
%input#sassdir(value="sass") %input#sassdir(placeholder="sass")
for the sass source directory, for the sass source directory,
%input#cssdir(value="css") %input#cssdir(placeholder="css")
for the css output directory, for the css output directory,
%input#jsdir(value="javascripts") %input#jsdir(placeholder="javascripts")
for the javascripts directory, for the javascripts directory,
and and
%input#imagesdir(value="images") %input#imagesdir(placeholder="images")
for the images directory</span></span>. for the images directory</span></span>.
%h4 Thanks. Now run the following steps in your terminal: %h4 Thanks. Now run the following steps in your terminal: