style_train 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/style_train/theme.rb +8 -0
- data/lib/style_train/themed_sheet.rb +3 -3
- data/lib/style_train.rb +5 -1
- data/spec/theme_spec.rb +14 -0
- data/style_train.gemspec +5 -5
- metadata +6 -8
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ begin
|
|
19
19
|
gem.email = "baccigalupi@gmail.com"
|
20
20
|
gem.homepage = "http://github.com/baccigalupi/style_train"
|
21
21
|
gem.authors = ["Kane Baccigalupi"]
|
22
|
-
gem.add_dependency('activesupport'
|
22
|
+
gem.add_dependency('activesupport')
|
23
23
|
end
|
24
24
|
Jeweler::GemcutterTasks.new
|
25
25
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/style_train/theme.rb
CHANGED
@@ -14,6 +14,14 @@ module StyleTrain
|
|
14
14
|
@themes ||= Gnash.new
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.[](key)
|
18
|
+
themes[key]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.keys
|
22
|
+
themes.keys.map{|k| k.to_sym}
|
23
|
+
end
|
24
|
+
|
17
25
|
def initialize(name, value_hash)
|
18
26
|
raise ArgumentError, "Unique name is required as first argument" if !name || self.class.themes[name]
|
19
27
|
missing_keys = self.class.required_keys - value_hash.keys
|
@@ -13,16 +13,16 @@ module StyleTrain
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def theme
|
16
|
-
@theme || self.class.themes
|
16
|
+
@theme || self.class.themes[:default] || raise( "No theme has been set" )
|
17
17
|
end
|
18
18
|
|
19
19
|
def theme=(key)
|
20
|
-
(@theme = self.class.themes
|
20
|
+
(@theme = self.class.themes[key]) || raise( ArgumentError, "Theme #{key.inspect} not found in #{self.class.themes}")
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.export
|
24
24
|
sheet = new
|
25
|
-
themes.
|
25
|
+
themes.keys.each do |key|
|
26
26
|
sheet.theme = key
|
27
27
|
sheet.export
|
28
28
|
end
|
data/lib/style_train.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
$LOAD_PATH.unshift( File.dirname(__FILE__) )
|
2
2
|
|
3
3
|
# Support stuff
|
4
|
-
|
4
|
+
begin
|
5
|
+
require 'active_support/inflector'
|
6
|
+
rescue
|
7
|
+
require 'activesupport'
|
8
|
+
end
|
5
9
|
require 'style_train/support/gnash'
|
6
10
|
require 'style_train/support/numbers'
|
7
11
|
|
data/spec/theme_spec.rb
CHANGED
@@ -52,6 +52,20 @@ describe Theme do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
describe 'class helpers' do
|
56
|
+
before :all do
|
57
|
+
@theme = MyTheme.new(:pink, :foo => 'pink', :bar => 'white')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'returns can access themes via []' do
|
61
|
+
MyTheme[:pink].should == @theme
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'has theme keys' do
|
65
|
+
MyTheme.keys.should include :pink
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
55
69
|
describe 'usage' do
|
56
70
|
before :all do
|
57
71
|
@theme = MyTheme.new(:blue, :foo => 'blue', :bar => 'white', :extra => 'lightyellow')
|
data/style_train.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{style_train}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kane Baccigalupi"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-19}
|
13
13
|
s.description = %q{style_train builds CSS using pure Ruby, not a DSL interpreted via Ruby. This allows inheritance, modules, instance level calculations and all the goodness Ruby can offer.}
|
14
14
|
s.email = %q{baccigalupi@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -74,12 +74,12 @@ Gem::Specification.new do |s|
|
|
74
74
|
s.specification_version = 3
|
75
75
|
|
76
76
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
77
|
-
s.add_runtime_dependency(%q<activesupport>, [">=
|
77
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
78
78
|
else
|
79
|
-
s.add_dependency(%q<activesupport>, [">=
|
79
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
80
80
|
end
|
81
81
|
else
|
82
|
-
s.add_dependency(%q<activesupport>, [">=
|
82
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: style_train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kane Baccigalupi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-19 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,10 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 3
|
30
30
|
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
31
|
- 0
|
34
|
-
version:
|
32
|
+
version: "0"
|
35
33
|
type: :runtime
|
36
34
|
version_requirements: *id001
|
37
35
|
description: style_train builds CSS using pure Ruby, not a DSL interpreted via Ruby. This allows inheritance, modules, instance level calculations and all the goodness Ruby can offer.
|