Skip to content

Commit

Permalink
Added CSS builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Spencer committed Aug 31, 2009
1 parent e78db42 commit b8ecb12
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
1 change: 1 addition & 0 deletions scripts/builder.rb
Expand Up @@ -148,6 +148,7 @@ def self.dispatch
def self.instances_for(name, args)
klass = case name
when 'app' : ExtMVC::AppBuilder
when 'css' : ExtMVC::CssBuilder
when 'mvc' : ExtMVC::MVCBuilder
when 'docs' : ExtMVC::DocsBuilder
when 'plugin': ExtMVC::PluginBuilder
Expand Down
2 changes: 1 addition & 1 deletion scripts/builders/all_builder.rb
Expand Up @@ -2,7 +2,7 @@ module ExtMVC
class AllBuilder < Builder
def self.instances(args = [])
# set defaults
args = ['app', 'plugin', 'mvc'] if args.empty?
args = ['app', 'css', 'plugin', 'mvc'] if args.empty?
instances = []

args.each {|builderName| instances.concat(ExtMVC::BuilderManager.instances_for(builderName, []))}
Expand Down
34 changes: 34 additions & 0 deletions scripts/builders/css_builder.rb
@@ -0,0 +1,34 @@
module ExtMVC
class CssBuilder < Builder
def self.instances(args = [])
[ExtMVC::CssBuilder.new]
end

def file_list
# build to production environment
environment = ExtMVC.mvc_development_environment

return ExtMVC.css_files_for(environment)
end

def name
"Ext MVC Application Stylesheets"
end

def message
"Built #{name}"
end

def description
"Your #{name}"
end

def output_filename
"public/stylesheets/application-all.css"
end

def directory_name
"public/stylesheets/"
end
end
end
1 change: 1 addition & 0 deletions scripts/scripts.rb
Expand Up @@ -2,6 +2,7 @@
require 'vendor/mvc/scripts/builders/plugin_builder'
require 'vendor/mvc/scripts/builders/mvc_builder'
require 'vendor/mvc/scripts/builders/app_builder'
require 'vendor/mvc/scripts/builders/css_builder'
require 'vendor/mvc/scripts/builders/all_builder'

require 'vendor/mvc/scripts/generator'
Expand Down
20 changes: 18 additions & 2 deletions scripts/settings.rb
Expand Up @@ -33,6 +33,22 @@ def self.application_files_for(environment)
files
end

def self.css_files_for(environment)
environment['stylesheets'].collect {|s| "public/stylesheets/#{s}.css"}
end

def self.mvc_development_environment
environment = {}

default = JSON::Parser.new(File.read('public/config/environment.json')).parse()
development = JSON::Parser.new(File.read('public/config/environments/development.json')).parse()

environment.merge!(default)
environment.merge!(development)

environment
end

def self.mvc_production_environment
environment = {
'pluginsDir' => '../vendor/plugins',
Expand All @@ -46,8 +62,8 @@ def self.mvc_production_environment
'stylesheets' => ['ext-all']
}

default = JSON::Parser.new(File.read('config/environment.json')).parse()
production = JSON::Parser.new(File.read('config/environments/production.json')).parse()
default = JSON::Parser.new(File.read('public/config/environment.json')).parse()
production = JSON::Parser.new(File.read('public/config/environments/production.json')).parse()

environment.merge!(default)
environment.merge!(production)
Expand Down

0 comments on commit b8ecb12

Please sign in to comment.