pushwagner 0.0.1.2 → 0.0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pushwagner/environment.rb +14 -1
- data/lib/pushwagner/version.rb +1 -1
- metadata +1 -1
@@ -11,7 +11,8 @@ module Pushwagner
|
|
11
11
|
def initialize(opts = {})
|
12
12
|
opts = HashWithIndifferentAccess.new(opts)
|
13
13
|
|
14
|
-
config_file = opts[:config_file]
|
14
|
+
config_file = look_for_config_file(opts[:config_file])
|
15
|
+
|
15
16
|
@version = opts[:version] && opts[:version].to_s
|
16
17
|
@current = opts[:environment] || 'development'
|
17
18
|
|
@@ -53,5 +54,17 @@ module Pushwagner
|
|
53
54
|
def user
|
54
55
|
environment['user'] || "nobody"
|
55
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
def look_for_config_file(file)
|
60
|
+
locations = [file, './deploy.yml', './.pw.yml', './config/deploy.yml']
|
61
|
+
|
62
|
+
locations.each do |location|
|
63
|
+
return location if File.exist? location
|
64
|
+
cf = File.join(File.dirname(__FILE__), location) # i.e rake/thor.
|
65
|
+
return cf if File.exist? cf
|
66
|
+
end
|
67
|
+
raise "Couldn't find config file in locations: #{locations.join(', ')}"
|
68
|
+
end
|
56
69
|
end
|
57
70
|
end
|
data/lib/pushwagner/version.rb
CHANGED