sushi_fabric 0.0.8 → 0.0.9

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,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Version = '20131115-105530'
3
+ # Version = '20131128-095705'
4
4
 
5
5
  require 'csv'
6
6
  require 'fileutils'
@@ -118,6 +118,40 @@ class ::String
118
118
  scan(/\[(.*)\]/).flatten.join =~ /#{tag}/
119
119
  end
120
120
  end
121
+ def save_data_set(data_set_arr, headers, rows)
122
+ data_set_hash = Hash[*data_set_arr]
123
+ if project = Project.find_by_number(data_set_hash['ProjectNumber'].to_i)
124
+ data_set = DataSet.new
125
+ data_set.name = data_set_hash['DataSetName']
126
+ data_set.project = project
127
+ if parent_id = data_set_hash['ParentID'] and parent_data_set = DataSet.find_by_id(parent_id.to_i)
128
+ data_set.data_set = parent_data_set
129
+ end
130
+ if comment = data_set_hash['Comment'] and !comment.to_s.empty?
131
+ data_set.comment = comment
132
+ end
133
+
134
+ sample_hash = {}
135
+ rows.each do |row|
136
+ headers.each_with_index do |header, i|
137
+ sample_hash[header]=row[i]
138
+ end
139
+ sample = Sample.new
140
+ sample.key_value = sample_hash.to_s
141
+ sample.save unless sample.saved?
142
+ data_set.samples << sample
143
+ end
144
+
145
+ data_set.md5 = data_set.md5hexdigest
146
+ unless data_set.saved?
147
+ project.data_sets << data_set
148
+ parent_data_set.data_sets << data_set if parent_data_set
149
+ data_set.save
150
+ end
151
+ data_set.id
152
+ end
153
+ end
154
+
121
155
  class SushiApp
122
156
  attr_reader :params
123
157
  attr_reader :job_ids
@@ -391,6 +425,7 @@ rm -rf #{@scratch_dir} || exit 1
391
425
  @job_scripts << @job_script
392
426
  @result_dataset << next_dataset
393
427
  end
428
+ =begin
394
429
  def save_data_set(data_set_arr, headers, rows)
395
430
  data_set_hash = Hash[*data_set_arr]
396
431
  if project = Project.find_by_number(data_set_hash['ProjectNumber'].to_i)
@@ -424,7 +459,7 @@ rm -rf #{@scratch_dir} || exit 1
424
459
  data_set.id
425
460
  end
426
461
  end
427
-
462
+ =end
428
463
  def run
429
464
  test_run
430
465
 
@@ -1,3 +1,3 @@
1
1
  module SushiFabric
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
4
+ version: 0.0.9
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-15 00:00:00.000000000 Z
12
+ date: 2013-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler