sushi_fabric 0.0.5 → 0.0.6
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/sushi_fabric/sushiApp.rb +30 -62
- data/lib/sushi_fabric/version.rb +1 -1
- metadata +2 -3
- data/lib/sushi_fabric/sushi_configure.yml +0 -4
@@ -1,34 +1,41 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
-
Version = '
|
3
|
+
# Version = '20131111-112007'
|
4
4
|
|
5
5
|
require 'csv'
|
6
6
|
require 'fileutils'
|
7
|
-
require 'active_record'
|
8
7
|
require 'yaml'
|
9
8
|
require 'drb/drb'
|
9
|
+
gem 'rails', '<=3.2.15'
|
10
|
+
require 'rails/all'
|
10
11
|
|
11
12
|
module SushiFabric
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
config =
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
class Application < Rails::Application
|
14
|
+
# default parameters
|
15
|
+
config.workflow_manager = 'druby://localhost:12345'
|
16
|
+
config.gstore_dir = File.join(Dir.pwd, 'gstore/projects')
|
17
|
+
config.sushi_app_dir = Dir.pwd
|
18
|
+
config.scratch_dir = '/tmp/scratch'
|
19
|
+
end
|
20
|
+
|
21
|
+
# load custmized parameters if there is
|
22
|
+
mode = ENV['RAILS_ENV']||'development'
|
23
|
+
config_file = File.join('./config/environments', mode)
|
24
|
+
if File.exist?(config_file + '.rb')
|
25
|
+
require config_file
|
26
|
+
end
|
27
|
+
|
28
|
+
config = SushiFabric::Application.config
|
29
|
+
WORKFLOW_MANAGER = config.workflow_manager
|
30
|
+
GSTORE_DIR = config.gstore_dir
|
31
|
+
SUSHI_APP_DIR = config.sushi_app_dir
|
32
|
+
SCRATCH_DIR = config.scratch_dir
|
33
|
+
|
34
|
+
# check if there is a sqlite3 database of Ruby on Rails
|
35
|
+
if defined?(::Project)
|
36
|
+
NO_ROR = false
|
37
|
+
elsif File.exist?(File.join(SUSHI_APP_DIR, "app/models"))
|
38
|
+
NO_ROR = false
|
32
39
|
ActiveRecord::Base.establish_connection(
|
33
40
|
:adapter => 'sqlite3',
|
34
41
|
:database => "#{SUSHI_APP_DIR}/db/development.sqlite3"
|
@@ -36,48 +43,9 @@ rescue
|
|
36
43
|
require "#{SUSHI_APP_DIR}/app/models/project"
|
37
44
|
require "#{SUSHI_APP_DIR}/app/models/data_set"
|
38
45
|
require "#{SUSHI_APP_DIR}/app/models/sample"
|
39
|
-
no_ror = false
|
40
46
|
else
|
41
|
-
|
47
|
+
NO_ROR = true
|
42
48
|
end
|
43
|
-
end
|
44
|
-
NO_ROR = no_ror
|
45
|
-
|
46
|
-
=begin
|
47
|
-
def save_data_set(data_set_arr, headers, rows)
|
48
|
-
data_set_hash = Hash[*data_set_arr]
|
49
|
-
if project = Project.find_by_number(data_set_hash['ProjectNumber'].to_i)
|
50
|
-
data_set = DataSet.new
|
51
|
-
data_set.name = data_set_hash['DataSetName']
|
52
|
-
data_set.project = project
|
53
|
-
if parent_id = data_set_hash['ParentID'] and parent_data_set = DataSet.find_by_id(parent_id.to_i)
|
54
|
-
data_set.data_set = parent_data_set
|
55
|
-
end
|
56
|
-
if comment = data_set_hash['Comment'] and !comment.to_s.empty?
|
57
|
-
data_set.comment = comment
|
58
|
-
end
|
59
|
-
|
60
|
-
sample_hash = {}
|
61
|
-
rows.each do |row|
|
62
|
-
headers.each_with_index do |header, i|
|
63
|
-
sample_hash[header]=row[i]
|
64
|
-
end
|
65
|
-
sample = Sample.new
|
66
|
-
sample.key_value = sample_hash.to_s
|
67
|
-
sample.save unless sample.saved?
|
68
|
-
data_set.samples << sample
|
69
|
-
end
|
70
|
-
|
71
|
-
data_set.md5 = data_set.md5hexdigest
|
72
|
-
unless data_set.saved?
|
73
|
-
project.data_sets << data_set
|
74
|
-
parent_data_set.data_sets << data_set if parent_data_set
|
75
|
-
data_set.save
|
76
|
-
end
|
77
|
-
data_set.id
|
78
|
-
end
|
79
|
-
end
|
80
|
-
=end
|
81
49
|
|
82
50
|
class ::Hash
|
83
51
|
attr_reader :defaults
|
data/lib/sushi_fabric/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sushi_fabric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
59
59
|
- lib/sushi_fabric/sushiApp.rb
|
60
|
-
- lib/sushi_fabric/sushi_configure.yml
|
61
60
|
- lib/sushi_fabric/version.rb
|
62
61
|
- lib/sushi_fabric.rb
|
63
62
|
- sample/WordCountApp.rb
|