bits2life-estyle 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MIT-LICENCE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Erik Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,35 @@
1
+ eStyle
2
+ ======
3
+
4
+ This project is mainly to simplify my personal stylesheet management, and as
5
+ such, I have yet to write any useful documentation. Basically, it merges css
6
+ files from a number of directories into a single string which is displayed to
7
+ the user. See code for further details.
8
+
9
+ Installation
10
+ ============
11
+
12
+ eStyle is only available as a GemPlugin. Use as a plugin like so:
13
+
14
+ script/plugin install git://github.com/bits2life/estyle.git
15
+
16
+ Or as a gem like so:
17
+
18
+ config.gem 'bits2life-estyle', :source => "http://gems.github.com", :lib => "estyle"
19
+
20
+ Usage
21
+ =====
22
+
23
+ First off, avoid having a controller named stylesheets, since one will be added by
24
+ eStyle. Add a route to this controller in routes.rb
25
+
26
+ map.resources :stylesheets
27
+
28
+ And then place your small, manageable stylesheets in /stylesheets. You're now done.
29
+ Requesting /stylesheets/happy.css will now yield following files, merged:
30
+
31
+ /stylesheets/initial/*.css
32
+ /stylesheets/*.css
33
+ /stylesheets/happy/*.css
34
+
35
+ Please note that there is currently no caching configured.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + "/rails/init"
@@ -0,0 +1,21 @@
1
+
2
+ module EStyle
3
+
4
+ def self.build(dir, theme)
5
+ result = ""
6
+ theme ||= 'default'
7
+
8
+ [
9
+ "#{dir}/initial/*.css",
10
+ "#{dir}/*.css",
11
+ "#{dir}/#{theme}/*.css"
12
+ ].each do |dir|
13
+ Dir[dir].sort.each do |css|
14
+ result += File.read css
15
+ end
16
+ end
17
+
18
+ result
19
+ end
20
+
21
+ end
data/lib/estyle.rb ADDED
@@ -0,0 +1 @@
1
+ require 'estyle/builder'
@@ -0,0 +1,12 @@
1
+
2
+ class StylesheetsController < ActionController::Base
3
+
4
+ def show
5
+ styles = EStyle.build 'public/stylesheets', params[:id]
6
+
7
+ respond_to do |format|
8
+ format.css { render :text => styles }
9
+ end
10
+ end
11
+
12
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'estyle'
2
+ require File.dirname(__FILE__) + "/controller"
3
+
4
+ RAILS_DEFAULT_LOGGER.info("** estyle: initialized")
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bits2life-estyle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Erik Hansson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-02 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: erik@bits2life.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - MIT-LICENCE
26
+ - README
27
+ - init.rb
28
+ - lib/estyle.rb
29
+ - lib/estyle/builder.rb
30
+ - rails/controller.rb
31
+ - rails/init.rb
32
+ has_rdoc: true
33
+ homepage: http://github.com/bits2life/estyle
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --main
37
+ - README
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements: []
53
+
54
+ rubyforge_project:
55
+ rubygems_version: 1.2.0
56
+ signing_key:
57
+ specification_version: 2
58
+ summary: Merges numerous small stylesheets into one large one.
59
+ test_files: []
60
+