Permalink
Browse files

Added catalog & tests

Added rcov task
Added todolist
  • Loading branch information...
1 parent 9497375 commit 1c7c6c29c0405f08057774350fac973c32bfb07f Jeroen van Schagen committed Nov 17, 2009
Showing with 64 additions and 13 deletions.
  1. +1 −0 .gitignore
  2. +10 −13 Rakefile
  3. +6 −0 docs/todo.txt
  4. +18 −0 lib/catalog.rb
  5. 0 spec/assets/README
  6. +29 −0 spec/catalog_spec.rb
View
@@ -1,3 +1,4 @@
pkg/*
interfacelift.gemspec
+coverage/*
View
@@ -6,10 +6,10 @@ begin
Jeweler::Tasks.new do |gem|
gem.name = "interfacelift"
gem.summary = %Q{Installs templates in rails applications}
- gem.description = %Q{Collection of cool layouts to use in your rails apps.}
+ gem.description = %Q{Installs themes and other layout/interface related resources}
gem.email = "michel@re-invention.nl"
gem.homepage = "http://github.com/michel/interfacelift"
- gem.authors = ["Michel de Graaf"]
+ gem.authors = ["Michel de Graaf","Jeroen van Schagen"]
gem.add_development_dependency "thoughtbot-shoulda"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
@@ -26,17 +26,14 @@ Spec::Rake::SpecTask.new('spec') do |t|
end
-begin
- require 'rcov/rcovtask'
- Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/*_test.rb'
- test.verbose = true
- end
-rescue LoadError
- task :rcov do
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
- end
+require 'rake'
+require 'spec/rake/spectask'
+
+desc "Run all examples with RCov"
+Spec::Rake::SpecTask.new('examples_with_rcov') do |t|
+ t.spec_files = FileList['spec/**/*.rb']
+ t.rcov = true
+ t.rcov_opts = ['--exclude', 'examples']
end
View
@@ -0,0 +1,6 @@
+- Create a better API for installing themes (see rails template DSL).
+ - Adding code to a file.
+ - Optional theme settings.
+
+- Fetch themes from a webservice or remote GIT repo.
+- Better install control, ask to overwrite files.
View
@@ -0,0 +1,18 @@
+module InterfaceLift
+ class Catalog
+ attr_reader :catalog_path
+
+ def initialize(catalog_path = nil)
+ @catalog_path = catalog_path.nil? ? DEFAULT_CATELOG_PATH : catalog_path
+ end
+
+ # Retrieve themes from specified catalog path
+ def themes
+ themes = []
+ Dir.glob("#{@catalog_path}/*").each do |item|
+ themes << item if File.directory? item
+ end
+ themes.map { |path| path.split("/").last }
+ end
+ end
+end
View
No changes.
View
@@ -0,0 +1,29 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+include InterfaceLift
+describe Catalog do
+ context "Initialize" do
+ it "should initialize with a path that contains the users current themes" do
+ @path = "~/.interfacelift"
+ @cat = Catalog.new(@path)
+ @cat.catalog_path.should == @path
+ end
+
+ it "should take a default path when no path is provided" do
+ @cat = Catalog.new
+ @cat.catalog_path.should == DEFAULT_CATELOG_PATH
+ end
+ end
+
+ context "Catalog content" do
+ it "should provide a list of the available themes in the given path" do
+ @cat = Catalog.new(File.dirname(__FILE__) + "/assets")
+ themes = ["test_theme", "test_theme2"]
+ @cat.themes.should == themes
+ end
+
+
+
+ end
+
+end

0 comments on commit 1c7c6c2

Please sign in to comment.