Skip to content
This repository has been archived by the owner on Nov 16, 2017. It is now read-only.

Commit

Permalink
question methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmazza committed Apr 19, 2011
1 parent 1866bd9 commit 1b0d2cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/stylus_rails/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def call
directories.each_pair do |directory, files|
FileUtils.mkdir_p(directory) unless File.directory?(directory)
output = `stylus #{files.join(" ")} -o #{directory}#{' -c' if Stylus.compress?} 2>&1`

unless output.nil? # output will be nil in case of running the specs
unless $?.success? # check if everthing went fine
raise CompilationError, "Stylus compilation error #{output}" unless Stylus.silent
unless $?.success? # check if everthing went fine
raise CompilationError, "Stylus compilation error #{output}" unless Stylus.silent?
end

puts output
end
end
Expand Down
7 changes: 4 additions & 3 deletions lib/stylus_rails/stylus.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Stylus
extend CoreExt

# Error messages
Error = Class.new(StandardError)
CompilationError = Class.new(Error)

# Directory to look for .stylus files
mattr_accessor :directory
@@directory = "stylus"
Expand All @@ -22,12 +22,13 @@ module Stylus

mattr_accessor :compress
@@compress = true

mattr_accessor :silent
@@silent = false

class << self
alias_method :compress?, :compress
alias_method :silent?, :silent

def compile
paths = Dir[File.join(folder, "**", "*.#{extension}")]
Expand Down

0 comments on commit 1b0d2cc

Please sign in to comment.