fume 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -14,4 +14,20 @@ begin
14
14
  Jeweler::GemcutterTasks.new
15
15
  rescue LoadError
16
16
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
- end
17
+ end
18
+
19
+ require 'spec/rake/spectask'
20
+ Spec::Rake::SpecTask.new(:spec) do |spec|
21
+ spec.libs << 'lib' << 'spec'
22
+ spec.spec_opts = ['--options', "spec/spec.opts"]
23
+ spec.spec_files = FileList['spec/**/*_spec.rb']
24
+ end
25
+
26
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.pattern = 'spec/**/*_spec.rb'
29
+ spec.rcov = true
30
+ end
31
+
32
+ task :spec => :check_dependencies
33
+ task :default => :spec
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
3
  :minor: 3
4
- :patch: 1
4
+ :patch: 2
5
5
  :major: 0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fume}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sunteya"]
12
- s.date = %q{2010-01-11}
12
+ s.date = %q{2010-01-21}
13
13
  s.email = %q{Sunteya@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README"
@@ -66,13 +66,21 @@ Gem::Specification.new do |s|
66
66
  "lib/fume/rails_ext.rb",
67
67
  "lib/fume/searchlogic.rb",
68
68
  "lib/fume/simple_theme.rb",
69
- "rails/init.rb"
69
+ "lib/fume/smart_logger.rb",
70
+ "rails/init.rb",
71
+ "spec/smart_logger_spec.rb",
72
+ "spec/spec.opts",
73
+ "spec/spec_helper.rb"
70
74
  ]
71
75
  s.homepage = %q{http://github.com/sunteya/fume}
72
76
  s.rdoc_options = ["--charset=UTF-8"]
73
77
  s.require_paths = ["lib"]
74
78
  s.rubygems_version = %q{1.3.5}
75
79
  s.summary = %q{a simple rails scaffold.}
80
+ s.test_files = [
81
+ "spec/smart_logger_spec.rb",
82
+ "spec/spec_helper.rb"
83
+ ]
76
84
 
77
85
  if s.respond_to? :specification_version then
78
86
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -3,9 +3,10 @@ require 'fume/searchlogic'
3
3
  require 'fume/simple_theme'
4
4
  require 'fume/rails_ext'
5
5
  require 'fume/formtastic'
6
+ require 'fume/smart_logger'
6
7
 
7
- module Fume
8
- def self.root
9
- @root ||= Pathname.new(File.dirname(__FILE__)).join("..")
10
- end
11
- end
8
+ # module Fume
9
+ # def self.root
10
+ # @root ||= Pathname.new(File.dirname(__FILE__)).join("..")
11
+ # end
12
+ # end
@@ -0,0 +1,18 @@
1
+ require "logger"
2
+
3
+ module Fume
4
+ class SmartLogger
5
+ def self.create(name)
6
+ case name
7
+ when "STDOUT"
8
+ Logger.new(STDOUT)
9
+ when /(\w+)/
10
+ Logger.new("log/#{$1}.log")
11
+ when /(\w+\.\w+)/
12
+ Logger.new("log/#{$1}")
13
+ else
14
+ Logger.new("log/#{Rails.env}.log")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+
3
+ module Rails
4
+ class << self
5
+ attr_accessor :env
6
+ end
7
+ end
8
+
9
+ describe Fume::SmartLogger do
10
+ before(:each) do
11
+ @logger = Logger.new(STDOUT)
12
+ end
13
+
14
+ it "should be create STDOUT logger" do
15
+ Logger.should_receive(:new).with(STDOUT).and_return(@logger)
16
+ SmartLogger.create("STDOUT").should be_eql @logger
17
+ end
18
+
19
+ it "should be create log file logger" do
20
+ Logger.should_receive(:new).with("log/file.log").and_return(@logger)
21
+ SmartLogger.create("file").should be_eql @logger
22
+ end
23
+
24
+ it "should be create log file logger with ext" do
25
+ Logger.should_receive(:new).with("log/file.log").and_return(@logger)
26
+ SmartLogger.create("file.log").should be_eql @logger
27
+ end
28
+
29
+ it "should be create log file by Rails env" do
30
+ Logger.should_receive(:new).with("log/development.log").and_return(@logger)
31
+ Rails.env = "development"
32
+ SmartLogger.create(nil).should be_eql @logger
33
+ end
34
+ end
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,12 @@
1
+ # require 'rubygems'
2
+ # require 'spec'
3
+
4
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'fume')
5
+
6
+
7
+
8
+ include Fume
9
+
10
+ Spec::Runner.configure do |config|
11
+
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fume
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunteya
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-11 00:00:00 +08:00
12
+ date: 2010-01-21 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -73,7 +73,11 @@ files:
73
73
  - lib/fume/rails_ext.rb
74
74
  - lib/fume/searchlogic.rb
75
75
  - lib/fume/simple_theme.rb
76
+ - lib/fume/smart_logger.rb
76
77
  - rails/init.rb
78
+ - spec/smart_logger_spec.rb
79
+ - spec/spec.opts
80
+ - spec/spec_helper.rb
77
81
  has_rdoc: true
78
82
  homepage: http://github.com/sunteya/fume
79
83
  licenses: []
@@ -102,5 +106,6 @@ rubygems_version: 1.3.5
102
106
  signing_key:
103
107
  specification_version: 3
104
108
  summary: a simple rails scaffold.
105
- test_files: []
106
-
109
+ test_files:
110
+ - spec/smart_logger_spec.rb
111
+ - spec/spec_helper.rb