teejayvanslyke-sassafras 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,192 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe Sassafras do
4
+
5
+ describe Sassafras::Theme do
6
+
7
+ describe "when creating a basic color scheme" do
8
+
9
+ before :each do
10
+ @sassafras = Sassafras::Theme.basic(:red)
11
+ end
12
+
13
+ def red_values
14
+ {
15
+ 'lightest' => '#ffe6e6',
16
+ 'lighter' => '#ffb3b3',
17
+ 'light' => '#ff8080',
18
+ 'mid' => '#ff0000',
19
+ 'dark' => '#800000',
20
+ 'darker' => '#4d0000',
21
+ 'darkest' => '#1a0000'
22
+ }
23
+ end
24
+
25
+ it "sets the base color" do
26
+ @sassafras.base.should == "#ff0000"
27
+ end
28
+
29
+ it "generates the base tints and shades" do
30
+ red_values.each do |name, hex|
31
+ @sassafras.colors(:base).should have_key(name)
32
+ @sassafras.colors(:base)[name].should == hex
33
+ end
34
+ end
35
+
36
+ it "generates the correct SASS output" do
37
+ sass = <<SASS
38
+ # Color scheme generated by Sassafras
39
+ # http://github.com/teejayvanslyke/sassafras/
40
+ # ================= base ====================
41
+ !base_lightest = #ffe6e6
42
+ !base_lighter = #ffb3b3
43
+ !base_light = #ff8080
44
+ !base_mid = #ff0000
45
+ !base_dark = #800000
46
+ !base_darker = #4d0000
47
+ !base_darkest = #1a0000
48
+ SASS
49
+ pending "..."
50
+ @sassafras.sass.should == sass
51
+ end
52
+
53
+ it "only has one color set" do
54
+ @sassafras.colors.size.should == 1
55
+ end
56
+ end
57
+
58
+
59
+ describe "when generating Sass output" do
60
+
61
+ before :each do
62
+ @sassafras = Sassafras::Theme.basic(:red)
63
+ end
64
+
65
+ it "outputs the base color" do
66
+ @sassafras.sass.should include("!base_mid = #ff0000")
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+
73
+ describe "when generating color sets for a new type of theme" do
74
+
75
+ class TestTheme < Sassafras::Theme
76
+
77
+ color 'minus_five', -5
78
+ color 'one', +1
79
+ color 'two', +2
80
+ color 'three', +3
81
+
82
+ end
83
+
84
+ before :each do
85
+ @theme = TestTheme.new(:red)
86
+ end
87
+
88
+ def self.it_has_color(name, steps)
89
+ it "has all variations of the #{name} color" do
90
+ %w(lightest lighter light mid dark darker darkest).each do |variation|
91
+ @theme.colors(name).should have_key(variation)
92
+ end
93
+ end
94
+ end
95
+
96
+ it_has_color('minus_five', -5)
97
+ it_has_color('one', +1)
98
+ it_has_color('two', +2)
99
+ it_has_color('three', +3)
100
+
101
+ end
102
+
103
+
104
+
105
+ describe Sassafras::Tints do
106
+
107
+ before :each do
108
+ @tints = Sassafras::Tints.new(Color::RGB::Red)
109
+ end
110
+
111
+ describe "accessing tints" do
112
+
113
+ it "has a base tint" do
114
+ @tints.mid.should == '#ff0000'
115
+ end
116
+
117
+ it "has a light tint" do
118
+ @tints.light.should == '#ff8080'
119
+ end
120
+
121
+ it "has a lighter tint" do
122
+ @tints.lighter.should == '#ffb3b3'
123
+ end
124
+
125
+ it "has a lightest tint" do
126
+ @tints.lightest.should == '#ffe6e6'
127
+ end
128
+
129
+ end
130
+
131
+ describe "when generating Sass output" do
132
+
133
+ it "outputs five levels of tints" do
134
+ end
135
+ end
136
+
137
+ describe "when generating colors with a prefixed name" do
138
+ before :each do
139
+ @tints = Sassafras::Tints.new(Color::RGB::Red, 'foo')
140
+ end
141
+
142
+ it "prefixes all of the colors with the specified prefix" do
143
+ @tints.colors.should have_key('foo_mid')
144
+ @tints.colors.should have_key('foo_light')
145
+ @tints.colors.should have_key('foo_lighter')
146
+ @tints.colors.should have_key('foo_lightest')
147
+ end
148
+ end
149
+
150
+ end
151
+
152
+ describe Sassafras::Shades do
153
+
154
+ before :each do
155
+ @shades = Sassafras::Shades.new(Color::RGB::Red)
156
+ end
157
+
158
+ describe "accessing shades" do
159
+
160
+ it "has a base shade" do
161
+ @shades.mid.should == '#ff0000'
162
+ end
163
+
164
+ it "has a dark shade" do
165
+ @shades.dark.should == '#800000'
166
+ end
167
+
168
+ it "has a darker shade" do
169
+ @shades.darker.should == '#4d0000'
170
+ end
171
+
172
+ it "has a darkest shade" do
173
+ @shades.darkest.should == '#1a0000'
174
+ end
175
+ end
176
+
177
+ describe "when generating colors with a prefixed name" do
178
+ before :each do
179
+ @shades = Sassafras::Shades.new(Color::RGB::Red, 'foo')
180
+ end
181
+
182
+ it "prefixes all of the colors with the specified prefix" do
183
+ @shades.colors.should have_key('foo_mid')
184
+ @shades.colors.should have_key('foo_dark')
185
+ @shades.colors.should have_key('foo_darker')
186
+ @shades.colors.should have_key('foo_darkest')
187
+ end
188
+ end
189
+ end
190
+
191
+ end
192
+
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'sassafras'
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,8 @@
1
+ task :build_examples do
2
+ def build_example(sassafras_options, output_file)
3
+ sh "#{File.dirname(__FILE__)}/../bin/sassafras #{sassafras_options} > #{File.dirname(__FILE__)}/../examples/#{output_file}"
4
+ end
5
+
6
+ build_example '-t split_complementary -b blue -f html', 'split_complementary_blue.html'
7
+ build_example '-t analogous -b red -f html', 'analogous_red.html'
8
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title>sassafras</title>
5
+
6
+ </head>
7
+ <body id="body">
8
+ <p>This page has not yet been created for RubyGem <code>sassafras</code></p>
9
+ <p>To the developer: To generate it, update website/index.txt and run the rake task <code>website</code> to generate this <code>index.html</code> file.</p>
10
+ </body>
11
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,83 @@
1
+ h1. sassafras
2
+
3
+ h1. &#x2192; 'sassafras'
4
+
5
+
6
+ h2. What
7
+
8
+
9
+ h2. Installing
10
+
11
+ <pre syntax="ruby">sudo gem install sassafras</pre>
12
+
13
+ h2. The basics
14
+
15
+
16
+ h2. Demonstration of usage
17
+
18
+
19
+
20
+ h2. Forum
21
+
22
+ "http://groups.google.com/group/sassafras":http://groups.google.com/group/sassafras
23
+
24
+ TODO - create Google Group - sassafras
25
+
26
+ h2. How to submit patches
27
+
28
+ Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
29
+
30
+ TODO - pick SVN or Git instructions
31
+
32
+ The trunk repository is <code>svn://rubyforge.org/var/svn/sassafras/trunk</code> for anonymous access.
33
+
34
+ OOOORRRR
35
+
36
+ You can fetch the source from either:
37
+
38
+ <% if rubyforge_project_id %>
39
+
40
+ * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
41
+
42
+ <pre>git clone git://rubyforge.org/sassafras.git</pre>
43
+
44
+ <% else %>
45
+
46
+ * rubyforge: MISSING IN ACTION
47
+
48
+ TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
49
+ yet to refresh your local rubyforge data with this projects' id information.
50
+
51
+ When you do this, this message will magically disappear!
52
+
53
+ Or you can hack website/index.txt and make it all go away!!
54
+
55
+ <% end %>
56
+
57
+ * github: "http://github.com/GITHUB_USERNAME/sassafras/tree/master":http://github.com/GITHUB_USERNAME/sassafras/tree/master
58
+
59
+ <pre>git clone git://github.com/GITHUB_USERNAME/sassafras.git</pre>
60
+
61
+
62
+ TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
63
+
64
+
65
+ * gitorious: "git://gitorious.org/sassafras/mainline.git":git://gitorious.org/sassafras/mainline.git
66
+
67
+ <pre>git clone git://gitorious.org/sassafras/mainline.git</pre>
68
+
69
+ h3. Build and test instructions
70
+
71
+ <pre>cd sassafras
72
+ rake test
73
+ rake install_gem</pre>
74
+
75
+
76
+ h2. License
77
+
78
+ This code is free to use under the terms of the MIT license.
79
+
80
+ h2. Contact
81
+
82
+ Comments are welcome. Send an email to "FIXME full name":mailto:FIXME email via the "forum":http://groups.google.com/group/sassafras
83
+