chlorine 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/chlorine.gemspec +1 -1
- data/lib/chlorine/clean.rb +7 -6
- data/lib/chlorine/version.rb +1 -1
- metadata +2 -2
data/chlorine.gemspec
CHANGED
data/lib/chlorine/clean.rb
CHANGED
@@ -7,8 +7,9 @@ module Chlorine
|
|
7
7
|
|
8
8
|
initializer "chlorine.configure_rails_initialization" do
|
9
9
|
begin
|
10
|
-
@config = YAML::load_file File.expand_path('config/chlorine.yml',
|
11
|
-
|
10
|
+
@config = YAML::load_file File.expand_path('config/chlorine.yml', Rails.root)
|
11
|
+
return unless @config && @config['envs']
|
12
|
+
require_clean = (@config['envs'].collect {|env| env.downcase}).include? Rails.env
|
12
13
|
rescue Exception => e
|
13
14
|
puts "Chlorine was unable to read its configuration: #{e}"
|
14
15
|
end
|
@@ -23,11 +24,11 @@ module Chlorine
|
|
23
24
|
begin
|
24
25
|
dir_config['excludes'] = dir_config['excludes'].collect {|x| x[-1] == '/' ? x[0...-1] : x}
|
25
26
|
next unless valid_dir_config? dir_config
|
26
|
-
next unless Dir.exists? File.expand_path(dir_name,
|
27
|
-
dir = Dir.new File.expand_path(dir_name,
|
27
|
+
next unless Dir.exists? File.expand_path(dir_name, Rails.root)
|
28
|
+
dir = Dir.new File.expand_path(dir_name, Rails.root)
|
28
29
|
dir.each { |filename|
|
29
30
|
unless (['.', '..'] + dir_config['excludes']).include?(filename)
|
30
|
-
filepath = File.expand_path(dir_name + '/' + filename,
|
31
|
+
filepath = File.expand_path(dir_name + '/' + filename, Rails.root)
|
31
32
|
if File.file?(filepath)
|
32
33
|
File.delete filepath
|
33
34
|
elsif File.directory?(filepath)
|
@@ -36,7 +37,7 @@ module Chlorine
|
|
36
37
|
end
|
37
38
|
}
|
38
39
|
rescue Exception => e
|
39
|
-
puts "Chlorine hit an exception: #{e}"
|
40
|
+
puts "Chlorine hit an exception while cleaning: #{e}"
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
data/lib/chlorine/version.rb
CHANGED