Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

revert detect

  • Loading branch information...
commit f24be0cd3f1089358f6ab7f230b0e2ecc49c388e 1 parent 2263af3
@jtarchie authored
Showing with 13 additions and 22 deletions.
  1. +9 −12 bin/detect
  2. +3 −7 lib/language_pack.rb
  3. +1 −3 lib/language_pack/nginx.rb
View
21 bin/detect
@@ -1,15 +1,12 @@
#!/usr/bin/env ruby
-# $:.unshift File.expand_path("../../lib", __FILE__)
-# require "language_pack"
+$:.unshift File.expand_path("../../lib", __FILE__)
+require "language_pack"
-# if pack = LanguagePack.detect(ARGV.first)
-# puts pack.name
-# exit 0
-#else
-# puts "no"
-# exit 1
-#end
-
-puts "OpenResty"
-exit 0
+if pack = LanguagePack.detect(ARGV.first)
+ puts pack.name
+ exit 0
+else
+ puts "no"
+ exit 1
+end
View
10 lib/language_pack.rb
@@ -1,5 +1,7 @@
require "pathname"
+require 'language_pack/nginx'
+
# General Language Pack module
module LanguagePack
@@ -8,13 +10,7 @@ module LanguagePack
# @return [LanguagePack] the {LanguagePack} detected
def self.detect(*args)
Dir.chdir(args.first)
-
- pack = [ Nginx ].detect do |klass|
- klass.use?
- end
-
- pack ? pack.new(*args) : nil
+ Nginx.use? ? Nginx.new(*args) : nil
end
end
-require 'language_pack/nginx'
View
4 lib/language_pack/nginx.rb
@@ -7,9 +7,7 @@ class LanguagePack::Nginx < LanguagePack::Base
OPENRESTY_STABLE_VERSION = "1.0.10.24"
def self.use?
- detect_file = File.exist?("nginx.conf")
- topic "detecting nginx.conf - #{detect_file}"
- detect_file
+ File.exist?("nginx.conf")
end
def name
Please sign in to comment.
Something went wrong with that request. Please try again.