Browse files

reducing the albacore.configure code back down to just paths for now.…

… adding basic watchr script to help with continuous testing
  • Loading branch information...
1 parent bebd2a4 commit 5cedddd8e48d40a163666b7e5db83be92c5fd934 @derickbailey committed May 30, 2010
Showing with 9 additions and 117 deletions.
  1. +0 −40 lib/albacore/support/config.rb
  2. +1 −77 spec/config_spec.rb
  3. +8 −0 watchrtesting.rb
View
40 lib/albacore/support/config.rb
@@ -35,45 +35,5 @@ def add_path(name, path)
def get_path(name)
@paths[name]
end
-
- def add_command(name, path, command)
- @commands[name] = Command.new path, command
- end
-
- def get_command(name)
- cmd = @commands[name]
- msg = "The '#{name.to_s}' task has not been configured"
- fail msg if cmd.nil?
- cmd.fullpath
- end
-
- def has_command?(name)
- @commands.include? name
- end
-
- def method_missing(symbol, *args)
- case args.count
- when 1
- add_command symbol, nil, args[0]
- when 2
- add_command symbol, args[0], args[1]
- else
- super symbol, *args
- end
- end
- end #Configuration
-
- class Command
- def initialize(path, command)
- @path = path
- @command = command
- end
-
- def fullpath
- return @command if @path.nil?
-
- path = Albacore.configuration.get_path(@path) || @path
- File.join(path, @command)
- end
end
end
View
78 spec/config_spec.rb
@@ -8,7 +8,7 @@
end
it "should make the path available by the supplied name" do
- Albacore.configuration.get_path :path_name
+ Albacore.configuration.get_path(:path_name).should == "./whatever/"
end
end
@@ -30,79 +30,3 @@
Albacore.configuration.get_path(:doesnotexist).should == nil
end
end
-
-describe "when requesting the command for a task" do
- before :each do
- Albacore.configure do |config|
- config.sometask "some/dir", "command.exe"
- end
- end
-
- it "should provide the appended path and command" do
- Albacore.configuration.get_command(:sometask).should == "some/dir/command.exe"
- end
-end
-
-describe "when requesting the command for a task that was configured with a named path" do
- before :each do
- Albacore.configure do |config|
- config.add_path :path, "what/ever"
- config.mytask :path, "my.exe"
- end
- end
-
- it "should evaluate the path by the name and append the path and command" do
- Albacore.configuration.get_command(:mytask).should == "what/ever/my.exe"
- end
-end
-
-describe "when requesting the command for a task that has not been registered" do
- before :each do
- begin
- Albacore.configuration.get_command :has_not_been_configured
- rescue
- @error_message = $!
- end
- end
-
- it "should fail saying the task is not configured" do
- @error_message.to_s.should == "The 'has_not_been_configured' task has not been configured"
- end
-end
-
-describe "when registering a task with only a command parameter" do
- before :each do
- Albacore.configure do |config|
- config.oneparam "one/parameter.exe"
- end
- end
-
- it "should use the command parameter as the path and command" do
- Albacore.configuration.get_command(:oneparam).should == "one/parameter.exe"
- end
-end
-
-describe "when providing a configuration method to the configuration api" do
- before :all do
- class Test
- attr_accessor :test
- end
-
- Albacore.configure do |config|
- config.add_configuration :testfoo do |&block|
- block.call(Test.new) unless block.nil?
- end
- end
-
- Albacore.configure do |config|
- config.testfoo do |testdata|
- testdata.test = "this is config data"
- @configdata = testdata
- end
- end
- end
-
- it "should accept a parameter for configuration data" do
- @configdata.test.should == "this is config data"
- end
-end
View
8 watchrtesting.rb
@@ -0,0 +1,8 @@
+watch("lib/albacore/.*\.rb") { |md|
+ file = File.basename(md[0], ".rb")
+ system "spec spec/#{file}_spec.rb"
+}
+
+watch("spec/.*_spec\.rb") { |md|
+ system "spec #{md[0]}"
+}

0 comments on commit 5cedddd

Please sign in to comment.