staticmatic2 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/Gemfile +12 -0
  2. data/Gemfile.lock +27 -0
  3. data/LICENSE +20 -0
  4. data/README.markdown +107 -0
  5. data/Rakefile +45 -0
  6. data/VERSION.yml +5 -0
  7. data/bin/staticmatic +140 -0
  8. data/lib/staticmatic.rb +25 -0
  9. data/lib/staticmatic/base.rb +123 -0
  10. data/lib/staticmatic/compass.rb +5 -0
  11. data/lib/staticmatic/compass/app_integration.rb +18 -0
  12. data/lib/staticmatic/compass/configuration_defaults.rb +44 -0
  13. data/lib/staticmatic/compass/installer.rb +15 -0
  14. data/lib/staticmatic/configuration.rb +20 -0
  15. data/lib/staticmatic/deployers/aws-s3.rb +71 -0
  16. data/lib/staticmatic/deployers/config/amazon.yml +7 -0
  17. data/lib/staticmatic/error.rb +17 -0
  18. data/lib/staticmatic/helpers.rb +12 -0
  19. data/lib/staticmatic/helpers/assets_helper.rb +116 -0
  20. data/lib/staticmatic/helpers/current_path_helper.rb +22 -0
  21. data/lib/staticmatic/helpers/form_helper.rb +23 -0
  22. data/lib/staticmatic/helpers/render_helper.rb +13 -0
  23. data/lib/staticmatic/helpers/tag_helper.rb +35 -0
  24. data/lib/staticmatic/helpers/url_helper.rb +59 -0
  25. data/lib/staticmatic/mixins/build.rb +77 -0
  26. data/lib/staticmatic/mixins/helpers.rb +15 -0
  27. data/lib/staticmatic/mixins/render.rb +153 -0
  28. data/lib/staticmatic/mixins/rescue.rb +12 -0
  29. data/lib/staticmatic/mixins/server.rb +7 -0
  30. data/lib/staticmatic/mixins/setup.rb +16 -0
  31. data/lib/staticmatic/server.rb +86 -0
  32. data/lib/staticmatic/template_error.rb +44 -0
  33. data/lib/staticmatic/templates/rescues/default.haml +7 -0
  34. data/lib/staticmatic/templates/rescues/template.haml +18 -0
  35. data/spec/base_spec.rb +13 -0
  36. data/spec/compass_integration_spec.rb +27 -0
  37. data/spec/helpers/asset_helper_spec.rb +43 -0
  38. data/spec/helpers/custom_helper_spec.rb +18 -0
  39. data/spec/render_spec.rb +44 -0
  40. data/spec/rescue_spec.rb +36 -0
  41. data/spec/sandbox/test_site/config/compass.rb +1 -0
  42. data/spec/sandbox/test_site/config/site.rb +0 -0
  43. data/spec/sandbox/test_site/src/helpers/application_helper.rb +5 -0
  44. data/spec/sandbox/test_site/src/layouts/alternate_layout.haml +3 -0
  45. data/spec/sandbox/test_site/src/layouts/default.haml +7 -0
  46. data/spec/sandbox/test_site/src/layouts/projects.haml +1 -0
  47. data/spec/sandbox/test_site/src/pages/hello_world.erb +1 -0
  48. data/spec/sandbox/test_site/src/pages/index.haml +5 -0
  49. data/spec/sandbox/test_site/src/pages/layout_test.haml +2 -0
  50. data/spec/sandbox/test_site/src/pages/page_one.haml +3 -0
  51. data/spec/sandbox/test_site/src/pages/page_two.haml +2 -0
  52. data/spec/sandbox/test_site/src/pages/page_with_error.haml +5 -0
  53. data/spec/sandbox/test_site/src/pages/page_with_partial_error.haml +3 -0
  54. data/spec/sandbox/test_site/src/partials/menu.haml +1 -0
  55. data/spec/sandbox/test_site/src/partials/partial_with_error.haml +1 -0
  56. data/spec/sandbox/test_site/src/stylesheets/application.sass +5 -0
  57. data/spec/sandbox/test_site/src/stylesheets/css_with_error.sass +5 -0
  58. data/spec/sandbox/test_site/src/stylesheets/nested/a_nested_stylesheet.sass +0 -0
  59. data/spec/sandbox/test_site/src/stylesheets/partials/_forms.sass +2 -0
  60. data/spec/sandbox/test_site/src/stylesheets/sassy.scss +12 -0
  61. data/spec/server_spec.rb +11 -0
  62. data/spec/setup_spec.rb +22 -0
  63. data/spec/spec_helper.rb +14 -0
  64. data/spec/template_error_spec.rb +23 -0
  65. data/staticmatic.gemspec +158 -0
  66. data/website/Gemfile +1 -0
  67. data/website/config/site.rb +17 -0
  68. data/website/site/docs/compass_integration.html +70 -0
  69. data/website/site/docs/getting_started.html +49 -0
  70. data/website/site/docs/helpers.html +22 -0
  71. data/website/site/images/bycurve21.gif +0 -0
  72. data/website/site/images/curve21.jpg +0 -0
  73. data/website/site/images/homepage-build.jpg +0 -0
  74. data/website/site/images/homepage-previewing.jpg +0 -0
  75. data/website/site/images/homepage-templating.jpg +0 -0
  76. data/website/site/stylesheets/ie.css +5 -0
  77. data/website/site/stylesheets/print.css +372 -0
  78. data/website/site/stylesheets/screen.css +488 -0
  79. data/website/src/helpers/content_helper.rb +10 -0
  80. data/website/src/layouts/default.haml +15 -0
  81. data/website/src/pages/development.haml +9 -0
  82. data/website/src/pages/docs/_menu.haml +4 -0
  83. data/website/src/pages/docs/_requires_prerelease.haml +4 -0
  84. data/website/src/pages/docs/compass_integration.haml +54 -0
  85. data/website/src/pages/docs/getting_started.haml +31 -0
  86. data/website/src/pages/docs/helpers.haml +1 -0
  87. data/website/src/pages/index.haml +27 -0
  88. data/website/src/stylesheets/_base.scss +43 -0
  89. data/website/src/stylesheets/_defaults.scss +260 -0
  90. data/website/src/stylesheets/ie.scss +10 -0
  91. data/website/src/stylesheets/print.scss +33 -0
  92. data/website/src/stylesheets/screen.scss +73 -0
  93. metadata +238 -0
@@ -0,0 +1,10 @@
1
+ module ContentHelper
2
+ def content_navigation(*pages)
3
+ output = "<ul>"
4
+ pages.each do |page|
5
+ anchor = page.downcase.gsub(/\s+/, "_").gsub(/\W+/, "")
6
+ output << %Q{<li><a href="##{anchor}">#{page}</a></li>}
7
+ end
8
+ output << "</ul>"
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title StaticMatic Documentation
5
+ %link{:rel => "stylesheet", :href => "/stylesheets/screen.css", :media => "screen"}
6
+ %body
7
+ #page
8
+ #header
9
+ #logo StaticMatic
10
+ #menu
11
+ %ul
12
+ %li= link "Home", "/"
13
+ %li= link "Documentation", "/docs/getting_started.html"
14
+ %li= link "Development"
15
+ #content= yield
@@ -0,0 +1,9 @@
1
+ %h3 Source Code
2
+
3
+ %p
4
+ You can get the source code from
5
+ = link "Github", "http://github.com/staticmatic/staticmatic/tree/master"
6
+ \:
7
+
8
+ .code git clone git@github.com:staticmatic/staticmatic.git
9
+
@@ -0,0 +1,4 @@
1
+ %ul
2
+ %li= link "Getting Started", "/docs/getting_started"
3
+ %li= link "Compass Integration", "/docs/compass_integration"
4
+ %li= link "Helpers", "/docs/helpers"
@@ -0,0 +1,4 @@
1
+ %p.notice
2
+ You'll need to install the pre-release version of StaticMatic to use this feature:
3
+
4
+ %kbd gem install staticmatic --pre
@@ -0,0 +1,54 @@
1
+ %h1 Compass Integration
2
+
3
+ = partial "requires_prerelease"
4
+
5
+ = content_navigation("What is Compass?", "Using Compass with StaticMatic", "Using Compass's CSS Frameworks")
6
+
7
+ :markdown
8
+ <a id="what_is_compass"></a>
9
+ ## What is Compass?
10
+
11
+ Compass is simply awesome. It gives you a access huge amount of stylesheet libraries that take much of the duplication out of authoring stylesheets.
12
+
13
+ Check out the code for adding borders to a box:
14
+
15
+ .box {
16
+ @include border-radius(5px)
17
+ }
18
+
19
+ This compiles to:
20
+
21
+ .box {
22
+ -moz-border-radius: 5px;
23
+ -webkit-border-radius: 5px;
24
+ -o-border-radius: 5px;
25
+ -ms-border-radius: 5px;
26
+ -khtml-border-radius: 5px;
27
+ border-radius: 5px;
28
+ }
29
+
30
+ Compass also comes with a port of the popular [Blueprint](http://www.blueprintcss.org/) CSS framework and has many plugin frameworks such as [Susy](http://susy.oddbird.net/) & [960.gs](http://960.gs/).
31
+
32
+ <a id="using_compass_with_staticmatic"></a>
33
+ ## Using Compass with StaticMatic
34
+
35
+ StaticMatic works with Compass out of the box. You can start using all the great features Compass provides ([read about Compass's core framework here](http://compass-style.org/docs/reference/compass/)).
36
+
37
+ It's also simple to customize the way Compass work. When you [setup your project](getting_started.html), you'll have a file called <kbd>config/compass.rb</kbd>. You can use this file to configure Compass:
38
+
39
+ output_style = :compressed
40
+
41
+ For a run down of what you can configure in <kbd>config/compass.rb</kbd>, see [The Compass Configuration Reference](http://compass-style.org/docs/tutorials/configuration-reference/)
42
+
43
+ <a id="using_compasss_css_frameworks"></a>
44
+ ## Using Compass's CSS Frameworks
45
+
46
+ Compass's command line tool can generate CSS framework base files for you. This works seemlessly with StaticMatic.
47
+
48
+ For example, if you'd like to use the Blueprint framework for your project simply run:
49
+
50
+ > compass install blueprint
51
+
52
+ in your project directory. Compass will then install all of the base stylesheets you need to get started.
53
+
54
+ [Read more about Compass's command line tool here](http://compass-style.org/docs/tutorials/command-line/).
@@ -0,0 +1,31 @@
1
+ %h1 Getting Started
2
+
3
+ :markdown
4
+ StaticMatic is designed to be quick & easy to get up and running.
5
+
6
+ ## Installing
7
+
8
+ You'll need to have (Ruby)[http://ruby-lang.org] installed along with Ruby's package manager (RubyGems)[http://rubygems.org/pages/download]. If you're using OSX or Linux, chances are you're ready to go. If you're using Windows, you may need to install Rubyy using one of the packages found (here)[http://www.ruby-lang.org/en/downloads/].
9
+
10
+ To install StaticMatic, open a terminal window and run:
11
+
12
+ > gem install staticmatic
13
+
14
+ If everything is set up correctly, you should now be able to run:
15
+
16
+ > staticmatic -v
17
+
18
+ and see a version number.
19
+
20
+ Congratulations - you're ready to start creating your first StaticMatic site!
21
+
22
+ ## Creating a site
23
+
24
+ Open a terminal and run:
25
+
26
+ > staticmatic setup my-first-site
27
+
28
+ and StaticMatic will create a set of files for you to get started.
29
+
30
+
31
+
@@ -0,0 +1 @@
1
+ %h1 Helpers
@@ -0,0 +1,27 @@
1
+ %h1 Static websites, the modern way
2
+
3
+ %p
4
+ Web developers are used to using dynamic and frameworks like
5
+ = link "Ruby on Rails", "http://www.rubyonrails.com"
6
+ to develop applications. When it comes to working with static, non-dynamic websites it can seem like stepping back in time.
7
+
8
+ %h2 You'd like to
9
+
10
+ %ul
11
+ %li.highlight Replace over-featured, cumbersome Content Management Systems
12
+ %li.highlight Speed up your prototypes
13
+
14
+ %h2 Meet StaticMatic
15
+
16
+ .columns
17
+ .left_column
18
+ %em Concise and terse Haml Templating
19
+ = img "homepage-templating.jpg"
20
+
21
+ .right_column
22
+ %em Live preview server for development
23
+ = img "homepage-previewing.jpg"
24
+
25
+ %p
26
+ %em Output full HTML pages
27
+ = img "homepage-build.jpg"
@@ -0,0 +1,43 @@
1
+ //**
2
+ // Susy: Un-obtrusive grids for designers
3
+ // By: Eric A. Meyer and OddBird
4
+ // Site: www.oddbird.net/susy/
5
+ //**
6
+
7
+ // Font Sizes --------------------------------------------------------------
8
+
9
+ $base-font-size: 16px;
10
+ $base-line-height: 24px;
11
+
12
+ // Grid --------------------------------------------------------------
13
+
14
+ $total-cols: 12;
15
+ $col-width: 4em;
16
+ $gutter-width: 1em;
17
+ $side-gutter-width: $gutter-width;
18
+
19
+ // Don't move this @import above the GRID and FONT-SIZE variables.
20
+ @import "susy/susy";
21
+
22
+ // Colors --------------------------------------------------------------
23
+
24
+ $base: #4c4c4c;
25
+ $alt: #005498;
26
+
27
+ // Fonts --------------------------------------------------------------
28
+
29
+ @mixin sans-family {
30
+ font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
31
+ }
32
+
33
+ @mixin serif-family {
34
+ font-family: 'Adobe Caslon Pro', Caslon, Baskerville, Palatino, 'Palatino Linotype', "Hoefler Text", Garamond, "URW Palladio L", "Book Antiqua", Georgia, serif;
35
+ }
36
+
37
+ @mixin monospace-family {
38
+ font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif;
39
+ }
40
+
41
+ // OTHER MIXINS --------------------------------------------------------------
42
+ // Mixins set here will be available in defaults, screen, print and IE
43
+ // Or anywhere you import either base.sass or defaults.sass
@@ -0,0 +1,260 @@
1
+ //** DEFAULT STYLES **//
2
+
3
+ // Based on the work of:
4
+ // Andy Clarke: http://forabeautifulweb.com/
5
+
6
+ // Imports --------------------------------------------------------------*/
7
+
8
+ @import "base";
9
+ @import "susy/reset";
10
+
11
+ /* Body --------------------------------------------------------------*/
12
+
13
+ body {
14
+ @include serif-family;
15
+ color: $base;
16
+ }
17
+
18
+ /* Links --------------------------------------------------------------*/
19
+
20
+ a {
21
+ &:link, &:visited {
22
+ color: $alt;
23
+ }
24
+ &:focus, &:hover, &:active {
25
+ color: darken($alt,5);
26
+ text-decoration: none;
27
+ }
28
+ img {
29
+ border: none;
30
+ }
31
+ }
32
+
33
+ /* Headings --------------------------------------------------------------*/
34
+
35
+ h1, h2, h3, h4, h5, h6 {
36
+ font-weight: normal;
37
+ img {
38
+ margin: 0;
39
+ }
40
+ }
41
+
42
+ h1 {
43
+ @include adjust-font-size-to(32px);
44
+ @include trailer(1,32px);
45
+ }
46
+
47
+ h2 {
48
+ @include adjust-font-size-to(24px);
49
+ @include trailer(1,24px);
50
+ }
51
+
52
+ h3 {
53
+ @include adjust-font-size-to(18px);
54
+ @include trailer(1,18px);
55
+ }
56
+
57
+ h4 {
58
+ @include adjust-font-size-to(16px);
59
+ @include trailer(1,16px);
60
+ }
61
+
62
+ h5, h6 {
63
+ @include trailer(1);
64
+ font-weight: bold;
65
+ }
66
+
67
+ /* Text --------------------------------------------------------------*/
68
+
69
+ cite, em, dfn {
70
+ font-style: italic;
71
+ }
72
+
73
+ strong, dfn {
74
+ font-weight: bold;
75
+ }
76
+
77
+ sup, sub {
78
+ line-height: 0;
79
+ }
80
+
81
+ abbr, acronym {
82
+ border-bottom: 1px dotted;
83
+ cursor: help;
84
+ }
85
+
86
+ address {
87
+ @include trailer;
88
+ font-style: italic;
89
+ }
90
+
91
+ ins {
92
+ text-decoration: underline;
93
+ }
94
+
95
+ del {
96
+ text-decoration: line-through;
97
+ }
98
+
99
+ pre, code, tt, kbd {
100
+ // margin: $base-rhythm-unit {
101
+ // left: -$base-rhythm-unit;
102
+ // };
103
+ // padding: $base-rhythm-unit;
104
+ // border-left: 1px dotted;
105
+
106
+ @include monospace-family;
107
+ font-size: 0.9em
108
+
109
+ }
110
+
111
+ pre {
112
+ white-space: pre;
113
+ }
114
+
115
+ code {
116
+ display: block;
117
+ }
118
+
119
+ q {
120
+ font-style: italic;
121
+ em {
122
+ font-style: normal;
123
+ }
124
+ }
125
+
126
+ p {
127
+ @include trailer;
128
+ }
129
+
130
+ blockquote, q {
131
+ quotes : "" "";
132
+ }
133
+
134
+ blockquote {
135
+ margin: $base-rhythm-unit {
136
+ left: -$base-rhythm-unit;
137
+ };
138
+ padding-left: $base-rhythm-unit;
139
+ border-left: 1px solid;
140
+ @include serif-family;
141
+ font-style: italic;
142
+ }
143
+
144
+ blockquote, q {
145
+ &:before, &:after {
146
+ content: "";
147
+ }
148
+ }
149
+
150
+ /* Replaced --------------------------------------------------------------*/
151
+
152
+ img {
153
+ vertical-align: bottom;
154
+ }
155
+
156
+ /* Lists --------------------------------------------------------------*/
157
+
158
+ @mixin list-default($ol: false) {
159
+ margin: 0 $base-rhythm-unit $base-rhythm-unit 0;
160
+ @if $ol {
161
+ list-style: decimal;
162
+ } @else {
163
+ list-style: disc;
164
+ }
165
+ }
166
+
167
+ @mixin no-style-list {
168
+ @include no-bullets;
169
+ margin: 0;
170
+ padding: 0;
171
+ }
172
+
173
+ ol {
174
+ @include list-default(ol);
175
+ }
176
+
177
+ ul {
178
+ @include list-default;
179
+ }
180
+
181
+ li {
182
+ ul, ol {
183
+ list-style-type: circle;
184
+ margin: 0 $base-rhythm-unit $base-rhythm-unit*.5;
185
+ }
186
+ }
187
+
188
+ dl {
189
+ @include trailer;
190
+ @include leading-border(1px);
191
+ dt {
192
+ @include adjust-font-size-to(18px);
193
+ @include trailer(.5,18px);
194
+ }
195
+ }
196
+
197
+ dd {
198
+ @include trailer;
199
+ @include trailing-border(1px);
200
+ }
201
+
202
+ /* Tables --------------------------------------------------------------*/
203
+ /* tables still need 'cellspacing="0"' in the markup */
204
+
205
+ table {
206
+ @include trailer;
207
+ width: 100%;
208
+ border-collapse: separate;
209
+ border-spacing: 0;
210
+ }
211
+
212
+ table, td, th {
213
+ vertical-align: top;
214
+ }
215
+
216
+ th, thead th {
217
+ font-weight: bold;
218
+ }
219
+
220
+ th, td, caption {
221
+ padding: $base-rhythm-unit*.5;
222
+ text-align: left;
223
+ font-weight: normal;
224
+ }
225
+
226
+ th, td {
227
+ @include trailing-border(1px,.5);
228
+ }
229
+
230
+ tfoot {
231
+ @include adjust-font-size-to(14px);
232
+ }
233
+
234
+ caption {
235
+ @include adjust-font-size-to(24px);
236
+ @include trailer(1,24px);
237
+ }
238
+
239
+ /* Forms --------------------------------------------------------------*/
240
+
241
+ fieldset {
242
+ @include trailer;
243
+ @include rhythm-borders(1px);
244
+ }
245
+
246
+ legend {
247
+ @include adjust-font-size-to(18px);
248
+ font-weight: bold;
249
+ }
250
+
251
+ label {
252
+ font-weight: bold;
253
+ }
254
+
255
+ textarea, input:not([type="radio"]) {
256
+ // box-sizing will help us control the width of inputs
257
+ // which are otherwise very hard to manage in the grid.
258
+ @include box-sizing(border-box);
259
+ width: 100%;
260
+ }