pubba 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,7 @@
1
1
  master
2
2
 
3
+ 0.2.0
4
+
3
5
  * Ability to add external references
4
6
  * Ability to add media query requirement to styles
5
7
 
data/README.md CHANGED
@@ -10,6 +10,7 @@ __I do not consider this project production ready at this time. It will be soon
10
10
 
11
11
  TODO:
12
12
 
13
+ * Add cache bursting functionality
13
14
  * Remove requirement for placing of scripts/styles in subdirectories. For instance, the convention now is scripts would be in subdirs like javascripts/custom and javscripts/third-party. The only scripts/styles in the root dir are those generated by this extension.
14
15
  * Compress the combined assets
15
16
  * More tests!
@@ -23,9 +24,10 @@ If you've ever had to deal with an audit department, you understand some of the
23
24
 
24
25
  Any process that involves changing code between environments, even in an automated fashion, is great fodder for the audit machine. This extension makes sure the javascript and css you work with in development is the same as it will be in production.
25
26
 
26
- This does result in the use of a cache bursting query parameter to be added to the url instead of the digest per asset approach. While the digest approach is much more accurate it complicates using a commit/tag to completely represent the deployment contents.
27
+ As mentioned, code organization is another focus of pubba. The config file __pubba.yml__ uses the global section to clearly state which assets should be on all pages. This functionality is not restricted to your local assets. The pubba config file also allows you to declare external assets. In short, you should not have a single script tag in your views other than those generated by the `page_head_tags` and `page_body_tags` helpers provided by pubba.
27
28
 
28
- As mentioned, code organization is another focus of Pubba. The config file __pubba.yml__ uses the global section to clearly state which assets should be on all pages. In addition, when using R18n, Pubba gives you access through a single page object.
29
+
30
+ In addition, when using R18n, pubba gives you access through a single page object.
29
31
 
30
32
 
31
33
  # Settings
@@ -122,6 +124,42 @@ Next up is creating the all important __pubba.yml__ config file:
122
124
 
123
125
  The config file is referencing the javascripts and stylesheets located in the `asset_folder`.
124
126
 
127
+ Now you obviouslly need some helpers to make use of the definitions in __pubba.yml__, and here they are:
128
+
129
+ * `page_head_tags`
130
+ * This helper emits the `link` and `script` tags with the contents defined in __pubba.yml__
131
+ * `page_body_tags`
132
+ * This helper emits the `script` tag with the contents defined in __pubba.yml__. You would typically place this just before the `</body>` tag.
133
+
134
+ Sample use:
135
+
136
+ html
137
+ head
138
+ title = @page.title
139
+ == page_head_tags
140
+ body
141
+ menu
142
+ a href="/" = @page.home_link
143
+ == page_body_tags
144
+
145
+ What you'll see when working with pubba is that the files in your `asset_folder` are never referenced in your view. Even in development mode! The intent is that development mode is as close to production mode as possible. So, you are working with the same combined asset file you will be deploying.
146
+
147
+ Using the above __pubba.yml__ configuration, if you are using the 'home' page definition, the output of `page_head_tags` will be (formatted for the README):
148
+
149
+ <link href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css" rel="stylesheet" type="text/css"></link>
150
+ <link href="/stylesheets/home-all.css" rel="stylesheet" type="text/css"></link>
151
+ <link href="/stylesheets/home-phone.css" media="only screen and (max-width: 480px)" rel="stylesheet" type="text/css"></link>
152
+ <link href="/stylesheets/home-desktop.css" media="only screen and (min-width: 480px)" rel="stylesheet" type="text/css"></link>
153
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
154
+ <script src="/javascripts/home-head.js" type="text/javascript"></script>|
155
+
156
+ Again, using the above __pubba.yml__ configuration, if you are using the 'home' page definition, the output of `page_body_tags` will be (formatted for the README):
157
+
158
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
159
+ <script src="/javascripts/home-body.js" type="text/javascript"></script>
160
+
161
+ # R18n
162
+
125
163
  If you're using R18n, you will need a translation file, here's a sample en.yml:
126
164
 
127
165
  home:
@@ -153,28 +191,6 @@ The `@page` variable gives you access to the definitions in __en.yml__. In your
153
191
 
154
192
  Notice that `title` is defined under the `home` section, but `home_link` is a top level definition. Pubba makes the effort to correctly resolve the __en.yml__ reference for you. Nice isn't it.
155
193
 
156
- Now you obviouslly need some helpers to make use of the definitions in __pubba.yml__, and here they are:
157
-
158
- * `page_head_tags`
159
- * This helper emits the `link` and `script` tags with the contents defined in __pubba.yml__
160
- * `page_body_tags`
161
- * This helper emits the `script` tag with the contents defined in __pubba.yml__. You would typically place this just before the `</body>` tag.
162
- * `burst(url)`
163
- * This helper simply appends a cache bursting parameter named `aid` to the end of the url. In development mode the `aid` value is updated per request. The intent is to help with the particularly aggressive caching Google's Chrome browser likes to implement. In production mode, Pubba requires `ENV[ASSET_ID]` to be set and uses this for the `aid` value. I expect this to be tweaked as I get further into implementation.
164
-
165
- Sample use:
166
-
167
- html
168
- head
169
- title = @page.title
170
- == page_head_tags
171
- body
172
- menu
173
- a href="/" = @page.home_link
174
- == page_body_tags
175
-
176
- What you'll see when working with Pubba is that the files in your `asset_folder` are never referenced in your view. Even in development mode! The intent is that development mode is as close to production mode as possible. So, you are working with the same combined asset file you will be deploying.
177
-
178
194
  # Acknowledgement
179
195
 
180
196
  Huge thanks to my company, [Primedia](http://primedia.com) for encouraging open source contributions. This particular extension is obviously very new and hasn't hit a production site yet, but it will. I will post a list here as we migrate our applications from Rails to Sinatra.
@@ -1,5 +1,5 @@
1
1
  module Pubba
2
2
  # Pubba version string
3
3
  # @api public
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
data/pubba.gemspec CHANGED
@@ -8,8 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.date = Date.today.to_s
9
9
  s.authors = ['Andrew Stone']
10
10
  s.email = ['andy@stonean.com']
11
- s.summary = 'Pubba is a Sinatra extension.'
12
- s.description = 'Pubba is a Sinatra extension designed to help you manage your site.'
11
+ s.summary = 'Pubba is a Sinatra extension designed to help you manage the static components of your site.'
13
12
  s.homepage = 'http://github.com/stonean/pubba'
14
13
  s.extra_rdoc_files = %w(README.md)
15
14
  s.rdoc_options = %w(--charset=UTF-8)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
16
- requirement: &2151907280 !ruby/object:Gem::Requirement
16
+ requirement: &2151907440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.1.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151907280
24
+ version_requirements: *2151907440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: r18n-desktop
27
- requirement: &2151906520 !ruby/object:Gem::Requirement
27
+ requirement: &2151906680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.4.11
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151906520
35
+ version_requirements: *2151906680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2151906000 !ruby/object:Gem::Requirement
38
+ requirement: &2151906160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2151906000
46
+ version_requirements: *2151906160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sinatra
49
- requirement: &2151905480 !ruby/object:Gem::Requirement
49
+ requirement: &2151905660 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.3.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2151905480
57
+ version_requirements: *2151905660
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sinatra-contrib
60
- requirement: &2151904780 !ruby/object:Gem::Requirement
60
+ requirement: &2151904960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.3.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2151904780
68
+ version_requirements: *2151904960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: yard
71
- requirement: &2151904200 !ruby/object:Gem::Requirement
71
+ requirement: &2151904380 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,8 +76,8 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2151904200
80
- description: Pubba is a Sinatra extension designed to help you manage your site.
79
+ version_requirements: *2151904380
80
+ description:
81
81
  email:
82
82
  - andy@stonean.com
83
83
  executables: []
@@ -147,6 +147,7 @@ rubyforge_project: pubba
147
147
  rubygems_version: 1.8.10
148
148
  signing_key:
149
149
  specification_version: 3
150
- summary: Pubba is a Sinatra extension.
150
+ summary: Pubba is a Sinatra extension designed to help you manage the static components
151
+ of your site.
151
152
  test_files: []
152
153
  has_rdoc: