rubbr 1.1.1 → 1.1.2

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.
@@ -1,5 +1,9 @@
1
1
  == 1.1.1 / 2008-04-07
2
2
 
3
+ * Bugfix: lib/rubbr/change.rb not included because of faulty manifest.
4
+
5
+ == 1.1.1 / 2008-04-07
6
+
3
7
  * Support for colorized cli output.
4
8
 
5
9
  == 1.1.0 / 2008-04-06
@@ -5,6 +5,7 @@ Rakefile
5
5
  bin/rubbr
6
6
  lib/rubbr.rb
7
7
  lib/rubbr/builder.rb
8
+ lib/rubbr/change.rb
8
9
  lib/rubbr/cli.rb
9
10
  lib/rubbr/options.rb
10
11
  lib/rubbr/runner.rb
@@ -2,7 +2,7 @@ require 'optparse'
2
2
  $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  module Rubbr
5
- VERSION = '1.1.1'
5
+ VERSION = '1.1.2'
6
6
 
7
7
  autoload :Options, 'rubbr/options'
8
8
  autoload :Cli, 'rubbr/cli'
@@ -0,0 +1,49 @@
1
+ module Rubbr
2
+
3
+ # Checks if source files have changed since last time they was accessed by
4
+ # computing and storing a hash of their contents.
5
+ class Change
6
+ extend Rubbr::Cli
7
+ require 'digest/md5'
8
+ require 'yaml'
9
+
10
+ def self.d?
11
+ sums = inventory
12
+ if changes?(sums)
13
+ write_inventory sums
14
+ true
15
+ else
16
+ notice "No changes in #{Rubbr.options[:build_dir]} since last build"
17
+ false
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def self.inventory
24
+ source_files = Dir["#{Rubbr.options[:source_dir]}/*.tex"]
25
+ source_files.collect do |f|
26
+ [f, digest(File.read(f))]
27
+ end
28
+ end
29
+
30
+ def self.write_inventory(sums)
31
+ File.open(Rubbr.options[:inventory_file], 'w') do |f|
32
+ f.write(sums.to_yaml)
33
+ end
34
+ end
35
+
36
+ def self.read_inventory
37
+ YAML.load_file(Rubbr.options[:inventory_file])
38
+ end
39
+
40
+ def self.changes?(sums)
41
+ return true unless File.exists?(Rubbr.options[:inventory_file])
42
+ sums != read_inventory
43
+ end
44
+
45
+ def self.digest(contents)
46
+ Digest::MD5.hexdigest contents
47
+ end
48
+ end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eivind Uggedal
@@ -39,6 +39,7 @@ files:
39
39
  - bin/rubbr
40
40
  - lib/rubbr.rb
41
41
  - lib/rubbr/builder.rb
42
+ - lib/rubbr/change.rb
42
43
  - lib/rubbr/cli.rb
43
44
  - lib/rubbr/options.rb
44
45
  - lib/rubbr/runner.rb