From 1e559fa3caba289dad751b06692569a3a5affb24 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 30 Jun 2013 18:06:28 -0400 Subject: [PATCH] add initial Environment class --- lib/rscons.rb | 5 +---- lib/rscons/environment.rb | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 lib/rscons/environment.rb diff --git a/lib/rscons.rb b/lib/rscons.rb index 79da761..061c97c 100644 --- a/lib/rscons.rb +++ b/lib/rscons.rb @@ -1,5 +1,2 @@ require "rscons/version" - -module Rscons - # Your code goes here... -end +require "rscons/environment" diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb new file mode 100644 index 0000000..41c8e56 --- /dev/null +++ b/lib/rscons/environment.rb @@ -0,0 +1,29 @@ +module Rscons + class Environment + class << self + alias_method :orig_new, :new + end + + def self.new(*args) + e = Environment.orig_new(*args) + if block_given? + yield e + e.process + end + e + end + + # Initialize a newly constructed Environment object + # === Arguments + # +variables+ _Hash_ :: + # the variables hash can contain both construction variables, which are + # uppercase strings (such as "CC" or "LDFLAGS"), and rscons options, + # which are lowercase symbols (such as :echo). + def initialize(variables = {}) + @variables = variables + end + + def process + end + end +end