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.
@@ -8,7 +8,7 @@ module DiceBag
8
8
  include DiceBagFile
9
9
  def initialize(name)
10
10
  @filename = name.gsub('.local', '').gsub('.erb', '').gsub('.template','')
11
- @file = @filename
11
+ @file = Project.config_files(@filename)
12
12
  end
13
13
  end
14
14
  end
@@ -10,18 +10,25 @@ module DiceBag
10
10
  end
11
11
 
12
12
  def self.config_files(filename)
13
- File.join(Dir.pwd, filename)
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("**/config/*.erb")]
19
- custom_templates = Dir[Project.config_files("**/config/*.erb.local")]
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
- templates = all_files.delete_if {|file| custom_templates.include?(file + '.local')}
28
+ cleaned_templates = all_files.delete_if {|file| custom_templates.include?(file + '.local')}
23
29
  dotNetTemplates = dotNetTemplates.delete_if {|file| file.include?("/bin/")}
24
- all_files + dotNetTemplates
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
@@ -1,3 +1,3 @@
1
1
  module DiceBag
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
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.0
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-14 00:00:00.000000000Z
12
+ date: 2013-02-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &73429760 !ruby/object:Gem::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: *73429760
24
+ version_requirements: *74949160
25
25
  description:
26
26
  email:
27
27
  - asmith@mdsol.com