dflat 0.0.1 → 0.0.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.
data/Gemfile.lock CHANGED
@@ -2,7 +2,7 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  anvl (0.1.0)
5
- checkm (0.0.1)
5
+ checkm (0.0.3)
6
6
  git (1.2.5)
7
7
  i18n (0.4.1)
8
8
  jeweler (1.5.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/dflat.gemspec ADDED
@@ -0,0 +1,81 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dflat}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chris Beer"]
12
+ s.date = %q{2010-11-26}
13
+ s.email = %q{chris@cbeer.info}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE.txt",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "LICENSE.txt",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "dflat.gemspec",
27
+ "lib/dflat.rb",
28
+ "lib/dflat/home.rb",
29
+ "lib/dflat/version.rb",
30
+ "lib/dnatural.rb",
31
+ "test/helper.rb",
32
+ "test/test_dflat.rb"
33
+ ]
34
+ s.homepage = %q{http://github.com/cbeer/dflat}
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = %q{1.3.7}
38
+ s.summary = %q{Ruby Dflat implementation}
39
+ s.test_files = [
40
+ "test/helper.rb",
41
+ "test/test_dflat.rb"
42
+ ]
43
+
44
+ if s.respond_to? :specification_version then
45
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_runtime_dependency(%q<namaste>, [">= 0"])
50
+ s.add_runtime_dependency(%q<anvl>, [">= 0"])
51
+ s.add_runtime_dependency(%q<lockit>, [">= 0"])
52
+ s.add_runtime_dependency(%q<checkm>, [">= 0"])
53
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
54
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
55
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
56
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
57
+ s.add_development_dependency(%q<rcov>, [">= 0"])
58
+ else
59
+ s.add_dependency(%q<namaste>, [">= 0"])
60
+ s.add_dependency(%q<anvl>, [">= 0"])
61
+ s.add_dependency(%q<lockit>, [">= 0"])
62
+ s.add_dependency(%q<checkm>, [">= 0"])
63
+ s.add_dependency(%q<i18n>, [">= 0"])
64
+ s.add_dependency(%q<shoulda>, [">= 0"])
65
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
66
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
67
+ s.add_dependency(%q<rcov>, [">= 0"])
68
+ end
69
+ else
70
+ s.add_dependency(%q<namaste>, [">= 0"])
71
+ s.add_dependency(%q<anvl>, [">= 0"])
72
+ s.add_dependency(%q<lockit>, [">= 0"])
73
+ s.add_dependency(%q<checkm>, [">= 0"])
74
+ s.add_dependency(%q<i18n>, [">= 0"])
75
+ s.add_dependency(%q<shoulda>, [">= 0"])
76
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
77
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
78
+ s.add_dependency(%q<rcov>, [">= 0"])
79
+ end
80
+ end
81
+
data/lib/dflat.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'dflat/home'
2
- require 'dflat/dir'
2
+ require 'dflat/version'
3
3
  require 'dnatural'
4
4
  module Dflat
5
5
  VERSION = 'Dflat/0.19'
data/lib/dflat/home.rb CHANGED
@@ -16,7 +16,7 @@ module Dflat
16
16
  :classScheme => 'CLOP/0.3' }
17
17
 
18
18
  def self.mkdir path, integer=0777, args = {}
19
- Dir.mkdir path, integer
19
+ ::Dir.mkdir path, integer
20
20
  d = Home.new path
21
21
  d.type = Dflat::VERSION
22
22
  v = d.version! 'v001', nil
@@ -55,7 +55,7 @@ module Dflat
55
55
 
56
56
  def version version
57
57
  # xxx use namaste 'type' to load the right dir..
58
- Dnatural::Dir.new File.join(path, version)
58
+ Dflat::Version::Dir.load File.join(path, version)
59
59
  end
60
60
 
61
61
  def version! dest = nil, src = nil
@@ -88,12 +88,12 @@ module Dflat
88
88
  end
89
89
 
90
90
  def select &block
91
- d = Dir.new path
91
+ d = Dflat::Version::Dir.new path
92
92
  d.select &block
93
93
  end
94
94
  private
95
95
  def new_version version
96
- d = Dnatural::Dir.mkdir File.join(path, version)
96
+ d = Dflat::Version::Full.mkdir File.join(path, version)
97
97
  end
98
98
 
99
99
  def current_version
@@ -0,0 +1,100 @@
1
+ require 'namaste'
2
+ require 'lockit'
3
+ require 'fileutils'
4
+ module Dflat
5
+ module Version
6
+ class Dir < ::Dir
7
+ include Namaste::Mixin
8
+ include LockIt::Mixin
9
+
10
+ def self.load path
11
+ Full.new path
12
+ end
13
+
14
+ def version
15
+ File.basename(path)
16
+ end
17
+ def manifest
18
+ data = ''
19
+ data = open(manifest_path).read if File.exists? manifest_path
20
+ @manifest ||= Checkm::Manifest.new data, :path => data_path
21
+ end
22
+
23
+ def manifest!
24
+ @manifest = nil
25
+ manifest
26
+ end
27
+ end
28
+
29
+ class Empty < Dir
30
+
31
+ def self.mkdir path, integer = 0777, args = {}
32
+ super path, integer
33
+ File.open(File.join(path, 'empty.txt')) do |f|
34
+ f << "empty"
35
+ end
36
+ end
37
+
38
+ def list
39
+ []
40
+ end
41
+ end
42
+
43
+ class Full < Dir
44
+ include Namaste::Mixin
45
+ include LockIt::Mixin
46
+
47
+ DATA_DIR = 'full'
48
+
49
+ def self.mkdir path, integer = 0777, args = {}
50
+ super path, integer
51
+ d = Full.new path
52
+ Dnatural::Dir.mkdir File.join(d.path, 'full')
53
+ d
54
+ end
55
+
56
+ def list
57
+ manifest.entries.map { |e| e.sourcefileorurl }
58
+ end
59
+
60
+ def add src, dest, options = {}
61
+ file = FileUtils.cp src, File.join(data_path, dest), options
62
+
63
+ manifest!
64
+ lock
65
+ m = manifest.add dest, :base => data_path
66
+ File.open(File.join(path, 'manifest.txt'), 'w') do |f|
67
+ f.write(m.to_s)
68
+ end
69
+
70
+ unlock
71
+ File.new File.join(data_path, dest)
72
+ end
73
+
74
+ def remove list, options = {}
75
+ list = [list] if list.instance_of? String
76
+ FileUtils.rm list.map { |x| File.join(data_path, x) }, options
77
+
78
+ m = manifest!
79
+ lock
80
+ list.each do |l|
81
+ m = m.remove l
82
+ end
83
+
84
+ File.open(File.join(path, 'manifest.txt'), 'w') do |f|
85
+ f.write(m.to_s)
86
+ end
87
+ unlock
88
+ end
89
+
90
+ private
91
+ def data_path
92
+ File.join(self.path, DATA_DIR)
93
+ end
94
+ def manifest_path
95
+ File.join(path, 'manifest.txt')
96
+ end
97
+
98
+ end
99
+ end
100
+ end
data/lib/dnatural.rb CHANGED
@@ -1,13 +1,11 @@
1
1
  require 'checkm'
2
2
  require 'namaste'
3
3
  require 'fileutils'
4
- require 'lockit'
5
4
 
6
5
  module Dnatural
7
6
  VERSION = 'Dnatural/0.17'
8
7
  class Dir < ::Dir
9
8
  include Namaste::Mixin
10
- include LockIt::Mixin
11
9
 
12
10
  def self.mkdir path, integer=0777, args = {}
13
11
  super path, integer
@@ -24,58 +22,18 @@ module Dnatural
24
22
  d
25
23
  end
26
24
 
27
- def version
28
- File.basename(path)
29
- end
30
-
31
- def manifest
32
- data = ''
33
- data = open(File.join(path, 'manifest.txt')).read if File.exists? File.join(path, 'manifest.txt')
34
- @manifest ||= Checkm::Manifest.new data
35
- end
36
-
37
- def manifest!
38
- @manifest = nil
39
- manifest
40
- end
41
-
42
25
  def list
43
26
  glob('**/*')
44
27
  end
45
28
 
46
29
  def add src, dest, options = {}
47
30
  file = FileUtils.cp src, File.join(path, dest), options
48
-
49
- manifest!
50
-
51
- lock
52
- m = manifest.add dest, :base => path
53
- File.open(File.join(path, 'manifest.txt'), 'w') do |f|
54
- f.write(m.to_s)
55
- end
56
-
57
- unlock
58
-
59
31
  File.new File.join(path, dest)
60
32
  end
61
33
 
62
34
  def remove list, options = {}
63
35
  list = [list] if list.instance_of? String
64
36
  FileUtils.rm list.map { |x| File.join(path, x) }, options
65
-
66
- m = manifest!
67
- lock
68
-
69
- list.each do |l|
70
- m = m.remove l
71
- end
72
-
73
- File.open(File.join(path, 'manifest.txt'), 'w') do |f|
74
- f.write(m.to_s)
75
- end
76
-
77
- unlock
78
37
  end
79
-
80
38
  end
81
39
  end
data/test/test_dflat.rb CHANGED
@@ -20,7 +20,7 @@ class TestDflat < Test::Unit::TestCase
20
20
  assert_contains(files, 'current.txt')
21
21
  assert_contains(files, 'dflat-info.txt')
22
22
  assert_contains(files, 'v001')
23
- assert_contains(files, 'v001/0=dnatural_0.17')
23
+ assert_contains(files, 'v001/full/0=dnatural_0.17')
24
24
  end
25
25
 
26
26
  should "point to versioned content" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dflat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Beer
@@ -165,9 +165,10 @@ files:
165
165
  - README.rdoc
166
166
  - Rakefile
167
167
  - VERSION
168
+ - dflat.gemspec
168
169
  - lib/dflat.rb
169
- - lib/dflat/dir.rb
170
170
  - lib/dflat/home.rb
171
+ - lib/dflat/version.rb
171
172
  - lib/dnatural.rb
172
173
  - test/helper.rb
173
174
  - test/test_dflat.rb
data/lib/dflat/dir.rb DELETED
@@ -1,6 +0,0 @@
1
- module Dflat
2
- class Dir < ::Dir
3
- include Namaste::Mixin
4
- include LockIt::Mixin
5
- end
6
- end