-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9abbe7a
Showing
18 changed files
with
411 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
./log/* | ||
log/*.log | ||
log/development.log | ||
.DS_Store | ||
doc/api | ||
doc/app | ||
coverage | ||
db/*.sqlite3 | ||
db/development_structure.sql | ||
public/uploads | ||
spec/dummy/log | ||
spec/dummy/tmp | ||
spec/dummy/public/system/images | ||
spec/dummy/puplic/assets/* | ||
spec/dummy/public/system/uploads/* | ||
spec/dummy/public/system/* | ||
spec/dummy/public/uploads | ||
spec/dummy/log* | ||
spec/dummy/tmp* | ||
index/* | ||
*.swp | ||
*.swo | ||
.idea/ | ||
.idea/**/* | ||
nbproject/* | ||
*.war | ||
db/schema.rb | ||
tmp/* | ||
wMake.bat | ||
etc/web.xml | ||
build/ | ||
build/* | ||
.bundle/ | ||
~/ | ||
~/* | ||
*.knob | ||
tmp | ||
mysession.vi* | ||
ruby-uuid | ||
localhistory | ||
test | ||
prod | ||
*.png | ||
site/dev/images/galleries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source 'http://rubygems.org' | ||
gem 'recursive-open-struct' | ||
group :test do | ||
gem 'guard-rspec' | ||
gem 'guard' | ||
gem 'rspec' | ||
gem 'cucumber' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
builder (3.2.2) | ||
celluloid (0.15.2) | ||
timers (~> 1.1.0) | ||
celluloid-io (0.15.0) | ||
celluloid (>= 0.15.0) | ||
nio4r (>= 0.5.0) | ||
coderay (1.1.0) | ||
cucumber (1.3.15) | ||
builder (>= 2.1.2) | ||
diff-lcs (>= 1.1.3) | ||
gherkin (~> 2.12) | ||
multi_json (>= 1.7.5, < 2.0) | ||
multi_test (>= 0.1.1) | ||
diff-lcs (1.2.5) | ||
ffi (1.9.3) | ||
formatador (0.2.4) | ||
gherkin (2.12.2) | ||
multi_json (~> 1.3) | ||
guard (2.6.0) | ||
formatador (>= 0.2.4) | ||
listen (~> 2.7) | ||
lumberjack (~> 1.0) | ||
pry (>= 0.9.12) | ||
thor (>= 0.18.1) | ||
guard-rspec (4.2.8) | ||
guard (~> 2.1) | ||
rspec (>= 2.14, < 4.0) | ||
listen (2.7.1) | ||
celluloid (>= 0.15.2) | ||
celluloid-io (>= 0.15.0) | ||
rb-fsevent (>= 0.9.3) | ||
rb-inotify (>= 0.9) | ||
lumberjack (1.0.5) | ||
method_source (0.8.2) | ||
multi_json (1.10.1) | ||
multi_test (0.1.1) | ||
nio4r (1.0.0) | ||
pry (0.9.12.6) | ||
coderay (~> 1.0) | ||
method_source (~> 0.8) | ||
slop (~> 3.4) | ||
rb-fsevent (0.9.4) | ||
rb-inotify (0.9.3) | ||
ffi (>= 0.5.0) | ||
recursive-open-struct (0.4.5) | ||
rspec (2.14.1) | ||
rspec-core (~> 2.14.0) | ||
rspec-expectations (~> 2.14.0) | ||
rspec-mocks (~> 2.14.0) | ||
rspec-core (2.14.8) | ||
rspec-expectations (2.14.5) | ||
diff-lcs (>= 1.1.3, < 2.0) | ||
rspec-mocks (2.14.6) | ||
slop (3.5.0) | ||
thor (0.19.1) | ||
timers (1.1.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
cucumber | ||
guard | ||
guard-rspec | ||
recursive-open-struct | ||
rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
notification :tmux, display_message: true | ||
guard :rspec do | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^spec/spec_helper\.rb}) | ||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require 'capybara/cucumber' | ||
require 'capybara/poltergeist' | ||
@processingWorkingDir=File.dirname(__FILE__) | ||
@processingWorkDir=@processingWorkingDir+"/../processing/vert/" | ||
#Start the two servers : | ||
# | ||
#Processing Server : | ||
# @t1 = fork do | ||
# system("cd #{@processingWorkDir} && rvm use jruby-1.7.1@masha_gems && vertx run #{@processingWorkDir}server_app.js -conf test.json") | ||
# end | ||
# sleep(5) | ||
# @siteServerPath=File.dirname(__FILE__) + "/../site/bin/" # This is a Serverinstance which is not deployed. It simulates the server of the provider | ||
# @t2 = fork do | ||
# system("cd #{@siteServerPath} && ruby pageServer.rb -p 4568") | ||
# end | ||
# sleep(5) | ||
if ENV['IN_BROWSER'] | ||
# On demand: non-headless tests via Selenium/WebDriver | ||
# To run the scenarios in browser (default: Firefox), use the following command line: | ||
# IN_BROWSER=true bundle exec cucumber | ||
# or (to have a pause of 1 second between each step): | ||
# IN_BROWSER=true PAUSE=1 bundle exec cucumber | ||
Capybara.default_driver = :selenium | ||
AfterStep do | ||
sleep (ENV['PAUSE'] || 0).to_i | ||
end | ||
else | ||
# DEFAULT: headless tests with poltergeist/PhantomJS | ||
Capybara.register_driver :poltergeist do |app| | ||
Capybara::Poltergeist::Driver.new( | ||
app, | ||
window_size: [1280, 1024]#, | ||
#debug: true | ||
) | ||
end | ||
Capybara.default_driver = :poltergeist | ||
Capybara.javascript_driver = :poltergeist | ||
end | ||
at_exit do | ||
|
||
puts @t1 | ||
puts @t2 | ||
|
||
|
||
if @t1 | ||
puts "processserver killed" | ||
Process.kill("HUP",@t1) | ||
sleep(10) | ||
end | ||
if @t2 | ||
puts "pageServer killed" | ||
Process.kill("HUP",@t2) | ||
sleep(10) | ||
end | ||
puts "bye" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Feature:Commandline functionality | ||
|
||
A User should be able to call a command to get a mixed outputfile | ||
|
||
Scenario: CommandlineCall | ||
Given a empty testenvironment with one erb file and one data file | ||
When I enter "mix dataInput dataoutput templateDir" | ||
Then I should get a file with the name dataInput and the suffix mixed | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
|
||
|
||
|
||
Given(/^a empty testenvironment with one erb file and one data file$/) do | ||
###just do something | ||
if File.exists?("features/testDir/output/test.txt") | ||
system("rm /features/testDir/output/*") | ||
end | ||
end | ||
|
||
When(/^I enter "(.*?)"$/) do |arg1| | ||
system(arg1) | ||
end | ||
|
||
Then(/^I should get a file with the name dataInput and the suffix mixed$/) do | ||
File.exists?("features/testDir/output/test.txt").should==true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
After do |scenario| | ||
if scenario.failed? | ||
# save_page | ||
end | ||
end |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
require 'recursive-open-struct' | ||
|
||
|
||
|
||
module MIX | ||
|
||
class Mixer | ||
|
||
def initialize(data) | ||
@data = data | ||
@result = [] | ||
@deeps = 0 | ||
end | ||
|
||
def mixItBaby(data) | ||
###putting an Index to the elements to find the sequence which has been in the json### | ||
@deeps=@deeps + 1 | ||
ros = RecursiveOpenStruct.new(data,recurse_over_array: true) | ||
puts ros.inspect | ||
bind_hash={} | ||
data.each do |k,v| | ||
if v.kind_of?(Hash) | ||
mixItBaby(v) | ||
elsif v.kind_of?(Array) | ||
ar = v | ||
ar.each do |element| | ||
mixItBaby(element) | ||
end | ||
else | ||
bind_hash[k] = v | ||
end | ||
end | ||
puts bind_hash.inspect | ||
et = ErbIT.new( bind_hash) | ||
template = getTemplate(bind_hash[:id]) | ||
filled = et.render(template) | ||
puts filled.inspect | ||
@result.push(filled) | ||
puts @deeps.inspect | ||
@deeps = @deeps -1 | ||
end | ||
|
||
|
||
|
||
|
||
|
||
def getResult | ||
@result | ||
end | ||
|
||
|
||
|
||
def getTemplate(id) | ||
path = File.join(File.dirname(__FILE__),'../templates') | ||
filename = File.join(path,id) | ||
template = IO.read(filename) | ||
template | ||
end | ||
|
||
|
||
|
||
end | ||
|
||
|
||
|
||
|
||
class ErbIT < OpenStruct | ||
def render(template) | ||
ERB.new(template).result(binding) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Template | ||
attr_accessor :file_path,:contents | ||
|
||
def self.all | ||
Dir.glob("lib/templates/*").collect{|t| Template.new(t)} | ||
end | ||
|
||
def initialize(file_path) | ||
@file_path = file_path | ||
@contents = File.open(@file_path, "rb").read | ||
end | ||
|
||
def variables | ||
self.contents.scan(/(\@[a-z]+[0-9a-z_]*)/i).uniq | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
MIX | ||
=== | ||
|
||
What is MIX ? | ||
------------- | ||
Mix is a gem for mixing data with tamplatefiles. | ||
|
||
Example Use Case | ||
---------------- | ||
You have to print bills for a list of items/products. | ||
What you do : | ||
Transform the data to a hash which lasts a specific form | ||
Run mix with a erb template. Viola the output is (depending on the template) | ||
ready to be formatted in latex of whatever. | ||
|
||
But whatever...... | ||
|
||
|
||
|
||
Install | ||
------- | ||
gem mix | ||
|
||
run (form commandline) | ||
----------------------- | ||
mix inputfile template outputfile | ||
|
||
|
||
run withing a programm | ||
---------------------- | ||
|
||
|
||
current project status | ||
---------------------- | ||
Work in progress just started | ||
|
||
|
||
You want to contributes ? | ||
========================== | ||
Contact [email protected] | ||
|
||
|
||
|
||
|
||
Structure of the data | ||
===================== | ||
|
||
json Format recursive, selfcontained. | ||
|
||
recursive : substructures possible (nodes) | ||
selfcontained : The name of the erb (id, for DB or File or whatever) is within the data | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.