labimotion 1.4.0.rc5 → 1.4.0.rc6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 587b32cc2f374e118a3570bbe34a69a497ec9e6d2134757d9241ad6c90b416ec
4
- data.tar.gz: 4a778699fb7c40c7aa3383cc2cabfb910218a616f122d0b748d092262d2ee370
3
+ metadata.gz: f17746bfc2e59e5a5831ba43f167b081e1c9d0f40fbecd6e5d6c780b42b55cea
4
+ data.tar.gz: 2b87525c3e275df8e80a1c75501a20014f1c5355fd149d76fd509b8819f8bab9
5
5
  SHA512:
6
- metadata.gz: 1c20c57d746b3c6d0f771781fb3bf44eda10062f0ca577cb06e6c4aed1bcceb8f8f0be7556d2cb3e310010aa38c9de14ef791309fe829ef1d591b8782ac5c29a
7
- data.tar.gz: 760ae347f5842287bdf7d04074d55d38cdac15cf61fa540c87295f049c1547fea20fba669997172db08fcbb2f570abd3bf1b4fdbb5774e41d163645e41512e15
6
+ metadata.gz: c38733299255e71615703933d0caa2e55594cb73e66b9265ad260dd0ced46b7aea98f903b3d0d0874648c04fcdedbc0c2f8156d69aaa82520816be02a8ec149a
7
+ data.tar.gz: c676883c9c863a1efbeccf27ba0c22f5b0cb21afae26339c449608a8de7c1c486501a829039a4d379d05b59853696969e5b06f685e9f389d87ccfdae9e3a7dc3
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'labimotion/version'
3
+ require 'labimotion/conf'
4
4
  require 'labimotion/libs/export_element'
5
5
 
6
6
  module Labimotion
@@ -17,6 +17,19 @@ module Labimotion
17
17
  helpers Labimotion::ParamHelpers
18
18
 
19
19
  resource :generic_elements do
20
+ # might be removed because the file is moved to public folder
21
+ namespace :current do
22
+ desc 'Return serialized elements of current user'
23
+ get do
24
+ klasses_json_path = Labimotion::KLASSES_JSON # Rails.root.join('app/packs/klasses.json')
25
+ klasses = JSON.parse(File.read(klasses_json_path))
26
+ { klasses: klasses }
27
+ rescue StandardError => e
28
+ Labimotion.log_exception(e, current_user)
29
+ { klasses: [] }
30
+ end
31
+ end
32
+
20
33
  namespace :klass do
21
34
  desc 'get klass info'
22
35
  params do
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ## Labimotion Configuration
4
+ module Labimotion
5
+ KLASSES_JSON = Rails.root.join('public', 'klasses.json').to_s.freeze # Rails.root.join('app/packs/klasses.json').to_s.freeze
6
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'grape'
4
+ require 'labimotion/conf'
4
5
  require 'labimotion/utils/utils'
5
6
  # require 'labimotion/models/element_klass'
6
7
  module Labimotion
@@ -33,7 +34,7 @@ module Labimotion
33
34
  new_klass = Labimotion::ElementKlass.create!(attributes)
34
35
  new_klass.reload
35
36
  new_klass.create_klasses_revision(current_user)
36
- klass_names_file = Rails.root.join('app/packs/klasses.json')
37
+ klass_names_file = Labimotion::KLASSES_JSON # Rails.root.join('app/packs/klasses.json')
37
38
  klasses = Labimotion::ElementKlass.where(is_active: true)&.pluck(:name) || []
38
39
  File.write(klass_names_file, klasses)
39
40
  klasses
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'grape'
3
+ require 'labimotion/conf'
3
4
  require 'labimotion/utils/utils'
4
5
  # Helper for associated sample
5
6
  module Labimotion
@@ -97,7 +98,7 @@ module Labimotion
97
98
 
98
99
  ###############
99
100
  def generate_klass_file
100
- klass_names_file = Rails.root.join('app/packs/klasses.json')
101
+ klass_names_file = Labimotion::KLASSES_JSON # Rails.root.join('app/packs/klasses.json')
101
102
  klasses = Labimotion::ElementKlass.where(is_active: true)&.pluck(:name) || []
102
103
  File.write(klass_names_file, klasses)
103
104
  rescue StandardError => e
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'labimotion/conf'
2
3
  require 'labimotion/models/concerns/generic_klass_revisions'
3
4
  require 'labimotion/models/concerns/workflow'
4
5
 
@@ -18,7 +19,8 @@ module Labimotion
18
19
  klasses = []
19
20
  ensure
20
21
  File.write(
21
- Rails.root.join('app/packs/klasses.json'),
22
+ # Rails.root.join('app/packs/klasses.json'),
23
+ Labimotion::KLASSES_JSON,
22
24
  klasses&.to_json || []
23
25
  )
24
26
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.0.rc5'
5
+ VERSION = '1.4.0.rc6'
6
6
  end
data/lib/labimotion.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # In your_gem_name.rb or main Ruby file
2
2
  module Labimotion
3
3
 
4
+ autoload :CONF, 'labimotion/conf'
4
5
  autoload :VERSION, 'labimotion/version'
5
6
 
6
7
  def self.logger
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: 1.4.0.rc5
4
+ version: 1.4.0.rc6
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: 2024-07-05 00:00:00.000000000 Z
12
+ date: 2024-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -42,6 +42,7 @@ files:
42
42
  - lib/labimotion/apis/segment_api.rb
43
43
  - lib/labimotion/collection/export.rb
44
44
  - lib/labimotion/collection/import.rb
45
+ - lib/labimotion/conf.rb
45
46
  - lib/labimotion/entities/application_entity.rb
46
47
  - lib/labimotion/entities/dataset_entity.rb
47
48
  - lib/labimotion/entities/dataset_klass_entity.rb