themes_for_rails 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.textile +24 -1
- data/lib/themes_for_rails.rb +4 -3
- data/lib/themes_for_rails/railtie.rb +5 -7
- data/lib/themes_for_rails/version.rb +1 -1
- data/test/dummy_app/config/environments/test.rb +1 -0
- data/themes_for_rails.gemspec +2 -2
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/README.textile
CHANGED
@@ -129,10 +129,28 @@ Inside the themes folder, it create a structure for my_theme.
|
|
129
129
|
rails generate theme_for_rails:theme my_theme
|
130
130
|
</pre>
|
131
131
|
|
132
|
+
h2. Changing things
|
133
|
+
|
134
|
+
At least for now, you can change the ThemesForRails base dir in your app, in the corresponding environment file, or in your application.rb file. Do it like this:
|
135
|
+
|
136
|
+
<pre>
|
137
|
+
KillerApp::Application.configure do
|
138
|
+
#
|
139
|
+
|
140
|
+
config.themes_for_rails.base_dir = File.join(Rails.root, "skins")
|
141
|
+
|
142
|
+
#...
|
143
|
+
end
|
144
|
+
</pre>
|
145
|
+
|
146
|
+
h2. Documentation
|
147
|
+
|
148
|
+
"Read it here":http://rubydoc.info/github/lucasefe/themes_for_rails/master/frames
|
149
|
+
|
132
150
|
h2. Ideas
|
133
151
|
|
134
152
|
* Add ThemesForRails::Railtie for configuration, so we selectively set the plugin on or off. Also to be able to change several settings.
|
135
|
-
* Add routes to allow access to the theme's static resources (js and cs), unless cached on public folder by capistrano / rake
|
153
|
+
* -Add routes to allow access to the theme's static resources (js and cs), unless cached on public folder by capistrano / rake.-
|
136
154
|
* -Extend Action View path in order to make the views accessible. Same for the layouts.-
|
137
155
|
* More tests ford edge cases. Now I am only testing the happy paths.
|
138
156
|
|
@@ -142,6 +160,11 @@ h2. Things to remember.
|
|
142
160
|
* -Research about testing this kind of gem. I really don't have a clue.- Testing in place!
|
143
161
|
* I should probably load the theme list at start time, to be able to consult it as needed. I am gonna need that when dealing with runtime theme selection. Many themes are going to be used simultaneously, so I have to be able to switch view paths as fast as I can.
|
144
162
|
|
163
|
+
h2. Rails 2 Support
|
164
|
+
|
165
|
+
This gem only works with Rails 3 (duh). If you want the same exactly behavior, but for Rails 2.x, go "here":http://github.com/jystewart/theme_support .
|
166
|
+
|
167
|
+
|
145
168
|
h2. Running tests
|
146
169
|
|
147
170
|
<pre>
|
data/lib/themes_for_rails.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module ThemesForRails
|
2
2
|
class << self
|
3
|
-
|
4
|
-
|
3
|
+
attr_writer :base_dir
|
4
|
+
def base_dir
|
5
|
+
@base_dir ||= Rails.root
|
5
6
|
end
|
6
7
|
def available_themes
|
7
|
-
Dir.glob("#{
|
8
|
+
Dir.glob("#{base_dir}/themes/*")
|
8
9
|
end
|
9
10
|
def available_theme_names
|
10
11
|
@available_theme_names ||= available_themes.map {|theme| File.basename(theme) }
|
@@ -3,16 +3,14 @@
|
|
3
3
|
module ThemesForRails
|
4
4
|
class Railtie < ::Rails::Railtie
|
5
5
|
config.themes_for_rails = ActiveSupport::OrderedOptions.new
|
6
|
-
config.themes_for_rails.on = true
|
7
|
-
# config.themes_for_rails.base_path = File.join([::Rails.root, 'themes'])
|
8
|
-
rake_tasks do
|
9
|
-
load "tasks/themes_for_rails.rake"
|
10
|
-
end
|
11
6
|
|
12
7
|
config.to_prepare do
|
13
|
-
ThemesForRails::Railtie.config.themes_for_rails.each do |
|
14
|
-
|
8
|
+
ThemesForRails::Railtie.config.themes_for_rails.each do |key, value|
|
9
|
+
ThemesForRails.send "#{key}=".to_sym, value
|
15
10
|
end
|
16
11
|
end
|
12
|
+
rake_tasks do
|
13
|
+
load "tasks/themes_for_rails.rake"
|
14
|
+
end
|
17
15
|
end
|
18
16
|
end
|
data/themes_for_rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{themes_for_rails}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lucas Florio"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-16}
|
13
13
|
s.description = %q{It allows an application to have many different ways of rendering static assets and dynamic views. }
|
14
14
|
s.email = %q{lucasefe@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Lucas Florio
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-16 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|