geemus-merb-less 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/merb-less/merb-less.rb +24 -0
- data/lib/merb-less.rb +12 -21
- data/merb-less.gemspec +48 -0
- metadata +3 -2
- data/merb-less.rb +0 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Merb
|
2
|
+
class Less
|
3
|
+
|
4
|
+
def self.compile(compress = false)
|
5
|
+
Dir["#{Merb.root}/public/stylesheets/*.less"].each do |source|
|
6
|
+
destination_file = File.basename(source, File.extname(source))
|
7
|
+
destination_directory = "#{Merb.root}/public/stylesheets"
|
8
|
+
destination = "#{destination_directory}/#{destination_file}.css"
|
9
|
+
|
10
|
+
if !File.exists?(destination) || File.stat(source).mtime > File.stat(destination).mtime
|
11
|
+
engine = ::Less::Engine.new(File.read(source))
|
12
|
+
css = engine.to_css
|
13
|
+
if compress
|
14
|
+
css = css.delete("\n")
|
15
|
+
end
|
16
|
+
File.open(destination, "w+") do |file|
|
17
|
+
file.puts(css)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/merb-less.rb
CHANGED
@@ -1,24 +1,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# make sure we're running inside Merb
|
2
|
+
if defined?(Merb)
|
3
|
+
require 'less'
|
4
|
+
require "#{File.dirname(__FILE__)}/lib/merb-less"
|
3
5
|
|
4
|
-
|
5
|
-
Dir["#{Merb.root}/public/stylesheets/*.less"].each do |source|
|
6
|
-
destination_file = File.basename(source, File.extname(source))
|
7
|
-
destination_directory = "#{Merb.root}/public/stylesheets"
|
8
|
-
destination = "#{destination_directory}/#{destination_file}.css"
|
9
|
-
|
10
|
-
if !File.exists?(destination) || File.stat(source).mtime > File.stat(destination).mtime
|
11
|
-
engine = ::Less::Engine.new(File.read(source))
|
12
|
-
css = engine.to_css
|
13
|
-
if compress
|
14
|
-
css = css.delete("\n")
|
15
|
-
end
|
16
|
-
File.open(destination, "w+") do |file|
|
17
|
-
file.puts(css)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
6
|
+
Merb::Plugins.config[:less] ||= {}
|
22
7
|
|
8
|
+
case Merb.env
|
9
|
+
when 'development'
|
10
|
+
Merb::AbstractController.before { Merb::Less.compile }
|
11
|
+
when 'production'
|
12
|
+
Merb::Less.compile(true)
|
23
13
|
end
|
24
|
-
|
14
|
+
|
15
|
+
end
|
data/merb-less.gemspec
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{merb-less}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Wesley Beary"]
|
12
|
+
s.date = %q{2009-08-19}
|
13
|
+
s.description = %q{Merb plugin for less css}
|
14
|
+
s.email = %q{wbeary@engineyard.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/merb-less.rb",
|
27
|
+
"lib/merb-less/merb-less.rb",
|
28
|
+
"merb-less.gemspec"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/geemus/merb-less}
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.5}
|
34
|
+
s.summary = %q{Merb plugin for less css}
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
41
|
+
s.add_runtime_dependency(%q<less>, [">= 1.0.0"])
|
42
|
+
else
|
43
|
+
s.add_dependency(%q<less>, [">= 1.0.0"])
|
44
|
+
end
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<less>, [">= 1.0.0"])
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geemus-merb-less
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wesley Beary
|
@@ -39,7 +39,8 @@ files:
|
|
39
39
|
- Rakefile
|
40
40
|
- VERSION
|
41
41
|
- lib/merb-less.rb
|
42
|
-
- merb-less.rb
|
42
|
+
- lib/merb-less/merb-less.rb
|
43
|
+
- merb-less.gemspec
|
43
44
|
has_rdoc: false
|
44
45
|
homepage: http://github.com/geemus/merb-less
|
45
46
|
licenses:
|
data/merb-less.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# make sure we're running inside Merb
|
2
|
-
if defined?(Merb)
|
3
|
-
require 'less'
|
4
|
-
require "#{File.dirname(__FILE__)}/lib/merb-less"
|
5
|
-
|
6
|
-
Merb::Plugins.config[:less] ||= {}
|
7
|
-
|
8
|
-
case Merb.env
|
9
|
-
when 'development'
|
10
|
-
Merb::AbstractController.before { Merb::Less.compile }
|
11
|
-
when 'production'
|
12
|
-
Merb::Less.compile(true)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|