dice_bag 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dice_bag/config_file.rb +1 -1
- data/lib/dice_bag/project.rb +12 -5
- data/lib/dice_bag/template_file.rb +2 -2
- data/lib/dice_bag/version.rb +1 -1
- metadata +4 -4
data/lib/dice_bag/config_file.rb
CHANGED
data/lib/dice_bag/project.rb
CHANGED
@@ -10,18 +10,25 @@ module DiceBag
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.config_files(filename)
|
13
|
-
File.join(
|
13
|
+
File.join(self.config_dir, filename)
|
14
|
+
end
|
15
|
+
|
16
|
+
# dotNet apps do not have the templates in config/ but in the root of the project
|
17
|
+
# TODO: detect dotNet instead of detecting rails
|
18
|
+
def self.config_dir
|
19
|
+
defined?(Rails) ? File.join(Dir.pwd, 'config') : Dir.pwd
|
14
20
|
end
|
15
21
|
|
16
22
|
#local templates always takes preference over generated templates
|
17
23
|
def self.templates_to_generate
|
18
|
-
generated_templates = Dir[Project.config_files("
|
19
|
-
custom_templates = Dir[Project.config_files("
|
24
|
+
generated_templates = Dir[Project.config_files("**/*.erb")]
|
25
|
+
custom_templates = Dir[Project.config_files("**/*.erb.local")]
|
20
26
|
dotNetTemplates = Dir[Project.config_files("**/*.config.template")]
|
21
27
|
all_files = generated_templates + custom_templates
|
22
|
-
|
28
|
+
cleaned_templates = all_files.delete_if {|file| custom_templates.include?(file + '.local')}
|
23
29
|
dotNetTemplates = dotNetTemplates.delete_if {|file| file.include?("/bin/")}
|
24
|
-
|
30
|
+
(cleaned_templates + dotNetTemplates).map { |template| File.basename(template) }
|
25
31
|
end
|
32
|
+
|
26
33
|
end
|
27
34
|
end
|
@@ -16,7 +16,7 @@ module DiceBag
|
|
16
16
|
|
17
17
|
def initialize(name)
|
18
18
|
@filename = File.basename(name)
|
19
|
-
@file = name
|
19
|
+
@file = Project.config_files(name)
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_file(config_file)
|
@@ -32,7 +32,7 @@ module DiceBag
|
|
32
32
|
|
33
33
|
return unless config_file.should_write?(contents)
|
34
34
|
config_file.write(contents)
|
35
|
-
puts "file #{config_file.file} created"
|
35
|
+
puts "file #{Project.config_dir}/#{config_file.file} created"
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
data/lib/dice_bag/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dice_bag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &74949160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *74949160
|
25
25
|
description:
|
26
26
|
email:
|
27
27
|
- asmith@mdsol.com
|