spike 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.gitmodules +6 -0
- data/LICENSE +20 -0
- data/README.md +45 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/bin/spike +5 -0
- data/lib/initializers/960.rb +33 -0
- data/lib/initializers/jquery.rb +1 -0
- data/lib/spike.rb +61 -0
- data/lib/template/app.css +0 -0
- data/lib/template/css/960/README.txt +52 -0
- data/lib/template/css/960/code/css/960.css +1 -0
- data/lib/template/css/960/code/css/960_24_col.css +1 -0
- data/lib/template/css/960/code/css/reset.css +1 -0
- data/lib/template/css/960/code/css/rtl_960.css +1 -0
- data/lib/template/css/960/code/css/rtl_960_24_col.css +1 -0
- data/lib/template/css/960/code/css/rtl_text.css +1 -0
- data/lib/template/css/960/code/css/text.css +1 -0
- data/lib/template/css/960/code/css/uncompressed/960.css +628 -0
- data/lib/template/css/960/code/css/uncompressed/960_24_col.css +599 -0
- data/lib/template/css/960/code/css/uncompressed/demo.css +47 -0
- data/lib/template/css/960/code/css/uncompressed/reset.css +53 -0
- data/lib/template/css/960/code/css/uncompressed/rtl_960.css +628 -0
- data/lib/template/css/960/code/css/uncompressed/rtl_960_24_col.css +599 -0
- data/lib/template/css/960/code/css/uncompressed/rtl_text.css +84 -0
- data/lib/template/css/960/code/css/uncompressed/text.css +84 -0
- data/lib/template/css/960/code/demo.html +538 -0
- data/lib/template/css/960/code/demo_24_col.html +411 -0
- data/lib/template/css/960/code/img/12_col.gif +0 -0
- data/lib/template/css/960/code/img/16_col.gif +0 -0
- data/lib/template/css/960/code/img/24_col.gif +0 -0
- data/lib/template/css/960/code/rtl_demo.html +538 -0
- data/lib/template/css/960/code/rtl_demo_24_col.html +411 -0
- data/lib/template/css/960/fireworks_extension/960.gs Grid Commands.mxp +0 -0
- data/lib/template/css/960/fireworks_extension/_source/12 columns.jsf +26 -0
- data/lib/template/css/960/fireworks_extension/_source/16 columns.jsf +26 -0
- data/lib/template/css/960/fireworks_extension/_source/24 columns.jsf +26 -0
- data/lib/template/css/960/fireworks_extension/_source/960.gs Grid Commands.mxi +22 -0
- data/lib/template/css/960/licenses/GPL_license.txt +674 -0
- data/lib/template/css/960/licenses/MIT_license.txt +20 -0
- data/lib/template/css/960/sketch_sheets/960_sketch.pdf +0 -0
- data/lib/template/css/960/templates/acorn/960_grid_12_col.acorn +0 -0
- data/lib/template/css/960/templates/acorn/960_grid_16_col.acorn +0 -0
- data/lib/template/css/960/templates/acorn/960_grid_24_col.acorn +0 -0
- data/lib/template/css/960/templates/corel_draw/960_grid_12_col.cdt +0 -0
- data/lib/template/css/960/templates/corel_draw/960_grid_16_col.cdt +0 -0
- data/lib/template/css/960/templates/corel_draw/960_grid_24_col.cdt +0 -0
- data/lib/template/css/960/templates/expression_design/960_grid_12_col.design +0 -0
- data/lib/template/css/960/templates/expression_design/960_grid_16_col.design +0 -0
- data/lib/template/css/960/templates/expression_design/960_grid_24_col.design +0 -0
- data/lib/template/css/960/templates/fireworks/960_grid_12_col.png +0 -0
- data/lib/template/css/960/templates/fireworks/960_grid_16_col.png +0 -0
- data/lib/template/css/960/templates/fireworks/960_grid_24_col.png +0 -0
- data/lib/template/css/960/templates/flash/960_grid_12_col.fla +0 -0
- data/lib/template/css/960/templates/flash/960_grid_16_col.fla +0 -0
- data/lib/template/css/960/templates/flash/960_grid_24_col.fla +0 -0
- data/lib/template/css/960/templates/gimp/960_grid_12_col.xcf +0 -0
- data/lib/template/css/960/templates/gimp/960_grid_16_col.xcf +0 -0
- data/lib/template/css/960/templates/gimp/960_grid_24_col.xcf +0 -0
- data/lib/template/css/960/templates/illustrator/960_grid_12_col.ai +372 -0
- data/lib/template/css/960/templates/illustrator/960_grid_16_col.ai +361 -0
- data/lib/template/css/960/templates/indesign/960_grid_12_col.inx +1197 -0
- data/lib/template/css/960/templates/indesign/960_grid_16_col.inx +1214 -0
- data/lib/template/css/960/templates/inkscape/960_grid_12_col.svg +217 -0
- data/lib/template/css/960/templates/inkscape/960_grid_16_col.svg +265 -0
- data/lib/template/css/960/templates/inkscape/960_grid_24_col.svg +174 -0
- data/lib/template/css/960/templates/omnigraffle/960_graffle.graffle +0 -0
- data/lib/template/css/960/templates/photoshop/960_grid_12_col.psd +0 -0
- data/lib/template/css/960/templates/photoshop/960_grid_16_col.psd +0 -0
- data/lib/template/css/960/templates/photoshop/960_grid_24_col.psd +0 -0
- data/lib/template/css/960/templates/visio/960_visio.vsd +0 -0
- data/lib/template/css/blueprint/AUTHORS.textile +42 -0
- data/lib/template/css/blueprint/CHANGELOG +159 -0
- data/lib/template/css/blueprint/LICENSE +22 -0
- data/lib/template/css/blueprint/README.textile +81 -0
- data/lib/template/css/blueprint/TUTORIAL.textile +206 -0
- data/lib/template/css/blueprint/blueprint/ie.css +35 -0
- data/lib/template/css/blueprint/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/buttons/icons/key.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/buttons/readme.txt +32 -0
- data/lib/template/css/blueprint/blueprint/plugins/buttons/screen.css +97 -0
- data/lib/template/css/blueprint/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/lib/template/css/blueprint/blueprint/plugins/fancy-type/screen.css +71 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/readme.txt +18 -0
- data/lib/template/css/blueprint/blueprint/plugins/link-icons/screen.css +40 -0
- data/lib/template/css/blueprint/blueprint/plugins/rtl/readme.txt +10 -0
- data/lib/template/css/blueprint/blueprint/plugins/rtl/screen.css +110 -0
- data/lib/template/css/blueprint/blueprint/print.css +29 -0
- data/lib/template/css/blueprint/blueprint/screen.css +258 -0
- data/lib/template/css/blueprint/blueprint/src/forms.css +65 -0
- data/lib/template/css/blueprint/blueprint/src/grid.css +280 -0
- data/lib/template/css/blueprint/blueprint/src/grid.png +0 -0
- data/lib/template/css/blueprint/blueprint/src/ie.css +76 -0
- data/lib/template/css/blueprint/blueprint/src/print.css +85 -0
- data/lib/template/css/blueprint/blueprint/src/reset.css +45 -0
- data/lib/template/css/blueprint/blueprint/src/typography.css +106 -0
- data/lib/template/css/blueprint/lib/blueprint/blueprint.rb +39 -0
- data/lib/template/css/blueprint/lib/blueprint/compressor.rb +290 -0
- data/lib/template/css/blueprint/lib/blueprint/core_ext.rb +39 -0
- data/lib/template/css/blueprint/lib/blueprint/css_parser.rb +72 -0
- data/lib/template/css/blueprint/lib/blueprint/custom_layout.rb +72 -0
- data/lib/template/css/blueprint/lib/blueprint/grid.css.erb +146 -0
- data/lib/template/css/blueprint/lib/blueprint/grid_builder.rb +63 -0
- data/lib/template/css/blueprint/lib/blueprint/namespace.rb +38 -0
- data/lib/template/css/blueprint/lib/blueprint/semantic_class_names.rb +64 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/COPYRIGHT.html +93 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/JIGSAW_COPYRIGHT +64 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/README.html +83 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/XERCES_COPYING.txt +56 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/css-validator-javadoc.jar +0 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/css-validator.jar +0 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/jigsaw.jar +0 -0
- data/lib/template/css/blueprint/lib/blueprint/validate/xerces.jar +0 -0
- data/lib/template/css/blueprint/lib/blueprint/validator.rb +49 -0
- data/lib/template/css/blueprint/lib/compress.rb +167 -0
- data/lib/template/css/blueprint/lib/settings.example.yml +33 -0
- data/lib/template/css/blueprint/lib/validate.rb +15 -0
- data/lib/template/css/blueprint/templates/psd/fixed-width.psd +0 -0
- data/lib/template/css/blueprint/tests/index.html +83 -0
- data/lib/template/css/blueprint/tests/parts/elements.html +247 -0
- data/lib/template/css/blueprint/tests/parts/forms.html +191 -0
- data/lib/template/css/blueprint/tests/parts/grid.html +163 -0
- data/lib/template/css/blueprint/tests/parts/sample.html +75 -0
- data/lib/template/css/blueprint/tests/parts/test-small.jpg +0 -0
- data/lib/template/css/blueprint/tests/parts/test.jpg +0 -0
- data/lib/template/css/blueprint/tests/parts/valid.png +0 -0
- data/lib/template/index.html +16 -0
- data/spike.gemspec +190 -0
- data/test/helper.rb +10 -0
- data/test/test_spike.rb +7 -0
- metadata +227 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
reset.css
|
4
|
+
* Resets default browser CSS.
|
5
|
+
|
6
|
+
-------------------------------------------------------------- */
|
7
|
+
|
8
|
+
html, body, div, span, object, iframe,
|
9
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
10
|
+
a, abbr, acronym, address, code,
|
11
|
+
del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
|
12
|
+
fieldset, form, label, legend,
|
13
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
14
|
+
article, aside, dialog, figure, footer, header,
|
15
|
+
hgroup, nav, section {
|
16
|
+
margin: 0;
|
17
|
+
padding: 0;
|
18
|
+
border: 0;
|
19
|
+
font-weight: inherit;
|
20
|
+
font-style: inherit;
|
21
|
+
font-size: 100%;
|
22
|
+
font-family: inherit;
|
23
|
+
vertical-align: baseline;
|
24
|
+
}
|
25
|
+
|
26
|
+
article, aside, dialog, figure, footer, header,
|
27
|
+
hgroup, nav, section {
|
28
|
+
display:block;
|
29
|
+
}
|
30
|
+
|
31
|
+
body {
|
32
|
+
line-height: 1.5;
|
33
|
+
}
|
34
|
+
|
35
|
+
/* Tables still need 'cellspacing="0"' in the markup. */
|
36
|
+
table { border-collapse: separate; border-spacing: 0; }
|
37
|
+
caption, th, td { text-align: left; font-weight: normal; }
|
38
|
+
table, td, th { vertical-align: middle; }
|
39
|
+
|
40
|
+
/* Remove possible quote marks (") from <q>, <blockquote>. */
|
41
|
+
blockquote:before, blockquote:after, q:before, q:after { content: ""; }
|
42
|
+
blockquote, q { quotes: "" ""; }
|
43
|
+
|
44
|
+
/* Remove annoying border on linked images. */
|
45
|
+
a img { border: none; }
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/* --------------------------------------------------------------
|
2
|
+
|
3
|
+
typography.css
|
4
|
+
* Sets up some sensible default typography.
|
5
|
+
|
6
|
+
-------------------------------------------------------------- */
|
7
|
+
|
8
|
+
/* Default font settings.
|
9
|
+
The font-size percentage is of 16px. (0.75 * 16px = 12px) */
|
10
|
+
html { font-size:100.01%; }
|
11
|
+
body {
|
12
|
+
font-size: 75%;
|
13
|
+
color: #222;
|
14
|
+
background: #fff;
|
15
|
+
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
/* Headings
|
20
|
+
-------------------------------------------------------------- */
|
21
|
+
|
22
|
+
h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; }
|
23
|
+
|
24
|
+
h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; }
|
25
|
+
h2 { font-size: 2em; margin-bottom: 0.75em; }
|
26
|
+
h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; }
|
27
|
+
h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; }
|
28
|
+
h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; }
|
29
|
+
h6 { font-size: 1em; font-weight: bold; }
|
30
|
+
|
31
|
+
h1 img, h2 img, h3 img,
|
32
|
+
h4 img, h5 img, h6 img {
|
33
|
+
margin: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
/* Text elements
|
38
|
+
-------------------------------------------------------------- */
|
39
|
+
|
40
|
+
p { margin: 0 0 1.5em; }
|
41
|
+
p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; }
|
42
|
+
p img.right { float: right; margin: 1.5em 0 1.5em 1.5em; }
|
43
|
+
|
44
|
+
a:focus,
|
45
|
+
a:hover { color: #000; }
|
46
|
+
a { color: #009; text-decoration: underline; }
|
47
|
+
|
48
|
+
blockquote { margin: 1.5em; color: #666; font-style: italic; }
|
49
|
+
strong { font-weight: bold; }
|
50
|
+
em,dfn { font-style: italic; }
|
51
|
+
dfn { font-weight: bold; }
|
52
|
+
sup, sub { line-height: 0; }
|
53
|
+
|
54
|
+
abbr,
|
55
|
+
acronym { border-bottom: 1px dotted #666; }
|
56
|
+
address { margin: 0 0 1.5em; font-style: italic; }
|
57
|
+
del { color:#666; }
|
58
|
+
|
59
|
+
pre { margin: 1.5em 0; white-space: pre; }
|
60
|
+
pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; }
|
61
|
+
|
62
|
+
|
63
|
+
/* Lists
|
64
|
+
-------------------------------------------------------------- */
|
65
|
+
|
66
|
+
li ul,
|
67
|
+
li ol { margin: 0; }
|
68
|
+
ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 3.333em; }
|
69
|
+
|
70
|
+
ul { list-style-type: disc; }
|
71
|
+
ol { list-style-type: decimal; }
|
72
|
+
|
73
|
+
dl { margin: 0 0 1.5em 0; }
|
74
|
+
dl dt { font-weight: bold; }
|
75
|
+
dd { margin-left: 1.5em;}
|
76
|
+
|
77
|
+
|
78
|
+
/* Tables
|
79
|
+
-------------------------------------------------------------- */
|
80
|
+
|
81
|
+
table { margin-bottom: 1.4em; width:100%; }
|
82
|
+
th { font-weight: bold; }
|
83
|
+
thead th { background: #c3d9ff; }
|
84
|
+
th,td,caption { padding: 4px 10px 4px 5px; }
|
85
|
+
tr.even td { background: #e5ecf9; }
|
86
|
+
tfoot { font-style: italic; }
|
87
|
+
caption { background: #eee; }
|
88
|
+
|
89
|
+
|
90
|
+
/* Misc classes
|
91
|
+
-------------------------------------------------------------- */
|
92
|
+
|
93
|
+
.small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; }
|
94
|
+
.large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; }
|
95
|
+
.hide { display: none; }
|
96
|
+
|
97
|
+
.quiet { color: #666; }
|
98
|
+
.loud { color: #000; }
|
99
|
+
.highlight { background:#ff0; }
|
100
|
+
.added { background:#060; color: #fff; }
|
101
|
+
.removed { background:#900; color: #fff; }
|
102
|
+
|
103
|
+
.first { margin-left:0; padding-left:0; }
|
104
|
+
.last { margin-right:0; padding-right:0; }
|
105
|
+
.top { margin-top:0; padding-top:0; }
|
106
|
+
.bottom { margin-bottom:0; padding-bottom:0; }
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
module Blueprint
|
3
|
+
# path to the root Blueprint directory
|
4
|
+
ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "../../")
|
5
|
+
# path to where the Blueprint CSS files are stored
|
6
|
+
BLUEPRINT_ROOT_PATH = File.join(Blueprint::ROOT_PATH, "blueprint")
|
7
|
+
# path to where the Blueprint CSS raw CSS files are stored
|
8
|
+
SOURCE_PATH = File.join(Blueprint::BLUEPRINT_ROOT_PATH, "src")
|
9
|
+
# path to where the Blueprint CSS generated test files are stored
|
10
|
+
TEST_PATH = File.join(Blueprint::ROOT_PATH, "tests")
|
11
|
+
# path to the root of the Blueprint scripts
|
12
|
+
LIB_PATH = File.join(Blueprint::ROOT_PATH, "lib", "blueprint")
|
13
|
+
# path to where Blueprint plugins are stored
|
14
|
+
PLUGINS_PATH = File.join(Blueprint::BLUEPRINT_ROOT_PATH, "plugins")
|
15
|
+
# settings YAML file where custom user settings are saved
|
16
|
+
SETTINGS_FILE = File.join(Blueprint::ROOT_PATH, "lib", "settings.yml")
|
17
|
+
# path to validator jar file to validate generated CSS files
|
18
|
+
VALIDATOR_FILE = File.join(Blueprint::LIB_PATH, "validate", "css-validator.jar")
|
19
|
+
# hash of compressed and source CSS files
|
20
|
+
CSS_FILES = {
|
21
|
+
"screen.css" => ["reset.css", "typography.css", "forms.css", "grid.css"],
|
22
|
+
"print.css" => ["print.css"],
|
23
|
+
"ie.css" => ["ie.css"]
|
24
|
+
}
|
25
|
+
|
26
|
+
# default number of columns for Blueprint layout
|
27
|
+
COLUMN_COUNT = 24
|
28
|
+
# default column width (in pixels) for Blueprint layout
|
29
|
+
COLUMN_WIDTH = 30
|
30
|
+
# default gutter width (in pixels) for Blueprint layout
|
31
|
+
GUTTER_WIDTH = 10
|
32
|
+
|
33
|
+
INPUT_PADDING = 5
|
34
|
+
INPUT_BORDER = 1
|
35
|
+
end
|
36
|
+
|
37
|
+
Dir["#{File.join(Blueprint::LIB_PATH)}/*"].each do |file|
|
38
|
+
require file if file =~ /\.rb$/ && file !~ /blueprint\.rb/
|
39
|
+
end
|
@@ -0,0 +1,290 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "optparse"
|
3
|
+
module Blueprint
|
4
|
+
class Compressor
|
5
|
+
TEST_FILES = ["index.html",
|
6
|
+
"parts/elements.html",
|
7
|
+
"parts/forms.html",
|
8
|
+
"parts/grid.html",
|
9
|
+
"parts/sample.html"]
|
10
|
+
|
11
|
+
attr_accessor :namespace, :custom_css, :custom_layout, :semantic_classes, :project_name, :plugins
|
12
|
+
attr_reader :custom_path, :loaded_from_settings, :destination_path, :script_name
|
13
|
+
|
14
|
+
# overridden setter method for destination_path
|
15
|
+
# also sets custom_path flag on Blueprint::Compressor instance
|
16
|
+
def destination_path=(path)
|
17
|
+
@destination_path = path
|
18
|
+
@custom_path = @destination_path != Blueprint::BLUEPRINT_ROOT_PATH
|
19
|
+
end
|
20
|
+
|
21
|
+
# constructor
|
22
|
+
def initialize
|
23
|
+
# set up defaults
|
24
|
+
@script_name = File.basename($0)
|
25
|
+
@loaded_from_settings = false
|
26
|
+
@settings_file = Blueprint::SETTINGS_FILE
|
27
|
+
self.namespace = ""
|
28
|
+
self.destination_path = Blueprint::BLUEPRINT_ROOT_PATH
|
29
|
+
self.custom_layout = CustomLayout.new
|
30
|
+
self.project_name = nil
|
31
|
+
self.custom_css = {}
|
32
|
+
self.semantic_classes = {}
|
33
|
+
self.plugins = []
|
34
|
+
|
35
|
+
self.options.parse!(ARGV)
|
36
|
+
initialize_project_from_yaml(self.project_name)
|
37
|
+
end
|
38
|
+
|
39
|
+
# generates output CSS based on any args passed in
|
40
|
+
# overwrites any existing CSS, as well as grid.png and tests
|
41
|
+
def generate!
|
42
|
+
output_header # information to the user (in the console) describing custom settings
|
43
|
+
generate_css_files # loops through Blueprint::CSS_FILES to generate output CSS
|
44
|
+
generate_tests # updates HTML with custom namespaces in order to test the generated library. TODO: have tests kick out to custom location
|
45
|
+
output_footer # informs the user that the CSS generation process is complete
|
46
|
+
end
|
47
|
+
|
48
|
+
def options #:nodoc:#
|
49
|
+
OptionParser.new do |o|
|
50
|
+
o.set_summary_indent(" ")
|
51
|
+
o.banner = "Usage: #{@script_name} [options]"
|
52
|
+
o.define_head "Blueprint Compressor"
|
53
|
+
o.separator ""
|
54
|
+
o.separator "options"
|
55
|
+
o.on( "-fSETTINGS_FILE", "--settings_file=SETTINGS_FILE", String,
|
56
|
+
"Specify a non-default settings file path.") { |file| @settings_file = file }
|
57
|
+
o.on( "-oOUTPUT_PATH", "--output_path=OUTPUT_PATH", String,
|
58
|
+
"Define a different path to output generated CSS files to.") { |path| self.destination_path = path }
|
59
|
+
o.on( "-nBP_NAMESPACE", "--namespace=BP_NAMESPACE", String,
|
60
|
+
"Define a namespace prepended to all Blueprint classes (e.g. .your-ns-span-24)") { |ns| self.namespace = ns }
|
61
|
+
o.on( "-pPROJECT_NAME", "--project=PROJECT_NAME", String,
|
62
|
+
"If using the settings.yml file, PROJECT_NAME is the project name you want to export") {|project| @project_name = project }
|
63
|
+
o.on( "--column_width=COLUMN_WIDTH", Integer,
|
64
|
+
"Set a new column width (in pixels) for the output grid") {|cw| self.custom_layout.column_width = cw }
|
65
|
+
o.on( "--gutter_width=GUTTER_WIDTH", Integer,
|
66
|
+
"Set a new gutter width (in pixels) for the output grid") {|gw| self.custom_layout.gutter_width = gw }
|
67
|
+
o.on( "--column_count=COLUMN_COUNT", Integer,
|
68
|
+
"Set a new column count for the output grid") {|cc| self.custom_layout.column_count = cc }
|
69
|
+
#o.on("-v", "--verbose", "Turn on verbose output.") { |$verbose| }
|
70
|
+
o.on("-h", "--help", "Show this help message.") { puts o; exit }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
# attempts to load output settings from settings.yml
|
77
|
+
def initialize_project_from_yaml(project_name = nil)
|
78
|
+
# ensures project_name is set and settings.yml is present
|
79
|
+
return unless (project_name && File.exist?(@settings_file))
|
80
|
+
|
81
|
+
# loads yaml into hash
|
82
|
+
projects = YAML::load(File.path_to_string(@settings_file))
|
83
|
+
|
84
|
+
if (project = projects[project_name]) # checks to see if project info is present
|
85
|
+
self.destination_path = if self.destination_path == Blueprint::BLUEPRINT_ROOT_PATH
|
86
|
+
project["path"]
|
87
|
+
else
|
88
|
+
self.destination_path
|
89
|
+
end
|
90
|
+
self.destination_path ||= Blueprint::BLUEPRINT_ROOT_PATH
|
91
|
+
self.namespace = project["namespace"] || ""
|
92
|
+
self.custom_css = project["custom_css"] || {}
|
93
|
+
self.semantic_classes = project["semantic_classes"] || {}
|
94
|
+
self.plugins = project["plugins"] || []
|
95
|
+
|
96
|
+
if (layout = project["custom_layout"])
|
97
|
+
self.custom_layout = CustomLayout.new(:column_count => layout["column_count"],
|
98
|
+
:column_width => layout["column_width"],
|
99
|
+
:gutter_width => layout["gutter_width"],
|
100
|
+
:input_padding => layout["input_padding"],
|
101
|
+
:input_border => layout["input_border"])
|
102
|
+
end
|
103
|
+
@loaded_from_settings = true
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def generate_css_files
|
108
|
+
Blueprint::CSS_FILES.each do |output_file_name, css_source_file_names|
|
109
|
+
css_output_path = File.join(destination_path, output_file_name)
|
110
|
+
puts "\n Assembling to #{custom_path ? css_output_path : "default blueprint path"}"
|
111
|
+
|
112
|
+
# CSS file generation
|
113
|
+
css_output = css_file_header # header included on all three Blueprint-generated files
|
114
|
+
css_output += "\n\n"
|
115
|
+
|
116
|
+
# Iterate through src/ .css files and compile to individual core compressed file
|
117
|
+
css_source_file_names.each do |css_source_file|
|
118
|
+
puts " + src/#{css_source_file}"
|
119
|
+
css_output += "/* #{css_source_file} */\n" if css_source_file_names.any?
|
120
|
+
|
121
|
+
source_options = if self.custom_layout && css_source_file == "grid.css"
|
122
|
+
self.custom_layout.generate_grid_css
|
123
|
+
else
|
124
|
+
File.path_to_string File.join(Blueprint::SOURCE_PATH, css_source_file)
|
125
|
+
end
|
126
|
+
|
127
|
+
css_output += Blueprint::CSSParser.new(source_options,
|
128
|
+
:namespace => namespace).to_s
|
129
|
+
css_output += "\n"
|
130
|
+
end
|
131
|
+
|
132
|
+
#append CSS from plugins
|
133
|
+
css_output = append_plugin_css(css_output, output_file_name)
|
134
|
+
|
135
|
+
# append CSS from custom files
|
136
|
+
css_output = append_custom_css(css_output, output_file_name)
|
137
|
+
|
138
|
+
#save CSS to correct path, stripping out any extra whitespace at the end of the file
|
139
|
+
File.string_to_file(css_output.rstrip, css_output_path)
|
140
|
+
end
|
141
|
+
|
142
|
+
# append semantic class names if set
|
143
|
+
append_semantic_classes
|
144
|
+
|
145
|
+
#attempt to generate a grid.png file
|
146
|
+
if (grid_builder = GridBuilder.new(:column_width => self.custom_layout.column_width,
|
147
|
+
:gutter_width => self.custom_layout.gutter_width,
|
148
|
+
:output_path => File.join(self.destination_path, "src")))
|
149
|
+
grid_builder.generate!
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def append_custom_css(css, current_file_name)
|
154
|
+
# check to see if a custom (non-default) location was used for output files
|
155
|
+
# if custom path is used, handle custom CSS, if any
|
156
|
+
return css unless self.custom_path and self.custom_css[current_file_name]
|
157
|
+
|
158
|
+
self.custom_css[current_file_name].each do |custom_css|
|
159
|
+
overwrite_base = custom_css || "my-#{current_file_name}"
|
160
|
+
overwrite_path = File.join(destination_path, overwrite_base)
|
161
|
+
overwrite_css = if File.exists?(overwrite_path)
|
162
|
+
File.path_to_string(overwrite_path)
|
163
|
+
else
|
164
|
+
""
|
165
|
+
end
|
166
|
+
|
167
|
+
# if there's CSS present, add it to the CSS output
|
168
|
+
unless overwrite_css.blank?
|
169
|
+
puts " + custom styles (#{custom_css})\n"
|
170
|
+
css += "/* #{overwrite_base} */\n"
|
171
|
+
css += CSSParser.new(overwrite_css).to_s + "\n"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
css
|
176
|
+
end
|
177
|
+
|
178
|
+
def append_plugin_css(css, current_file_name)
|
179
|
+
return css unless self.plugins.any?
|
180
|
+
|
181
|
+
plugin_css = ""
|
182
|
+
|
183
|
+
self.plugins.each do |plugin|
|
184
|
+
plugin_file_specific = File.join(Blueprint::PLUGINS_PATH, plugin, current_file_name)
|
185
|
+
plugin_file_generic = File.join(Blueprint::PLUGINS_PATH, plugin, "#{plugin}.css")
|
186
|
+
|
187
|
+
file = if File.exists?(plugin_file_specific)
|
188
|
+
plugin_file_specific
|
189
|
+
elsif File.exists?(plugin_file_generic) && current_file_name =~ /^screen|print/
|
190
|
+
plugin_file_generic
|
191
|
+
end
|
192
|
+
|
193
|
+
if file
|
194
|
+
puts " + #{plugin} plugin\n"
|
195
|
+
plugin_css += "/* #{plugin} */\n"
|
196
|
+
plugin_css += CSSParser.new(File.path_to_string(file)).to_s + "\n"
|
197
|
+
|
198
|
+
Dir.glob(File.join(File.dirname(file), "**", "**")).each do |cp|
|
199
|
+
short_path = cp.gsub(/#{File.dirname(file)}./ , "")
|
200
|
+
# make directory if it doesn't exist
|
201
|
+
directory = File.dirname(short_path)
|
202
|
+
if directory != "."
|
203
|
+
FileUtils.mkdir_p(File.join(destination_path, directory))
|
204
|
+
end
|
205
|
+
|
206
|
+
unless File.directory?(File.join(File.dirname(file), short_path)) || cp == file
|
207
|
+
FileUtils.cp(cp, File.join(destination_path, short_path))
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
css += plugin_css
|
214
|
+
end
|
215
|
+
|
216
|
+
def append_semantic_classes
|
217
|
+
screen_output_path = File.join(self.destination_path, "screen.css")
|
218
|
+
semantic_classes = SemanticClassNames.new(:namespace => self.namespace,
|
219
|
+
:source_file => screen_output_path)
|
220
|
+
semantic_styles = semantic_classes.css_from_assignments(self.semantic_classes)
|
221
|
+
return if semantic_styles.blank?
|
222
|
+
|
223
|
+
css = File.path_to_string(screen_output_path)
|
224
|
+
css += "\n\n/* semantic class names */\n"
|
225
|
+
css += semantic_styles
|
226
|
+
File.string_to_file(css.rstrip, screen_output_path)
|
227
|
+
end
|
228
|
+
|
229
|
+
def generate_tests
|
230
|
+
puts "\n Updating namespace to \"#{namespace}\" in test files:"
|
231
|
+
test_files = Compressor::TEST_FILES.map do |file|
|
232
|
+
File.join(Blueprint::TEST_PATH, *file.split(/\//))
|
233
|
+
end
|
234
|
+
|
235
|
+
test_files.each do |file|
|
236
|
+
puts " + #{file}"
|
237
|
+
Namespace.new(file, namespace)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def output_header
|
242
|
+
puts "\n"
|
243
|
+
puts " #{"*" * 100}"
|
244
|
+
puts " **"
|
245
|
+
puts " ** Blueprint CSS Compressor"
|
246
|
+
puts " **"
|
247
|
+
puts " ** Builds compressed files from the source directory."
|
248
|
+
puts " **"
|
249
|
+
puts " ** Loaded from settings.yml" if loaded_from_settings
|
250
|
+
puts " ** Namespace: '#{namespace}'" unless namespace.blank?
|
251
|
+
puts " ** Output to: #{destination_path}"
|
252
|
+
puts " ** Grid Settings:"
|
253
|
+
puts " ** - Column Count: #{self.custom_layout.column_count}"
|
254
|
+
puts " ** - Column Width: #{self.custom_layout.column_width}px"
|
255
|
+
puts " ** - Gutter Width: #{self.custom_layout.gutter_width}px"
|
256
|
+
puts " ** - Total Width : #{self.custom_layout.page_width}px"
|
257
|
+
puts " **"
|
258
|
+
puts " #{"*" * 100}"
|
259
|
+
end
|
260
|
+
|
261
|
+
def output_footer
|
262
|
+
puts "\n\n"
|
263
|
+
puts " #{"*" * 100}"
|
264
|
+
puts " **"
|
265
|
+
puts " ** Done!"
|
266
|
+
puts " ** Your compressed files and test files are now up-to-date."
|
267
|
+
puts " **"
|
268
|
+
puts " #{"*" * 100}\n\n"
|
269
|
+
end
|
270
|
+
|
271
|
+
def css_file_header
|
272
|
+
%(/* -----------------------------------------------------------------------
|
273
|
+
|
274
|
+
|
275
|
+
Blueprint CSS Framework 0.9
|
276
|
+
http://blueprintcss.org
|
277
|
+
|
278
|
+
* Copyright (c) 2007-Present. See LICENSE for more info.
|
279
|
+
* See README for instructions on how to use Blueprint.
|
280
|
+
* For credits and origins, see AUTHORS.
|
281
|
+
* This is a compressed file. See the sources in the 'src' directory.
|
282
|
+
|
283
|
+
----------------------------------------------------------------------- */)
|
284
|
+
end
|
285
|
+
|
286
|
+
def putsv(str)
|
287
|
+
puts str if $verbose
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|