entrepot 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/216_entrepot.iml +20 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +107 -0
- data/Rakefile +16 -0
- data/entrepot.gemspec +36 -0
- data/lib/entrepot.rb +115 -0
- data/lib/entrepot/version.rb +3 -0
- data/spec/entrepot_spec.rb +128 -0
- data/testresults/testresults.html +305 -0
- metadata +166 -0
data/.gitignore
ADDED
data/.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
216_entrepot
|
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager">
|
13
|
+
<content url="file://$MODULE_DIR$" />
|
14
|
+
<orderEntry type="inheritedJdk" />
|
15
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, RVM: ruby-1.9.3-p448 [global]) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.1.0, RVM: ruby-1.9.3-p448 [global]) [gem]" level="application" />
|
18
|
+
</component>
|
19
|
+
</module>
|
20
|
+
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/216_entrepot.iml" filepath="$PROJECT_DIR$/.idea/216_entrepot.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
data/.idea/vcs.xml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Bernhard Weichel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# _entrepot_ - entrepot supported processing
|
2
|
+
|
3
|
+
Ruby is excellent for transforming and filtering data.
|
4
|
+
|
5
|
+
Rubyists often use these capabilities to manipulate large amounts of data in a multi-step pipeline way.
|
6
|
+
Entrepot memorizes the results along the way to speed up repetitive processing. If only parts of the original data change, not all of it has to be recomputed.
|
7
|
+
|
8
|
+
Immerdiate results are stored on disk, to enable defered processing and reuse of previous results.
|
9
|
+
|
10
|
+
To some extend entrepot can be considered as a kind of entrepot. But
|
11
|
+
|
12
|
+
- entities in entrepot have no expiration date
|
13
|
+
- entrepot also handles the processing of entities
|
14
|
+
|
15
|
+
# Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
gem 'entrepot'
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install entrepot
|
28
|
+
|
29
|
+
# Usage
|
30
|
+
|
31
|
+
require 'entrepot'
|
32
|
+
proc = Entrepot.new( :entrepotfolder => "zz_myentrepot",
|
33
|
+
:salt => "1234",
|
34
|
+
:mkname => lambda{|f, salt, mdsum|
|
35
|
+
"_#{salt}_#{f.basename}_#{mdsum}"}
|
36
|
+
:logger = $log
|
37
|
+
:mode = :active
|
38
|
+
)
|
39
|
+
proc.mode = :active # :active | :refresh | :passive
|
40
|
+
|
41
|
+
Dir["*.tex"].each do |filename|
|
42
|
+
object = File.open(filename).read
|
43
|
+
result = proc.process(object, file ) do | object, file |
|
44
|
+
l_result = mytransform( object )
|
45
|
+
l_result
|
46
|
+
end
|
47
|
+
|
48
|
+
puts result
|
49
|
+
|
50
|
+
Note that the entrepot is configured when the entrepot object is created. If
|
51
|
+
you want to change the options, simply create a new entrepot object with
|
52
|
+
the desire options.
|
53
|
+
|
54
|
+
## options
|
55
|
+
|
56
|
+
':entrepot'
|
57
|
+
: This is the folder where entrepot crates the entrepot
|
58
|
+
|
59
|
+
':salt'
|
60
|
+
: The content is salted by this in order to ensure that the entrepot
|
61
|
+
matches the current version of the software.
|
62
|
+
|
63
|
+
':mkname'
|
64
|
+
: A procedure yielding a string which is used as filename for an
|
65
|
+
individual entrepot.
|
66
|
+
|
67
|
+
':logger'
|
68
|
+
: a logger object which is used to log the entrepot operation. Messages
|
69
|
+
are sent by logger.info
|
70
|
+
|
71
|
+
':mode'
|
72
|
+
: Sets the operation mode of the entrepot. This allows to disable caching
|
73
|
+
for debug purposes. The following values apply:
|
74
|
+
|
75
|
+
':active'
|
76
|
+
: the entrepot is active
|
77
|
+
|
78
|
+
'refresh'
|
79
|
+
: the entrepot files are rebuilt, but not read before
|
80
|
+
|
81
|
+
'passive'
|
82
|
+
: caching does not operate at all. Cache files are neither read
|
83
|
+
nor read
|
84
|
+
|
85
|
+
## methods
|
86
|
+
|
87
|
+
'files'
|
88
|
+
: provides an array of files for a given name available in the entrepot
|
89
|
+
|
90
|
+
'clean'
|
91
|
+
: cleans all entrepot entries. In this all files in the entrepot are
|
92
|
+
cleaned. Thereby basename and mdsum are replaced by "\*" in order to
|
93
|
+
get a globber.
|
94
|
+
|
95
|
+
Of course cou can also manually delete the files in the entrepot
|
96
|
+
directoy
|
97
|
+
|
98
|
+
'process'
|
99
|
+
: performs a entrepot supported processing.
|
100
|
+
|
101
|
+
# Contributing
|
102
|
+
|
103
|
+
1. Fork it
|
104
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
105
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
106
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
107
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
desc "Run specs"
|
6
|
+
RSpec::Core::RakeTask.new(:spec, :focus) do |t, args|
|
7
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
8
|
+
if args[:focus] then
|
9
|
+
usetags="--tag #{args[:focus]}"
|
10
|
+
else
|
11
|
+
usetags="--tag ~exp"
|
12
|
+
end
|
13
|
+
t.rspec_opts = [usetags,
|
14
|
+
" -fd -fd --out ./testresults/testresults.log -fh --out ./testresults/testresults.html"]
|
15
|
+
# Put spec opts in a file named .rspec in root
|
16
|
+
end
|
data/entrepot.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'entrepot/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "entrepot"
|
8
|
+
spec.version = Entrepot::VERSION
|
9
|
+
spec.authors = ["Bernhard Weichel"]
|
10
|
+
spec.email = ["github.com@nospam.weichel21.de"]
|
11
|
+
spec.description = %q{a helper class do do a chached processing}
|
12
|
+
spec.summary = %q{Ruby is excellent for transforming and filtering data.
|
13
|
+
|
14
|
+
Rubyists often use these capabilities to manipulate large amounts of data in a multi-step pipeline way.
|
15
|
+
Entrepot memorizes the results along the way to speed up repetitive processing. If only parts of the original data change, not all of it has to be recomputed.
|
16
|
+
|
17
|
+
Immerdiate results are stored on disk, to enable defered processing and reuse of previous results.
|
18
|
+
}
|
19
|
+
spec.homepage = ""
|
20
|
+
spec.license = "MIT"
|
21
|
+
|
22
|
+
spec.files = `git ls-files`.split($/)
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
|
28
|
+
spec.add_runtime_dependency 'digest'
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
31
|
+
spec.add_development_dependency "rake"
|
32
|
+
spec.add_development_dependency "fileutils"
|
33
|
+
spec.add_development_dependency "rspec"
|
34
|
+
spec.add_development_dependency "pry"
|
35
|
+
|
36
|
+
end
|
data/lib/entrepot.rb
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require "entrepot/version"
|
2
|
+
require 'digest'
|
3
|
+
|
4
|
+
module Entrepot
|
5
|
+
class Entrepot
|
6
|
+
|
7
|
+
#
|
8
|
+
# the Constructor
|
9
|
+
# @param args [Hash] Hash of options
|
10
|
+
#
|
11
|
+
def initialize(args)
|
12
|
+
@options = args
|
13
|
+
if @options[:mkname].nil?
|
14
|
+
@options[:mkname] = lambda{|cachename, salt, mdsum|
|
15
|
+
"_#{salt}_#{File.basename(cachename)}_#{mdsum}.cache"
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
if @options[:salt].nil?
|
20
|
+
@options[:salt] = "_"
|
21
|
+
end
|
22
|
+
|
23
|
+
if @options[:mode].nil?
|
24
|
+
@options[:mode] = :active
|
25
|
+
end
|
26
|
+
|
27
|
+
if @options[:entrepotfolder].nil?
|
28
|
+
@ptions[:entrepotfolder] = "zz_entrepot"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
#
|
34
|
+
# provide a list of cachfiles for a given name
|
35
|
+
#
|
36
|
+
# @param name [String] The name of the cache
|
37
|
+
#
|
38
|
+
# @return [Array of String] list of cache filenames
|
39
|
+
#
|
40
|
+
def files(name)
|
41
|
+
Dir[_cachefile(name, @options[:salt], "*")].select{|f| File.file?(f)}
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
#
|
46
|
+
# Clean the cache for a given name
|
47
|
+
#
|
48
|
+
# @param name [String] Name of the cache to be cleaned
|
49
|
+
#
|
50
|
+
# @return [Nil] [description]
|
51
|
+
def clean(name)
|
52
|
+
files(name).each{|f|
|
53
|
+
log "delete: #{f}"
|
54
|
+
File.delete(f)
|
55
|
+
nil
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
#
|
61
|
+
# yield a result using the cache
|
62
|
+
#
|
63
|
+
# @param object [String] The input data to be processed
|
64
|
+
# @param name [String] The name of the cache, usually a filename
|
65
|
+
# @param &block [lambda] Procedure to process the string. Note that
|
66
|
+
# the block shall yield one object as a result of processing.
|
67
|
+
#
|
68
|
+
# @return [Object] The result of the processing
|
69
|
+
#
|
70
|
+
def process(object, name, &block)
|
71
|
+
|
72
|
+
FileUtils.mkdir_p(@options[:entrepotfolder])
|
73
|
+
|
74
|
+
salt = @options[:salt]
|
75
|
+
digest = Digest::MD5.hexdigest(object + salt)
|
76
|
+
cachefile = _cachefile(name, salt, digest)
|
77
|
+
|
78
|
+
# examine the cache
|
79
|
+
dumpset = {:salt => nil}
|
80
|
+
if @options[:mode] == :active
|
81
|
+
if File.exists?(cachefile)
|
82
|
+
File.open(cachefile, "rb"){|f| dumpset = Marshal.load(f)}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# examine the success: Salt is read from the cachefile!
|
87
|
+
if dumpset[:salt] != salt
|
88
|
+
dumpset = {:salt => salt}
|
89
|
+
log "reprocessing #{name}"
|
90
|
+
|
91
|
+
result = block.call(object, name) # yield the expected result
|
92
|
+
|
93
|
+
dumpset[:result] = result
|
94
|
+
if [:active, :refresh].include? @options[:mode]
|
95
|
+
File.open(cachefile, "wb"){|f| Marshal.dump(dumpset, f)}
|
96
|
+
end
|
97
|
+
else
|
98
|
+
log "using cache for #{name}"
|
99
|
+
result = dumpset[:result]
|
100
|
+
end
|
101
|
+
result
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def log(message)
|
107
|
+
logger = @options[:logger]
|
108
|
+
logger.info(message) if logger.respond_to? :info
|
109
|
+
end
|
110
|
+
|
111
|
+
def _cachefile(name, salt, digest)
|
112
|
+
"#{@options[:entrepotfolder]}/#{@options[:mkname].call(name, @options[:salt], digest)}"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
$:.unshift 'lib'
|
2
|
+
require 'entrepot'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
class Logger
|
6
|
+
def info(message)
|
7
|
+
puts "[ INFO] #{message}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "cachew" do
|
12
|
+
|
13
|
+
before :all do
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'performs a chached process' do
|
17
|
+
cacheproc = Entrepot::Entrepot.new(:salt => "x2",
|
18
|
+
:entrepotfolder => 'zz_cache',
|
19
|
+
:logger => Logger.new
|
20
|
+
)
|
21
|
+
|
22
|
+
data = "foobar " + Time.now.to_s
|
23
|
+
name = "a/b/c/foobar.txt"
|
24
|
+
result = cacheproc.process( data, name ) do | data, name |
|
25
|
+
data
|
26
|
+
end
|
27
|
+
|
28
|
+
result = cacheproc.process( data, name ) do | data, name |
|
29
|
+
data + Time.now().to_s
|
30
|
+
end
|
31
|
+
result.should== data
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'manages the cachefolder' do
|
35
|
+
cacheproc = Entrepot::Entrepot.new(:salt => "x2",
|
36
|
+
:entrepotfolder => 'zz_cache/x2',
|
37
|
+
:logger => Logger.new
|
38
|
+
)
|
39
|
+
name = "a/b/c/foobar.txt"
|
40
|
+
cacheproc.clean(name)
|
41
|
+
|
42
|
+
cacheproc.process(Time.now.to_s, name) do |data, name|
|
43
|
+
data
|
44
|
+
end
|
45
|
+
|
46
|
+
cacheproc.files(name).count.should == 1
|
47
|
+
cacheproc.clean(name)
|
48
|
+
cacheproc.files(name).count.should == 0
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'can be turned off' do
|
52
|
+
cacheproc = Entrepot::Entrepot.new(:salt => "x2",
|
53
|
+
:entrepotfolder => 'zz_cache',
|
54
|
+
:logger => Logger.new,
|
55
|
+
:mode => :passive
|
56
|
+
)
|
57
|
+
|
58
|
+
data = "foobar " + Time.now.to_s
|
59
|
+
name = "a/b/c/foobar.txt"
|
60
|
+
result = cacheproc.process( data, name ) do | data, name |
|
61
|
+
data
|
62
|
+
end
|
63
|
+
|
64
|
+
newdata = data + Time.now().to_s
|
65
|
+
result = cacheproc.process( data, name ) do | data, name |
|
66
|
+
newdata
|
67
|
+
end
|
68
|
+
result.should== newdata
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'can refresh the cache' do
|
72
|
+
cacheproc = Entrepot::Entrepot.new(:salt => "x2",
|
73
|
+
:entrepotfolder => 'zz_cache',
|
74
|
+
:logger => Logger.new,
|
75
|
+
:mode => :active
|
76
|
+
)
|
77
|
+
|
78
|
+
data = "foobar " + Time.now.to_s
|
79
|
+
name = "a/b/c/foobar.txt"
|
80
|
+
result = cacheproc.process( data, name ) do | data, name |
|
81
|
+
data
|
82
|
+
end
|
83
|
+
|
84
|
+
newdata = data + Time.now().to_s
|
85
|
+
result1 = cacheproc.process( data, name ) do | data, name |
|
86
|
+
newdata
|
87
|
+
end
|
88
|
+
|
89
|
+
cacheproc = Entrepot::Entrepot.new(:salt => "x2",
|
90
|
+
:entrepotfolder => 'zz_cache',
|
91
|
+
:logger => Logger.new,
|
92
|
+
:mode => :refresh
|
93
|
+
)
|
94
|
+
|
95
|
+
result2 = cacheproc.process( data, name ) do | data, name |
|
96
|
+
newdata
|
97
|
+
end
|
98
|
+
|
99
|
+
result1.should== data
|
100
|
+
result2.should== newdata
|
101
|
+
end
|
102
|
+
|
103
|
+
it "can specify the cache filename" do
|
104
|
+
cacheproc = Entrepot::Entrepot.new(:salt => "x2",
|
105
|
+
:entrepotfolder => 'zz_cache',
|
106
|
+
:mkname => lambda do |f, salt, mdsum|
|
107
|
+
"_#{mdsum}_#{f}_#{salt}"
|
108
|
+
end,
|
109
|
+
|
110
|
+
:logger => Logger.new,
|
111
|
+
|
112
|
+
:mode => :refresh
|
113
|
+
)
|
114
|
+
name = nil;Time.now()
|
115
|
+
cacheproc.clean(name)
|
116
|
+
result2 = cacheproc.process( "a", name ) do | data, name |
|
117
|
+
"foo"
|
118
|
+
end
|
119
|
+
result2 = cacheproc.process( "b", name ) do | data, name |
|
120
|
+
"foo"
|
121
|
+
end
|
122
|
+
|
123
|
+
a=Dir["zz_cache/_*_#{name}_x2"]
|
124
|
+
a.count.should==2
|
125
|
+
cacheproc.clean(name)
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
@@ -0,0 +1,305 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<title>RSpec results</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9
|
+
<meta http-equiv="Expires" content="-1" />
|
10
|
+
<meta http-equiv="Pragma" content="no-cache" />
|
11
|
+
<style type="text/css">
|
12
|
+
body {
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
background: #fff;
|
16
|
+
font-size: 80%;
|
17
|
+
}
|
18
|
+
</style>
|
19
|
+
<script type="text/javascript">
|
20
|
+
// <![CDATA[
|
21
|
+
|
22
|
+
function addClass(element_id, classname) {
|
23
|
+
document.getElementById(element_id).className += (" " + classname);
|
24
|
+
}
|
25
|
+
|
26
|
+
function removeClass(element_id, classname) {
|
27
|
+
var elem = document.getElementById(element_id);
|
28
|
+
var classlist = elem.className.replace(classname,'');
|
29
|
+
elem.className = classlist;
|
30
|
+
}
|
31
|
+
|
32
|
+
function moveProgressBar(percentDone) {
|
33
|
+
document.getElementById("rspec-header").style.width = percentDone +"%";
|
34
|
+
}
|
35
|
+
|
36
|
+
function makeRed(element_id) {
|
37
|
+
removeClass(element_id, 'passed');
|
38
|
+
removeClass(element_id, 'not_implemented');
|
39
|
+
addClass(element_id,'failed');
|
40
|
+
}
|
41
|
+
|
42
|
+
function makeYellow(element_id) {
|
43
|
+
var elem = document.getElementById(element_id);
|
44
|
+
if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
|
45
|
+
if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
|
46
|
+
removeClass(element_id, 'passed');
|
47
|
+
addClass(element_id,'not_implemented');
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
function apply_filters() {
|
53
|
+
var passed_filter = document.getElementById('passed_checkbox').checked;
|
54
|
+
var failed_filter = document.getElementById('failed_checkbox').checked;
|
55
|
+
var pending_filter = document.getElementById('pending_checkbox').checked;
|
56
|
+
|
57
|
+
assign_display_style("example passed", passed_filter);
|
58
|
+
assign_display_style("example failed", failed_filter);
|
59
|
+
assign_display_style("example not_implemented", pending_filter);
|
60
|
+
|
61
|
+
assign_display_style_for_group("example_group passed", passed_filter);
|
62
|
+
assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
|
63
|
+
assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
|
64
|
+
}
|
65
|
+
|
66
|
+
function get_display_style(display_flag) {
|
67
|
+
var style_mode = 'none';
|
68
|
+
if (display_flag == true) {
|
69
|
+
style_mode = 'block';
|
70
|
+
}
|
71
|
+
return style_mode;
|
72
|
+
}
|
73
|
+
|
74
|
+
function assign_display_style(classname, display_flag) {
|
75
|
+
var style_mode = get_display_style(display_flag);
|
76
|
+
var elems = document.getElementsByClassName(classname)
|
77
|
+
for (var i=0; i<elems.length;i++) {
|
78
|
+
elems[i].style.display = style_mode;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
|
83
|
+
var display_style_mode = get_display_style(display_flag);
|
84
|
+
var subgroup_style_mode = get_display_style(subgroup_flag);
|
85
|
+
var elems = document.getElementsByClassName(classname)
|
86
|
+
for (var i=0; i<elems.length;i++) {
|
87
|
+
var style_mode = display_style_mode;
|
88
|
+
if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
|
89
|
+
elems[i].style.display = subgroup_style_mode;
|
90
|
+
} else {
|
91
|
+
elems[i].style.display = display_style_mode;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
// ]]>
|
97
|
+
</script>
|
98
|
+
<style type="text/css">
|
99
|
+
#rspec-header {
|
100
|
+
background: #65C400; color: #fff; height: 4em;
|
101
|
+
}
|
102
|
+
|
103
|
+
.rspec-report h1 {
|
104
|
+
margin: 0px 10px 0px 10px;
|
105
|
+
padding: 10px;
|
106
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
107
|
+
font-size: 1.8em;
|
108
|
+
position: absolute;
|
109
|
+
}
|
110
|
+
|
111
|
+
#label {
|
112
|
+
float:left;
|
113
|
+
}
|
114
|
+
|
115
|
+
#display-filters {
|
116
|
+
float:left;
|
117
|
+
padding: 28px 0 0 40%;
|
118
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
119
|
+
}
|
120
|
+
|
121
|
+
#summary {
|
122
|
+
float:right;
|
123
|
+
padding: 5px 10px;
|
124
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
125
|
+
text-align: right;
|
126
|
+
}
|
127
|
+
|
128
|
+
#summary p {
|
129
|
+
margin: 0 0 0 2px;
|
130
|
+
}
|
131
|
+
|
132
|
+
#summary #totals {
|
133
|
+
font-size: 1.2em;
|
134
|
+
}
|
135
|
+
|
136
|
+
.example_group {
|
137
|
+
margin: 0 10px 5px;
|
138
|
+
background: #fff;
|
139
|
+
}
|
140
|
+
|
141
|
+
dl {
|
142
|
+
margin: 0; padding: 0 0 5px;
|
143
|
+
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
|
144
|
+
}
|
145
|
+
|
146
|
+
dt {
|
147
|
+
padding: 3px;
|
148
|
+
background: #65C400;
|
149
|
+
color: #fff;
|
150
|
+
font-weight: bold;
|
151
|
+
}
|
152
|
+
|
153
|
+
dd {
|
154
|
+
margin: 5px 0 5px 5px;
|
155
|
+
padding: 3px 3px 3px 18px;
|
156
|
+
}
|
157
|
+
|
158
|
+
dd .duration {
|
159
|
+
padding-left: 5px;
|
160
|
+
text-align: right;
|
161
|
+
right: 0px;
|
162
|
+
float:right;
|
163
|
+
}
|
164
|
+
|
165
|
+
dd.example.passed {
|
166
|
+
border-left: 5px solid #65C400;
|
167
|
+
border-bottom: 1px solid #65C400;
|
168
|
+
background: #DBFFB4; color: #3D7700;
|
169
|
+
}
|
170
|
+
|
171
|
+
dd.example.not_implemented {
|
172
|
+
border-left: 5px solid #FAF834;
|
173
|
+
border-bottom: 1px solid #FAF834;
|
174
|
+
background: #FCFB98; color: #131313;
|
175
|
+
}
|
176
|
+
|
177
|
+
dd.example.pending_fixed {
|
178
|
+
border-left: 5px solid #0000C2;
|
179
|
+
border-bottom: 1px solid #0000C2;
|
180
|
+
color: #0000C2; background: #D3FBFF;
|
181
|
+
}
|
182
|
+
|
183
|
+
dd.example.failed {
|
184
|
+
border-left: 5px solid #C20000;
|
185
|
+
border-bottom: 1px solid #C20000;
|
186
|
+
color: #C20000; background: #FFFBD3;
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
dt.not_implemented {
|
191
|
+
color: #000000; background: #FAF834;
|
192
|
+
}
|
193
|
+
|
194
|
+
dt.pending_fixed {
|
195
|
+
color: #FFFFFF; background: #C40D0D;
|
196
|
+
}
|
197
|
+
|
198
|
+
dt.failed {
|
199
|
+
color: #FFFFFF; background: #C40D0D;
|
200
|
+
}
|
201
|
+
|
202
|
+
|
203
|
+
#rspec-header.not_implemented {
|
204
|
+
color: #000000; background: #FAF834;
|
205
|
+
}
|
206
|
+
|
207
|
+
#rspec-header.pending_fixed {
|
208
|
+
color: #FFFFFF; background: #C40D0D;
|
209
|
+
}
|
210
|
+
|
211
|
+
#rspec-header.failed {
|
212
|
+
color: #FFFFFF; background: #C40D0D;
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
.backtrace {
|
217
|
+
color: #000;
|
218
|
+
font-size: 12px;
|
219
|
+
}
|
220
|
+
|
221
|
+
a {
|
222
|
+
color: #BE5C00;
|
223
|
+
}
|
224
|
+
|
225
|
+
/* Ruby code, style similar to vibrant ink */
|
226
|
+
.ruby {
|
227
|
+
font-size: 12px;
|
228
|
+
font-family: monospace;
|
229
|
+
color: white;
|
230
|
+
background-color: black;
|
231
|
+
padding: 0.1em 0 0.2em 0;
|
232
|
+
}
|
233
|
+
|
234
|
+
.ruby .keyword { color: #FF6600; }
|
235
|
+
.ruby .constant { color: #339999; }
|
236
|
+
.ruby .attribute { color: white; }
|
237
|
+
.ruby .global { color: white; }
|
238
|
+
.ruby .module { color: white; }
|
239
|
+
.ruby .class { color: white; }
|
240
|
+
.ruby .string { color: #66FF00; }
|
241
|
+
.ruby .ident { color: white; }
|
242
|
+
.ruby .method { color: #FFCC00; }
|
243
|
+
.ruby .number { color: white; }
|
244
|
+
.ruby .char { color: white; }
|
245
|
+
.ruby .comment { color: #9933CC; }
|
246
|
+
.ruby .symbol { color: white; }
|
247
|
+
.ruby .regex { color: #44B4CC; }
|
248
|
+
.ruby .punct { color: white; }
|
249
|
+
.ruby .escape { color: white; }
|
250
|
+
.ruby .interp { color: white; }
|
251
|
+
.ruby .expr { color: white; }
|
252
|
+
|
253
|
+
.ruby .offending { background-color: gray; }
|
254
|
+
.ruby .linenum {
|
255
|
+
width: 75px;
|
256
|
+
padding: 0.1em 1em 0.2em 0;
|
257
|
+
color: #000000;
|
258
|
+
background-color: #FFFBD3;
|
259
|
+
}
|
260
|
+
|
261
|
+
</style>
|
262
|
+
</head>
|
263
|
+
<body>
|
264
|
+
<div class="rspec-report">
|
265
|
+
|
266
|
+
<div id="rspec-header">
|
267
|
+
<div id="label">
|
268
|
+
<h1>RSpec Code Examples</h1>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<div id="display-filters">
|
272
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
273
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
274
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div id="summary">
|
278
|
+
<p id="totals"> </p>
|
279
|
+
<p id="duration"> </p>
|
280
|
+
</div>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
|
284
|
+
<div class="results">
|
285
|
+
<div id="div_group_1" class="example_group passed">
|
286
|
+
<dl style="margin-left: 0px;">
|
287
|
+
<dt id="example_group_1" class="passed">cachew</dt>
|
288
|
+
<script type="text/javascript">moveProgressBar('20.0');</script>
|
289
|
+
<dd class="example passed"><span class="passed_spec_name">performs a chached process</span><span class='duration'>0.00950s</span></dd>
|
290
|
+
<script type="text/javascript">moveProgressBar('40.0');</script>
|
291
|
+
<dd class="example passed"><span class="passed_spec_name">manages the cachefolder</span><span class='duration'>0.00067s</span></dd>
|
292
|
+
<script type="text/javascript">moveProgressBar('60.0');</script>
|
293
|
+
<dd class="example passed"><span class="passed_spec_name">can be turned off</span><span class='duration'>0.00025s</span></dd>
|
294
|
+
<script type="text/javascript">moveProgressBar('80.0');</script>
|
295
|
+
<dd class="example passed"><span class="passed_spec_name">can refresh the cache</span><span class='duration'>0.00064s</span></dd>
|
296
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
297
|
+
<dd class="example passed"><span class="passed_spec_name">can specify the cache filename</span><span class='duration'>0.00096s</span></dd>
|
298
|
+
</dl>
|
299
|
+
</div>
|
300
|
+
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.01291 seconds</strong>";</script>
|
301
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "5 examples, 0 failures";</script>
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
</body>
|
305
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: entrepot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bernhard Weichel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: digest
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: fileutils
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: pry
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: a helper class do do a chached processing
|
111
|
+
email:
|
112
|
+
- github.com@nospam.weichel21.de
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .idea/.name
|
119
|
+
- .idea/.rakeTasks
|
120
|
+
- .idea/216_entrepot.iml
|
121
|
+
- .idea/encodings.xml
|
122
|
+
- .idea/misc.xml
|
123
|
+
- .idea/modules.xml
|
124
|
+
- .idea/scopes/scope_settings.xml
|
125
|
+
- .idea/vcs.xml
|
126
|
+
- Gemfile
|
127
|
+
- LICENSE.txt
|
128
|
+
- README.md
|
129
|
+
- Rakefile
|
130
|
+
- entrepot.gemspec
|
131
|
+
- lib/entrepot.rb
|
132
|
+
- lib/entrepot/version.rb
|
133
|
+
- spec/entrepot_spec.rb
|
134
|
+
- testresults/testresults.html
|
135
|
+
homepage: ''
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 1.8.25
|
157
|
+
signing_key:
|
158
|
+
specification_version: 3
|
159
|
+
summary: Ruby is excellent for transforming and filtering data. Rubyists often use
|
160
|
+
these capabilities to manipulate large amounts of data in a multi-step pipeline
|
161
|
+
way. Entrepot memorizes the results along the way to speed up repetitive processing.
|
162
|
+
If only parts of the original data change, not all of it has to be recomputed. Immerdiate
|
163
|
+
results are stored on disk, to enable defered processing and reuse of previous results.
|
164
|
+
test_files:
|
165
|
+
- spec/entrepot_spec.rb
|
166
|
+
has_rdoc:
|