Permalink
Browse files

Updating a bunch of code

  • Loading branch information...
1 parent 5a7fbc3 commit 2e0c9674efe74b3bca73e6e54562385d4057436a @joshuaclayton committed May 24, 2011
Showing with 62 additions and 65 deletions.
  1. +5 −12 Rakefile
  2. +1 −1 bin/palette
  3. +6 −6 features/cli.feature
  4. +3 −2 features/support/env.rb
  5. +9 −7 lib/palette.rb
  6. +0 −1 lib/palette/cli.rb
  7. +1 −1 lib/palette/color_scheme.rb
  8. +4 −4 palette.gemspec
  9. +30 −27 spec/rule_spec.rb
  10. +3 −4 spec/spec_helper.rb
View
17 Rakefile
@@ -1,17 +1,10 @@
-require 'bundler'
+require "bundler"
Bundler::GemHelper.install_tasks
-Bundler.require
-
-require "spec/rake/spectask"
+require "rspec/core/rake_task"
require "cucumber/rake/task"
-Spec::Rake::SpecTask.new('spec') do |t|
- t.spec_files = FileList['spec/**/*.rb']
-end
-
-Cucumber::Rake::Task.new(:features) do |t|
- t.cucumber_opts = "features --format pretty"
-end
+RSpec::Core::RakeTask.new(:rspec)
+Cucumber::Rake::Task.new(:features)
-task :default => [:spec, :features]
+task :default => [:rspec, :features]
View
2 bin/palette
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-require "palette/cli"
+require "palette"
Palette::Cli.new(*ARGV)
View
12 features/cli.feature
@@ -20,7 +20,7 @@ Feature: Run palette from the command line
link :rubyDelimiter, :rubyInterpolationDelimiter, :to => :String
end
"""
- When I run "palette valid_scheme"
+ When I run `palette valid_scheme`
Then the output should contain:
"""
" Vim color file
@@ -58,15 +58,15 @@ Feature: Run palette from the command line
Identifier lighten("000", 60), complement("F00")
end
"""
- When I run "palette valid_scheme"
+ When I run `palette valid_scheme`
Then the output should contain:
"""
hi Normal guifg=#999999 ctermfg=246 guibg=#00FFFF ctermbg=51
hi Identifier guifg=#999999 ctermfg=246 guibg=#00FFFF ctermbg=51
"""
Scenario: Process a nonexistant file
- When I run "palette missing_scheme"
+ When I run `palette missing_scheme`
Then the output should not contain "colors_name"
And the exit status should be 0
@@ -77,7 +77,7 @@ Feature: Run palette from the command line
totally made up junk
end
"""
- When I run "palette invalid_scheme"
+ When I run `palette invalid_scheme`
Then the exit status should be 1
And the output should contain "Please check the syntax of your palette file"
@@ -89,7 +89,7 @@ Feature: Run palette from the command line
Float "FFF", "000"
end
"""
- When I run "palette valid_theme"
+ When I run `palette valid_theme`
Then the output should contain:
"""
hi String guifg=#000000 ctermfg=16 guibg=#FFFFFF ctermbg=231
@@ -104,7 +104,7 @@ Feature: Run palette from the command line
link :htmlEndTag, :htmlTagName, :to => :htmlTag
end
"""
- When I run "palette valid_theme"
+ When I run `palette valid_theme`
Then the output should contain:
"""
hi link htmlTag Type
View
5 features/support/env.rb
@@ -1,3 +1,4 @@
-Bundler.require
+require "bundler/setup"
+Bundler.require(:development)
-require "aruba"
+require "aruba/cucumber"
View
16 lib/palette.rb
@@ -1,10 +1,12 @@
-require "palette/cli"
-require "palette/dsl"
-require "palette/color_scheme"
-require "palette/color"
-require "palette/rule"
-require "palette/link"
-require "palette/version"
+require "bundler/setup"
+Bundler.require(:default)
module Palette
+ autoload :Cli, "palette/cli"
+ autoload :Color, "palette/color"
+ autoload :ColorScheme, "palette/color_scheme"
+ autoload :Dsl, "palette/dsl"
+ autoload :Link, "palette/link"
+ autoload :Rule, "palette/rule"
+ autoload :Version, "palette/version"
end
View
1 lib/palette/cli.rb
@@ -1,4 +1,3 @@
-require "palette"
module Palette
class Cli
def initialize(*args)
View
2 lib/palette/color_scheme.rb
@@ -1,4 +1,4 @@
-require 'sass'
+require "sass"
module Palette
class ColorScheme
View
8 palette.gemspec
@@ -19,11 +19,11 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_dependency "sass", "3.1.0.alpha.23"
+ s.add_dependency "sass", "3.1.1"
- s.add_development_dependency "rspec", "1.3.0"
+ s.add_development_dependency "rspec", "2.5.0"
s.add_development_dependency "mocha", "0.9.8"
s.add_development_dependency "bourne", "1.0"
- s.add_development_dependency "cucumber", "0.9.3"
- s.add_development_dependency "aruba", "0.2.4"
+ s.add_development_dependency "cucumber", "0.10.2"
+ s.add_development_dependency "aruba", "0.3.6"
end
View
57 spec/rule_spec.rb
@@ -15,47 +15,50 @@
end
describe Palette::Rule, "with a foreground" do
- it_should_behave_like "rule with colors"
- subject { Palette::Rule.new("Awesome", fg) }
+ it_should_behave_like "rule with colors" do
+ subject { Palette::Rule.new("Awesome", fg) }
- it "highlights the correct colors" do
- subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm}"
- end
+ it "highlights the correct colors" do
+ subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm}"
+ end
- it "converts the correct colors" do
- subject.to_s
- Palette::Color.should have_received(:new).with(fg)
- Palette::Color.should_not have_received(:new).with(bg)
+ it "converts the correct colors" do
+ subject.to_s
+ Palette::Color.should have_received(:new).with(fg)
+ Palette::Color.should_not have_received(:new).with(bg)
+ end
end
end
describe Palette::Rule, "with a foreground and background" do
- it_should_behave_like "rule with colors"
- subject { Palette::Rule.new("Awesome", fg, bg) }
+ it_should_behave_like "rule with colors" do
+ subject { Palette::Rule.new("Awesome", fg, bg) }
- it "highlights the correct colors" do
- subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm}"
- end
+ it "highlights the correct colors" do
+ subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm}"
+ end
- it "converts the correct colors" do
- subject.to_s
- Palette::Color.should have_received(:new).with(fg)
- Palette::Color.should have_received(:new).with(bg)
+ it "converts the correct colors" do
+ subject.to_s
+ Palette::Color.should have_received(:new).with(fg)
+ Palette::Color.should have_received(:new).with(bg)
+ end
end
end
describe Palette::Rule, "with a hash passed" do
- it_should_behave_like "rule with colors"
- subject { Palette::Rule.new("Awesome", :fg => fg, :bg => bg) }
+ it_should_behave_like "rule with colors" do
+ subject { Palette::Rule.new("Awesome", :fg => fg, :bg => bg) }
- it "highlights the correct colors" do
- subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm}"
- end
+ it "highlights the correct colors" do
+ subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm}"
+ end
- it "converts the correct colors" do
- subject.to_s
- Palette::Color.should have_received(:new).with(fg)
- Palette::Color.should have_received(:new).with(bg)
+ it "converts the correct colors" do
+ subject.to_s
+ Palette::Color.should have_received(:new).with(fg)
+ Palette::Color.should have_received(:new).with(bg)
+ end
end
end
View
7 spec/spec_helper.rb
@@ -1,9 +1,8 @@
-require "spec"
-require "mocha"
require "palette"
-require "bourne"
+require "bundler/setup"
+Bundler.require(:development)
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
config.mock_with :mocha
Mocha::Configuration.warn_when(:stubbing_non_existant_method)

0 comments on commit 2e0c967

Please sign in to comment.