cog 0.0.2 → 0.0.3

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/lib/cog.rb CHANGED
@@ -10,7 +10,7 @@ module Cog
10
10
  # grandparent, and so on.
11
11
  #
12
12
  # === Returns
13
- # An instance of Config which has been configured with a Cogfile. Or +nil+ if
13
+ # An instance of Cogfile which has been configured with a Cogfile. Or +nil+ if
14
14
  # no +Cogfile+ could be found.
15
15
  def self.load_cogfile
16
16
  parts = Dir.pwd.split File::SEPARATOR
@@ -1,4 +1,3 @@
1
- require 'cog/config'
2
1
  require 'singleton'
3
2
 
4
3
  module Cog
@@ -24,15 +24,30 @@ module Cog
24
24
  #
25
25
  # === Parameters
26
26
  # * +path+ - the path to the template to use which is relative to
27
- # Config#template_dir and does not include the +.erb+ extension.
27
+ # Cogfile#template_dir and does not include the +.erb+ extension.
28
28
  # * +dest+ - the destination path to the generated file which is relative
29
- # to Config#code_dir. If this is not provided, then the generated code
29
+ # to Cogfile#code_dir. If this is not provided, then the generated code
30
30
  # will be returned as a string.
31
31
  #
32
32
  # === Returns
33
33
  # +nil+ if generated to a file, otherwise returns the generated code as a
34
34
  # string.
35
35
  def stamp(path, dest=nil)
36
+ t = get_template path
37
+ scratch = "#{path}.scratch"
38
+ File.open(scratch, 'w') do |file|
39
+ file.write t.result(make_protected_binding)
40
+ # TODO: ...
41
+ end
42
+ end
43
+
44
+ private
45
+ def same?(original, scratch) # :nodoc:
46
+ if File.exists? original
47
+ File.read(original) == File.read(scratch)
48
+ else
49
+ false
50
+ end
36
51
  end
37
52
  end
38
53
 
@@ -1,3 +1,3 @@
1
1
  module Cog
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kevin Tonon