labimotion 0.1.11 → 0.1.14

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.
@@ -5,6 +5,7 @@ require 'uri'
5
5
  require 'json'
6
6
  require 'date'
7
7
  require 'labimotion/version'
8
+ require 'labimotion/utils/utils'
8
9
 
9
10
  # rubocop: disable Metrics/AbcSize
10
11
  # rubocop: disable Metrics/MethodLength
@@ -116,7 +117,7 @@ module Labimotion
116
117
  )
117
118
  # att.attachment_attacher.attach(tmp_file)
118
119
  if att.valid? && Labimotion::IS_RAILS5 == false
119
- att.attachment_attacher.create_derivatives
120
+ ## att.attachment_attacher.create_derivatives
120
121
  att.save!
121
122
  end
122
123
  if att.valid? && Labimotion::IS_RAILS5 == true
@@ -143,12 +144,16 @@ module Labimotion
143
144
  end
144
145
 
145
146
  def self.process(data)
146
- return if data[:a]&.attachable_type != 'Container'
147
-
147
+ return data[:a].con_state if data[:a]&.attachable_type != 'Container'
148
148
  response = nil
149
149
  begin
150
150
  ofile = Rails.root.join(data[:f], data[:a].filename)
151
- FileUtils.cp(data[:a].store.path, ofile)
151
+ if Labimotion::IS_RAILS5 == true
152
+ FileUtils.cp(data[:a].store.path, ofile)
153
+ else
154
+ FileUtils.cp(data[:a].attachment_url, ofile)
155
+ end
156
+
152
157
  File.open(ofile, 'r') do |f|
153
158
  body = { file: f }
154
159
  response = HTTParty.post(
@@ -160,12 +165,14 @@ module Labimotion
160
165
  end
161
166
  if response.ok?
162
167
  Labimotion::Converter.handle_response(data[:a], response)
168
+ Labimotion::ConState::PROCESSED
163
169
  else
164
170
  Labimotion::Converter.logger.error ["Converter Response Error: id: [#{data[:a]&.id}], filename: [#{data[:a]&.filename}], response: #{response}"].join($INPUT_RECORD_SEPARATOR)
171
+ Labimotion::ConState::ERROR
165
172
  end
166
- response
167
173
  rescue StandardError => e
168
- raise e
174
+ Labimotion::Converter.logger.error ["process fail: #{id}", e.message, *e.backtrace].join($INPUT_RECORD_SEPARATOR)
175
+ Labimotion::ConState::ERROR
169
176
  ensure
170
177
  FileUtils.rm_f(ofile)
171
178
  end
@@ -174,14 +181,14 @@ module Labimotion
174
181
  def self.jcamp_converter(id)
175
182
  resp = nil
176
183
  begin
184
+
177
185
  data = Labimotion::Converter.vor_conv(id)
178
186
  return if data.nil?
179
187
 
180
- resp = Labimotion::Converter.process(data)
181
- resp&.success? ? Labimotion::ConState::PROCESSED : Labimotion::ConState::ERROR
188
+ Labimotion::Converter.process(data)
182
189
  rescue StandardError => e
183
- Labimotion::ConState::ERROR
184
190
  Labimotion::Converter.logger.error ["jcamp_converter fail: #{id}", e.message, *e.backtrace].join($INPUT_RECORD_SEPARATOR)
191
+ Labimotion::ConState::ERROR
185
192
  end
186
193
  end
187
194
 
@@ -209,8 +216,7 @@ module Labimotion
209
216
  uuid = SecureRandom.uuid
210
217
  props = klass.properties_release
211
218
  props['uuid'] = uuid
212
- props['eln'] = Chemotion::Application.config.version
213
- props['labimotion'] = Labimotion::VERSION
219
+ props['pkg'] = Labimotion::Utils.pkg(props['pkg'])
214
220
  props['klass'] = 'Dataset'
215
221
  Labimotion::Dataset.create!(
216
222
  uuid: uuid,
@@ -228,6 +234,8 @@ module Labimotion
228
234
  new_prop = dataset.properties
229
235
  dsr.each do |ds|
230
236
  layer = layers[ds[:layer]]
237
+ next if layer.nil? || layer['fields'].nil?
238
+
231
239
  fields = layer['fields'].select{ |f| f['field'] == ds[:field] }
232
240
  fi = fields&.first
233
241
  idx = layer['fields'].find_index(fi)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'export_table'
3
+ require 'labimotion/version'
3
4
 
4
5
  module Labimotion
5
6
  ## ExportDataset
@@ -101,9 +102,18 @@ module Labimotion
101
102
  cds.attachments.where(aasm_state: 'csv').each do |att|
102
103
  name = File.basename(att.filename, '.csv')
103
104
  sheet = @xfile.workbook.add_worksheet(name: name)
104
- File.open(att.store.path) do |fi|
105
- fi.each_line do |line|
106
- sheet.add_row(line.split(','))
105
+
106
+ if Labimotion::IS_RAILS5 == true
107
+ File.open(att.store.path) do |fi|
108
+ fi.each_line do |line|
109
+ sheet.add_row(line.split(','))
110
+ end
111
+ end
112
+ else
113
+ File.open(att.attachment_url) do |fi|
114
+ fi.each_line do |line|
115
+ sheet.add_row(line.split(','))
116
+ end
107
117
  end
108
118
  end
109
119
  end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'labimotion/version'
4
+ require 'labimotion/utils/utils'
5
+
3
6
  module Labimotion
4
7
  ## NmrMapper
5
8
  class NmrMapper
6
9
  def self.is_brucker_binary(id)
7
10
  att = Attachment.find(id)
8
- if att&.attachment_attacher&.file&.url
9
- Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
11
+ if Labimotion::IS_RAILS5 == true
12
+ Zip::File.open(att.store.path) do |zip_file|
10
13
  zip_file.each do |entry|
11
14
  if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
12
15
  metadata = entry.get_input_stream.read.force_encoding('UTF-8')
@@ -14,6 +17,17 @@ module Labimotion
14
17
  end
15
18
  end
16
19
  end
20
+ else
21
+ if att&.attachment_attacher&.file&.url
22
+ Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
23
+ zip_file.each do |entry|
24
+ if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
25
+ metadata = entry.get_input_stream.read.force_encoding('UTF-8')
26
+ return metadata
27
+ end
28
+ end
29
+ end
30
+ end
17
31
  end
18
32
  nil
19
33
  end
@@ -247,8 +261,7 @@ module Labimotion
247
261
  uuid = SecureRandom.uuid
248
262
  props = klass.properties_release
249
263
  props['uuid'] = uuid
250
- props['eln'] = Chemotion::Application.config.version
251
- props['labimotion'] = Labimotion::VERSION
264
+ props['pkg'] = Labimotion::Utils.pkg(props['pkg'])
252
265
  props['klass'] = 'Dataset'
253
266
  dataset = Labimotion::Dataset.create!(
254
267
  uuid: uuid,
@@ -1,17 +1,33 @@
1
1
  # frozen_string_literal: true
2
+ require 'labimotion/version'
3
+ require 'labimotion/utils/utils'
2
4
 
3
5
  module Labimotion
4
6
  class NmrMapperRepo
5
7
  def self.is_brucker_binary(id)
6
8
  att = Attachment.find(id)
7
- Zip::File.open(att.store.path) do |zip_file|
8
- zip_file.each do |entry|
9
- if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
10
- metadata = entry.get_input_stream.read.force_encoding('UTF-8')
11
- return metadata
9
+ if Labimotion::IS_RAILS5 == true
10
+ Zip::File.open(att.store.path) do |zip_file|
11
+ zip_file.each do |entry|
12
+ if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
13
+ metadata = entry.get_input_stream.read.force_encoding('UTF-8')
14
+ return metadata
15
+ end
16
+ end
17
+ end
18
+ else
19
+ if att&.attachment_attacher&.file&.url
20
+ Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
21
+ zip_file.each do |entry|
22
+ if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
23
+ metadata = entry.get_input_stream.read.force_encoding('UTF-8')
24
+ return metadata
25
+ end
26
+ end
12
27
  end
13
28
  end
14
29
  end
30
+
15
31
  nil
16
32
  end
17
33
 
@@ -245,8 +261,7 @@ module Labimotion
245
261
  uuid = SecureRandom.uuid
246
262
  props = klass.properties_release
247
263
  props['uuid'] = uuid
248
- props['eln'] = Chemotion::Application.config.version
249
- props['labimotion'] = Labimotion::VERSION
264
+ props['pkg'] = Labimotion::Utils.pkg(props['pkg'])
250
265
  props['klass'] = 'Dataset'
251
266
  dataset = Labimotion::Dataset.create!(
252
267
  uuid: uuid,
@@ -20,7 +20,7 @@ module Labimotion
20
20
 
21
21
 
22
22
  def self.header(opt = {})
23
- opt || {}
23
+ opt || { timeout: 10, headers: { 'Content-Type' => 'text/json' } }
24
24
  end
25
25
 
26
26
  def self.handle_response(oat, response) # rubocop: disable Metrics/PerceivedComplexity
@@ -35,16 +35,22 @@ module Labimotion
35
35
 
36
36
  def self.list(klass)
37
37
  body = { klass: klass }
38
- response = HTTParty.get("#{uri('list')}?klass=#{klass}")
38
+ response = HTTParty.get("#{uri('list')}?klass=#{klass}", timeout: 10)
39
39
  # response.parsed_response if response.code == 200
40
40
  JSON.parse(response.body) if response.code == 200
41
+ rescue StandardError => e
42
+ Labimotion.log_exception(e)
43
+ error!('Cannot connect to Chemotion Repository', 401)
41
44
  end
42
45
 
43
46
  def self.fetch_identifier(klass, identifier)
44
47
  # body = { klass: klass, identifier: identifier }
45
- response = HTTParty.get("#{uri('fetch')}?klass=#{klass}&identifier=#{identifier}")
48
+ response = HTTParty.get("#{uri('fetch')}?klass=#{klass}&identifier=#{identifier}", timeout: 10)
46
49
  # response.parsed_response if response.code == 200
47
50
  JSON.parse(response.body) if response.code == 200
51
+ rescue StandardError => e
52
+ Labimotion.log_exception(e)
53
+ error!('Cannot connect to Chemotion Repository', 401)
48
54
  end
49
55
  end
50
56
  end
@@ -9,7 +9,7 @@ module Labimotion
9
9
  before_create :init_converter
10
10
  after_update :exec_converter
11
11
  def init_converter
12
- return if con_state.present?
12
+ return if self.has_attribute?(:con_state) == false || con_state.present?
13
13
  if Rails.configuration.try(:converter).try(:url) && ACCEPTED_FORMATS.include?(File.extname(filename&.downcase))
14
14
  self.con_state = Labimotion::ConState::WAIT
15
15
  end
@@ -23,7 +23,7 @@ module Labimotion
23
23
 
24
24
  def exec_converter
25
25
  #return if attachable_id.nil?
26
- return if con_state.nil? || con_state == Labimotion::ConState::NONE
26
+ return if self.has_attribute?(:con_state) == false || con_state.nil? || con_state == Labimotion::ConState::NONE
27
27
  case con_state
28
28
  when Labimotion::ConState::NMR
29
29
  content = Labimotion::NmrMapperRepo.is_brucker_binary(id)
@@ -36,6 +36,7 @@ module Labimotion
36
36
  when Labimotion::ConState::WAIT
37
37
  self.con_state = Labimotion::Converter.jcamp_converter(id)
38
38
  end
39
+ update_column(:con_state, con_state)
39
40
  end
40
41
  end
41
42
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Datasetable concern
4
+ require 'labimotion/utils/utils'
4
5
 
5
6
  module Labimotion
6
7
  ## Datasetable concern
@@ -21,23 +22,18 @@ module Labimotion
21
22
  klass = Labimotion::DatasetKlass.find_by(id: args[:dataset_klass_id])
22
23
  uuid = SecureRandom.uuid
23
24
  props = args[:properties]
24
- props['eln'] = Chemotion::Application.config.version
25
- props['labimotion'] = Labimotion::VERSION
25
+ props['pkg'] = Labimotion::Utils.pkg(props['pkg'])
26
+ props['identifier'] = klass.identifier
27
+ props['uuid'] = uuid
28
+ props['klass'] = 'Dataset'
29
+
26
30
  ds = Labimotion::Dataset.find_by(element_type: self.class.name, element_id: id)
27
31
  if ds.present? && (ds.klass_uuid != props['klass_uuid'] || ds.properties != props)
28
- props['uuid'] = uuid
29
- props['eln'] = Chemotion::Application.config.version
30
- props['labimotion'] = Labimotion::VERSION
31
- props['klass'] = 'Dataset'
32
32
  ds.update!(properties_release: klass.properties_release, uuid: uuid, dataset_klass_id: args[:dataset_klass_id], properties: props, klass_uuid: props['klass_uuid'])
33
33
  end
34
34
  return if ds.present?
35
35
 
36
- props['uuid'] = uuid
37
36
  props['klass_uuid'] = klass.uuid
38
- props['eln'] = Chemotion::Application.config.version
39
- props['labimotion'] = Labimotion::VERSION
40
- props['klass'] = 'Dataset'
41
37
  Labimotion::Dataset.create!(properties_release: klass.properties_release, uuid: uuid, dataset_klass_id: args[:dataset_klass_id], element_type: self.class.name, element_id: id, properties: props, klass_uuid: klass.uuid)
42
38
  end
43
39
 
@@ -1,34 +1,42 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Labimotion
4
- module GenericKlassRevisions
4
+ ## Generic Klass Revisions Helpers
5
+ module GenericKlassRevisions
5
6
  extend ActiveSupport::Concern
6
7
  included do
7
8
  # has_many :element_klasses_revisions, dependent: :destroy
8
9
  end
9
10
 
10
- def create_klasses_revision(user_id=0)
11
+ def create_klasses_revision(current_user)
11
12
  properties_release = properties_template
12
- # (properties_release['layers'] || {}).keys.each do |key|
13
- # properties_release['layers'][key]['layer'] = properties_release['layers'][key]['key']
14
- # end
13
+ migrate_workflow if properties_release['flow'].present?
15
14
 
16
- if properties_release['flow'].present?
17
- elements = (properties_release['flow']['elements'] || []).map do |el|
15
+ if properties_release['flowObject'].present?
16
+ elements = (properties_release['flowObject']['nodes'] || []).map do |el|
18
17
  if el['data'].present? && el['data']['lKey'].present?
19
18
  layer = properties_release['layers'][el['data']['lKey']]
20
19
  el['data']['layer'] = layer if layer.present?
21
20
  end
22
21
  el
23
22
  end
24
- properties_release['flow']['elements'] = elements
23
+ properties_release['flowObject']['nodes'] = elements
25
24
  end
25
+ klass_attributes = {
26
+ uuid: properties_template['uuid'],
27
+ properties_template: properties_release,
28
+ properties_release: properties_release,
29
+ released_at: DateTime.now,
30
+ updated_by: current_user&.id,
31
+ released_by: current_user&.id,
32
+ }
26
33
 
27
- self.update!({ uuid: properties_template['uuid'], properties_release: properties_release, released_at: DateTime.now })
34
+ self.update!(klass_attributes)
28
35
  reload
29
36
  attributes = {
30
- released_by: user_id,
37
+ released_by: released_by,
31
38
  uuid: uuid,
39
+ version: version,
32
40
  properties_release: properties_release,
33
41
  released_at: released_at
34
42
  }
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'labimotion/utils/utils'
4
+
3
5
  module Labimotion
4
6
  # Segmentable concern
5
7
  module Segmentable
@@ -45,25 +47,18 @@ module Labimotion
45
47
  klass = Labimotion::SegmentKlass.find_by(id: seg['segment_klass_id'])
46
48
  uuid = SecureRandom.uuid
47
49
  props = seg['properties']
48
- props['eln'] = Chemotion::Application.config.version
49
- props['labimotion'] = Labimotion::VERSION
50
+ props['pkg'] = Labimotion::Utils.pkg(props['pkg'])
51
+ props['identifier'] = identifier
52
+ props['uuid'] = uuid
53
+ props['klass'] = 'Segment'
50
54
  segment = Labimotion::Segment.find_by(element_type: Labimotion::Utils.element_name(self.class.name), element_id: self.id, segment_klass_id: seg['segment_klass_id'])
51
55
  if segment.present? && (segment.klass_uuid != props['klass_uuid'] || segment.properties != props)
52
- props['uuid'] = uuid
53
- props['eln'] = Chemotion::Application.config.version
54
- props['labimotion'] = Labimotion::VERSION
55
- props['klass'] = 'Segment'
56
-
57
56
  segment.update!(properties_release: klass.properties_release, properties: props, uuid: uuid, klass_uuid: props['klass_uuid'])
58
57
  segments.push(segment)
59
58
  end
60
59
  next if segment.present?
61
60
 
62
- props['uuid'] = uuid
63
61
  props['klass_uuid'] = klass.uuid
64
- props['eln'] = Chemotion::Application.config.version
65
- props['labimotion'] = Labimotion::VERSION
66
- props['klass'] = 'Segment'
67
62
  segment = Labimotion::Segment.create!(properties_release: klass.properties_release, segment_klass_id: seg['segment_klass_id'], element_type: Labimotion::Utils.element_name(self.class.name), element_id: self.id, properties: props, created_by: args[:current_user_id], uuid: uuid, klass_uuid: klass.uuid)
68
63
  segments.push(segment)
69
64
  end
@@ -0,0 +1,27 @@
1
+ module Labimotion
2
+ # Segmentable concern
3
+ module Workflow
4
+ extend ActiveSupport::Concern
5
+
6
+ def split_workflow(properties)
7
+ return if properties['flow'].nil?
8
+
9
+ if properties['flow'].present?
10
+ properties['flowObject'] = {}
11
+ elements = properties['flow']['elements'] || {}
12
+ properties['flowObject']['nodes'] = elements.select { |obj| obj['source'].nil? }
13
+ properties['flowObject']['edges'] = elements.select { |obj| obj['source'] && obj['source'] != obj['target'] }.map do |obj|
14
+ obj['markerEnd'] = { 'type': 'arrowclosed' }
15
+ obj
16
+ end
17
+ properties['flowObject']['viewport'] = {
18
+ "x": properties['flow']['position'][0] || 0,
19
+ "y": properties['flow']['position'][1] || 0,
20
+ "zoom": properties['flow']['zoom'] || 1
21
+ }
22
+ properties.delete('flow')
23
+ end
24
+ properties
25
+ end
26
+ end
27
+ end
@@ -1,16 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
  require 'labimotion/models/concerns/generic_revisions'
3
3
  require 'labimotion/models/concerns/segmentable'
4
+ require 'labimotion/models/concerns/workflow'
4
5
 
5
6
  module Labimotion
6
7
  class Element < ApplicationRecord
7
8
  acts_as_paranoid
8
9
  self.table_name = :elements
9
- include PgSearch
10
+ include PgSearch if Labimotion::IS_RAILS5 == true
11
+ include PgSearch::Model if Labimotion::IS_RAILS5 == false
10
12
  include ElementUIStateScopes
11
13
  include Collectable
12
14
  ## include AnalysisCodes
13
15
  include Taggable
16
+ include Workflow
14
17
  include Segmentable
15
18
  include GenericRevisions
16
19
 
@@ -106,6 +109,16 @@ module Labimotion
106
109
  preview && Base64.encode64(preview) || 'not available'
107
110
  end
108
111
 
112
+
113
+ def migrate_workflow
114
+ return if properties.nil? || properties_release.nil?
115
+
116
+ return if properties['flow'].nil? && properties_release['flow'].nil?
117
+
118
+ update_column(:properties, split_workflow(properties)) if properties['flow']
119
+ update_column(:properties_release, split_workflow(properties_release)) if properties_release['flow']
120
+ end
121
+
109
122
  private
110
123
 
111
124
  def delete_attachment
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
  require 'labimotion/models/concerns/generic_klass_revisions'
3
+ require 'labimotion/models/concerns/workflow'
3
4
 
4
5
  module Labimotion
5
6
  class ElementKlass < ApplicationRecord
6
- acts_as_paranoid
7
7
  self.table_name = :element_klasses
8
+ acts_as_paranoid
8
9
  include GenericKlassRevisions
10
+ include Workflow
9
11
  has_many :elements, dependent: :destroy, class_name: 'Labimotion::Element'
10
12
  has_many :segment_klasses, dependent: :destroy, class_name: 'Labimotion::SegmentKlass'
11
13
  has_many :element_klasses_revisions, dependent: :destroy, class_name: 'Labimotion::ElementKlassesRevision'
@@ -16,10 +18,18 @@ module Labimotion
16
18
  klasses = []
17
19
  ensure
18
20
  File.write(
19
- Rails.root.join('config', 'klasses.json'),
21
+ Rails.root.join('app/packs/klasses.json'),
20
22
  klasses&.to_json || []
21
23
  )
22
24
  end
23
25
 
26
+ def migrate_workflow
27
+ return if properties_template.nil? || properties_release.nil?
28
+
29
+ return if properties_template['flow'].nil? && properties_release['flow'].nil?
30
+
31
+ update_column(:properties_template, split_workflow(properties_template)) if properties_template['flow']
32
+ update_column(:properties_release, split_workflow(properties_release)) if properties_release['flow']
33
+ end
24
34
  end
25
35
  end
@@ -1,9 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'labimotion/models/concerns/workflow'
4
+
3
5
  module Labimotion
4
6
  class ElementKlassesRevision < ApplicationRecord
5
7
  acts_as_paranoid
6
8
  self.table_name = :element_klasses_revisions
9
+ include Workflow
7
10
  has_one :element_klass, class_name: 'Labimotion::ElementKlass'
11
+
12
+
13
+ def migrate_workflow
14
+ return if properties_release.nil? || properties_release['flow'].nil?
15
+
16
+ update_column(:properties_release, split_workflow(properties_release)) if properties_release['flow']
17
+ end
8
18
  end
9
19
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Labimotion
4
+ class HubLog < ApplicationRecord
5
+ self.table_name = :hub_logs
6
+ belongs_to :klass, polymorphic: true, optional: true
7
+ end
8
+ end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'labimotion/version'
3
4
  module Labimotion
5
+ ## Generic Utils
4
6
  class Utils
5
7
  def self.klass_by_collection(name)
6
8
  names = name.split('::')
@@ -53,5 +55,36 @@ module Labimotion
53
55
  def self.element_name_dc(name)
54
56
  Labimotion::Utils.element_name(name)&.downcase
55
57
  end
58
+
59
+ def self.next_version(release, current_version)
60
+ case release
61
+ when 'draft'
62
+ current_version
63
+ when 'major'
64
+ if current_version.nil? || current_version.split('.').length < 2
65
+ '1.0'
66
+ else
67
+ "#{current_version&.split('.').first.to_i + 1}.0"
68
+ end
69
+ when 'minor'
70
+ if current_version.nil? || current_version&.split('.').length < 2
71
+ '0.1'
72
+ else
73
+ "#{current_version&.split('.').first.to_i.to_s}.#{current_version&.split('.').last.to_i + 1}"
74
+ end
75
+ else
76
+ current_version
77
+ end
78
+ rescue StandardError => e
79
+ Labimotion.log_exception(e)
80
+ current_version
81
+ end
82
+
83
+ def self.pkg(pkg)
84
+ pkg = {} if pkg.nil?
85
+ pkg['eln'] = Chemotion::Application.config.version
86
+ pkg['labimotion'] = Labimotion::VERSION
87
+ pkg
88
+ end
56
89
  end
57
90
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Labimotion
4
- VERSION = '0.1.11'
5
4
  IS_RAILS5 = true
5
+ VERSION = '0.1.14' if Labimotion::IS_RAILS5 == true
6
+ VERSION = '1.0.1' if Labimotion::IS_RAILS5 == false
6
7
  end
data/lib/labimotion.rb CHANGED
@@ -7,7 +7,7 @@ module Labimotion
7
7
  @@labimotion_logger ||= Logger.new(Rails.root.join('log/labimotion.log')) # rubocop:disable Style/ClassVars
8
8
  end
9
9
 
10
- def self.log_exception(exception, current_user = {})
10
+ def self.log_exception(exception, current_user = nil)
11
11
  Labimotion.logger.error("version: #{Labimotion::VERSION}; #{Labimotion::IS_RAILS5}, (#{current_user&.id}) \n Exception: #{exception.message}")
12
12
  Labimotion.logger.error(exception.backtrace.join("\n"))
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: labimotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chia-Lin Lin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-08-16 00:00:00.000000000 Z
12
+ date: 2023-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -73,6 +73,7 @@ files:
73
73
  - lib/labimotion/models/concerns/generic_klass_revisions.rb
74
74
  - lib/labimotion/models/concerns/generic_revisions.rb
75
75
  - lib/labimotion/models/concerns/segmentable.rb
76
+ - lib/labimotion/models/concerns/workflow.rb
76
77
  - lib/labimotion/models/dataset.rb
77
78
  - lib/labimotion/models/dataset_klass.rb
78
79
  - lib/labimotion/models/dataset_klasses_revision.rb
@@ -83,6 +84,7 @@ files:
83
84
  - lib/labimotion/models/elements_element.rb
84
85
  - lib/labimotion/models/elements_revision.rb
85
86
  - lib/labimotion/models/elements_sample.rb
87
+ - lib/labimotion/models/hub_log.rb
86
88
  - lib/labimotion/models/segment.rb
87
89
  - lib/labimotion/models/segment_klass.rb
88
90
  - lib/labimotion/models/segment_klasses_revision.rb
@@ -113,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
115
  - !ruby/object:Gem::Version
114
116
  version: '0'
115
117
  requirements: []
116
- rubygems_version: 3.0.9
118
+ rubygems_version: 3.4.18
117
119
  signing_key:
118
120
  specification_version: 4
119
121
  summary: Chemotion LabIMotion