Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Fix rails detection
Browse files Browse the repository at this point in the history
[fixes #39825041]

Change-Id: Id4ad49b74c2bf1953b553dcfb27bf8ea5a772781
  • Loading branch information
vito committed Nov 28, 2012
1 parent fea2e06 commit b076425
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/vmc/detect.rb
Expand Up @@ -87,11 +87,11 @@ def map_detectors!
@detector_frameworks = {}

Clouseau.detectors.each do |d|
name = d.framework_name.to_s
name = d.framework_name
lang = d.language_name

framework = all_frameworks.find { |f|
f.name == name ||
f.name == name.to_s ||
f.name == FRAMEWORK_NAMES[name]
}

Expand Down
54 changes: 54 additions & 0 deletions spec/detect_spec.rb
@@ -0,0 +1,54 @@
require 'spec_helper'

describe VMC::Detector do
let(:client) { FactoryGirl.build(:client, :frameworks => [framework]) }
let(:detector) { VMC::Detector.new client, nil }

describe '#detect_framework' do
subject { detector.detect_framework }

{ Clouseau::Django => "django",
Clouseau::DotNet => "dotNet",
Clouseau::Grails => "grails",
Clouseau::Java => "java_web",
Clouseau::Lift => "lift",
Clouseau::Node => "node",
Clouseau::PHP => "php",
Clouseau::Play => "play",
Clouseau::Python => "wsgi",
Clouseau::Rack => "rack",
Clouseau::Rails => "rails3",
Clouseau::Sinatra => "sinatra",
Clouseau::Spring => "spring"
}.each do |clouseau_detective, cf_name|
context "when we detected #{clouseau_detective}" do
let(:framework) { FactoryGirl.build(:framework, :name => cf_name) }

it "maps to CF name #{cf_name}" do
stub(Clouseau).detect(anything) { clouseau_detective }
should eq framework
end
end
end
end

describe '#detect_runtime' do

end

describe '#runtimes' do

end

describe '#suggested_memory' do

end

describe '#all_runtimes' do

end

describe '#all_frameworks' do

end
end
2 changes: 2 additions & 0 deletions spec/factories/client_factory.rb
Expand Up @@ -3,12 +3,14 @@
ignore do
routes []
apps []
frameworks []
end

after_build do |client, evaluator|
RR.stub(client).logged_in? { true }
RR.stub(client).routes { evaluator.routes }
RR.stub(client).apps { evaluator.apps }
RR.stub(client).frameworks { evaluator.frameworks }
end
end
end
9 changes: 9 additions & 0 deletions spec/factories/framework_factory.rb
@@ -0,0 +1,9 @@
FactoryGirl.define do
factory :framework, :class => CFoundry::V2::Framework do
name { FactoryGirl.generate(:random_string) }

initialize_with do
CFoundry::V2::Framework.new(nil, nil)
end
end
end
2 changes: 1 addition & 1 deletion vmc.gemspec
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "json_pure", "~> 1.6.5"
s.add_runtime_dependency "interact", "~> 0.4.8"
s.add_runtime_dependency "cfoundry", "~> 0.4.0"
s.add_runtime_dependency "clouseau", "~> 0.0.1"
s.add_runtime_dependency "clouseau", "~> 0.0.2"
s.add_runtime_dependency "mothership", "~> 0.2.5"
s.add_runtime_dependency "manifests-vmc-plugin", "~> 0.4.13"
s.add_runtime_dependency "tunnel-dummy-vmc-plugin", "~> 0.0.2"
Expand Down

0 comments on commit b076425

Please sign in to comment.