diff --git a/doc-src/assets/javascripts/download.js b/doc-src/assets/javascripts/download.js new file mode 100644 index 00000000..8ad3b756 --- /dev/null +++ b/doc-src/assets/javascripts/download.js @@ -0,0 +1,79 @@ +function showInstallCommand() { + var cmd = $("#existence").val(); + var commands = []; + var notes = []; + var project_name = "<myproject>"; + var can_be_bare = true; + commands.push("$ gem install compass"); + if (cmd == "init") { + commands.push("$ cd " + project_name); + project_name = "."; + } + if ($("#app-type").val() == "rails") { + if (cmd == "create") { + commands.push("$ rails new " + project_name); + } + cmd = "init rails"; + can_be_bare = false; + } else if ($("#app-type").val() == "other") { + if (cmd == "init") { + cmd = "create"; + } + } else if ($("#app-type").val() == "stand-alone") { + if (cmd == "init") { + cmd = "install"; + can_be_bare = false; + } + } + var framework = $("#framework").val(); + var create_command; + if (cmd == "install") { + create_command = "$ compass install " + framework + " " + project_name; + } else { + create_command = "$ compass " + cmd + " " + project_name; + } + if (framework != "compass" && framework != "bare" && cmd != "install") { + create_command = create_command + " --using " + framework; + } else if (framework == "bare") { + if (can_be_bare) { + create_command = create_command + " --bare"; + } else { + notes.push("

You cannot create a bare project in this configuration. Feel free to remove any stylesheets that you don't want.

"); + } + } + if ($("#syntax").val() == "sass") { + create_command = create_command + " --syntax sass"; + } + if ($("#options").val() == "customized") { + create_command = create_command + " --sass-dir <sassdir> --css-dir <cssdir> --javascripts-dir <jsdir> --images-dir <imgsdir>"; + } + commands.push(create_command); + var instructions = "
" + commands.join("\n") + "
"; + if (instructions.match(/</)) { + notes.push("

Note: Values indicated by <> are placeholders. Change them to suit your needs."); + } + $("#steps").html(instructions + notes.join("")); +} + +function attachMadlibBehaviors() { + $("#app-type").change(function(event) { + var val = $(event.target).val(); + if (val == "other") { + $("#options").val("customized"); + $(".madlib").addClass("customizable"); + } else if (val == "rails") { + $("#options").val("default"); + $(".madlib").removeClass("customizable"); + } else { + $(".madlib").addClass("customizable"); + } + }); + $("#existence, #app-type, #framework, #syntax, #options").change(showInstallCommand); +} + +function setupMadlib() { + attachMadlibBehaviors(); + showInstallCommand(); +} + +$(setupMadlib); diff --git a/doc-src/content/download.haml b/doc-src/content/download.haml new file mode 100644 index 00000000..97424f2b --- /dev/null +++ b/doc-src/content/download.haml @@ -0,0 +1,48 @@ +--- +title: Download | Compass Documentation +crumb: Download +body_id: download +--- +- content_for :javascripts do + %script(src="/javascripts/download.js") +%p + Compass runs on any computer that has + ruby installed. + +%h2 Tell us about your project and we'll help you get it set up: +%blockquote.madlib.customizable< + I would like to set up my + %select#existence + %option{:value => "create"} new + %option{:value => "init"} existing + %select#app-type + %option{:value => "stand-alone"} compass + %option{:value => "rails"} rails + %option{:value => "other"} other + project + with + %select#framework + %option{:value => "compass"} compass's + %option{:value => "blueprint"} blueprint's + %option{:value => "bare"} no + starter stylesheets. + %br + I prefer the + %select#syntax + %option{:value => "scss"} CSS based (SCSS) + %option{:value => "sass"} Indent based (Sass) + syntax + = succeed "." do + and would like to + %select#options + %option{:value => "default"} use compass's recommended + %option{:value => "customized"} customize my project's + directory structure +%h4 Thanks. Now run the following steps in your terminal: +#steps + Loading... +%p.note Note: $ is a placeholder for your terminal's prompt. You don't type it. +%h4 Then follow the instructions that compass provides in the output. + +%h2 Or you can buy a GUI for Compass from Handlino. + diff --git a/doc-src/content/stylesheets/partials/_download.scss b/doc-src/content/stylesheets/partials/_download.scss new file mode 100644 index 00000000..ddc823ac --- /dev/null +++ b/doc-src/content/stylesheets/partials/_download.scss @@ -0,0 +1,8 @@ +body#download { + #steps, p.madlib, p.note, h4 { margin-top: 1em; } + p.note { font-size: smaller; font-style: italic; } + p.warning { color: #c00; } + .customization { display: none; } + .customizable .customization { display: inline; } + blockquote { border-left: 2px solid #ccc; text-indent: 0; padding-left: 0.5em; } +} \ No newline at end of file diff --git a/doc-src/content/stylesheets/screen.scss b/doc-src/content/stylesheets/screen.scss index 7c7777ca..cbbbe5ed 100644 --- a/doc-src/content/stylesheets/screen.scss +++ b/doc-src/content/stylesheets/screen.scss @@ -16,6 +16,7 @@ @import "partials/main"; @import "partials/code"; @import "partials/example"; +@import "partials/download"; @import "syntax/syntax-theme"; diff --git a/doc-src/layouts/partials/main-navigation.haml b/doc-src/layouts/partials/main-navigation.haml index 15d33110..038d17be 100644 --- a/doc-src/layouts/partials/main-navigation.haml +++ b/doc-src/layouts/partials/main-navigation.haml @@ -9,6 +9,8 @@ %li %a{:href => "/reference/compass/", :rel => "documentation"} Reference %li - %a{:href => "/help", :rel=> "help"} Help + %a{:href => "/help/", :rel=> "help"} Help %li - %a{:href => "/get-involved", :rel=> "get-involved"} Get Involved + %a{:href => "/get-involved/", :rel=> "get-involved"} Get Involved + %li + %a{:href => "/download/", :rel=> "download"} Download diff --git a/doc-src/lib/default.rb b/doc-src/lib/default.rb index 46b98745..a2a5c782 100644 --- a/doc-src/lib/default.rb +++ b/doc-src/lib/default.rb @@ -132,3 +132,7 @@ def compass_version "#{v[:major]}.#{v[:minor]}#{"."+v[:state] if v[:state]}.#{v[:build]}" end +def long_compass_version + require 'compass/commands' + Compass::Commands::PrintVersion.long_output_string +end \ No newline at end of file diff --git a/lib/compass/commands/print_version.rb b/lib/compass/commands/print_version.rb index bc6fa059..0fa8da3a 100644 --- a/lib/compass/commands/print_version.rb +++ b/lib/compass/commands/print_version.rb @@ -54,6 +54,15 @@ Options: parser.parse! parser.options end + def long_output_string + lines = [] + lines << "Compass #{::Compass.version[:string]}" + lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein" + lines << "Released under the MIT License." + lines << "Compass is charityware." + lines << "Please make a tax deductable donation for a worthy cause: http://umdf.org/compass" + lines.join("\n") + end end attr_accessor :options @@ -79,13 +88,7 @@ Options: elsif options[:quiet] puts ::Compass.version[:string] else - lines = [] - lines << "Compass #{::Compass.version[:string]}" - lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein" - lines << "Released under the MIT License." - lines << "Compass is charityware." - lines << "Please make a tax deductable donation: http://umdf.org/compass" - puts lines.join("\n") + puts self.class.long_output_string end end end