Skip to content

Commit

Permalink
Completed nefarious removal of the Projects class.
Browse files Browse the repository at this point in the history
  • Loading branch information
bguthrie committed Aug 3, 2009
1 parent 285bb89 commit 9496fc0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
8 changes: 7 additions & 1 deletion app/models/project.rb
Expand Up @@ -9,7 +9,9 @@ class << self
attr_accessor :current_project

def all(dir=CRUISE_DATA_ROOT + "/projects")
Projects.new(dir).load_all
load_all(dir).map do |project_dir|
load_project project_dir
end
end

def create(project_name, scm, dir=CRUISE_DATA_ROOT + "/projects")
Expand Down Expand Up @@ -59,6 +61,10 @@ def load_project(dir)

private

def load_all(dir)
Dir["#{dir}/*"].find_all {|child| File.directory?(child)}.sort
end

def save_project(project, dir)
project.path = File.join(dir, project.name)
FileUtils.mkdir_p project.path
Expand Down
23 changes: 0 additions & 23 deletions app/models/projects.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/functional/projects_controller_test.rb
Expand Up @@ -185,7 +185,7 @@ def test_build_should_request_build
project = create_project_stub('two')
Project.expects(:find).with('two').returns(project)
project.expects(:request_build)
Project.stubs(:load_all).returns [ project ]
Project.stubs(:all).returns [ project ]
post :build, :id => "two"
assert_response :success
assert_equal 'two', assigns(:project).name
Expand Down
4 changes: 2 additions & 2 deletions test/unit/project_test.rb
Expand Up @@ -713,7 +713,7 @@ def test_project_all_should_always_reload_project_objects
end
end

test "Projects.load_project should load the project in the given directory" do
test "Project.load_project should load the project in the given directory" do
in_sandbox do |sandbox|
sandbox.new :file => 'one/cruise_config.rb', :with_content => ''

Expand All @@ -724,7 +724,7 @@ def test_project_all_should_always_reload_project_objects
end
end

test "Projects.load_project should load a project without any configuration" do
test "Project.load_project should load a project without any configuration" do
in_sandbox do |sandbox|
sandbox.new :directory => "myproject/work/.svn"
sandbox.new :directory => "myproject/builds-1"
Expand Down

0 comments on commit 9496fc0

Please sign in to comment.