iatelier 0.4.2 → 0.4.3

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: f94966b5b6ce1b3d0b4af8888299efb172adee30e761b22c592835ede26f2c05
4
- data.tar.gz: 6046973762b56a161dd5c90900a0585314e0e9d4eecd8214c3af6d68d254dd55
3
+ metadata.gz: 76590b778f4a1751dd45b71b66454fd09cd4ccef1d618877104640f4b081ada5
4
+ data.tar.gz: 19ee2dac571df2899673d08636fedcbeef8f77a29a5280d7c7e4c8711251ec23
5
5
  SHA512:
6
- metadata.gz: ef014861440252ece14e446912eee57018443e6df287b862a26b1353ee6adad3672fcf3f30f5e258db8e7e71b2e93446f91ae23fea2c61c6572d283b3e651034
7
- data.tar.gz: b02d2da7679f89bf8c58d1940d9f12fa094c1e0ed336bbab717c17a8cebcdb735c74c089c4733aaf24b54235144546fc90dab86d7546154924464bf708f5c9f8
6
+ metadata.gz: 85efe36bba980cf2d6ae02dad61d6d2d8df5f88cf4d65223d0bac66be8512ed167d804ba9b791348245a94c4c2bccb6487fa49e0495e3a7c765a952735fb2677
7
+ data.tar.gz: 2bad2720e84c46ba353a4226768a76a1384a6f2d4a6ccf95dbf5eb5f7ff3520d861de25a721eefd0b38a490e385537b22a8f5138d2aa7338d567c1d98f642add
@@ -9,7 +9,7 @@ module Iatelier
9
9
  @database = params[:database]
10
10
  self.set_database database
11
11
  @book = Object.const_get(params[:book_type].capitalize).find(params[:id])
12
- @book.namespace = @database
12
+ @book.namespace = Ilog.configuration.namespaces.key(@database)
13
13
  end
14
14
  end
15
15
  end
@@ -5,8 +5,10 @@ module Iatelier
5
5
  include Iatelier::Action
6
6
  include Iatelier::Controllers::Books::DbConnector
7
7
  def call(params)
8
- self.set_database params[:database]
8
+ @database = params[:database]
9
+ self.set_database @database
9
10
  @book = Object.const_get(params[:book_type].capitalize).find(params[:id])
11
+ @book.namespace = Ilog.configuration.namespaces.key(@database)
10
12
  @book.revise(params)
11
13
  @book.save
12
14
  self.body = @book.save.to_json
@@ -5,10 +5,8 @@ class Book < ActiveRecord::Base
5
5
  DIMENSIONS = []
6
6
  GROUPINGS = []
7
7
  ROLES = []
8
-
8
+
9
9
  @content_raw = ''
10
-
11
- @namespace = nil
12
10
 
13
11
  has_one :title, as: :titleable, class_name: 'Dimensions::Title'
14
12
  has_one :slug, as: :slugable, class_name: 'Dimensions::Slug'
@@ -22,23 +20,23 @@ class Book < ActiveRecord::Base
22
20
 
23
21
  has_many :peopleables, as: :peopleable, dependent: :destroy
24
22
  has_many :peoples, through: :peopleables
25
-
23
+
26
24
  has_many :bundleables, as: :bundleable, dependent: :destroy
27
25
  has_many :bundles, through: :bundleables
28
-
26
+
29
27
  accepts_nested_attributes_for :title, :slug, :subtitle, :description, :thumbnail, :timestamp
30
28
  validates_associated :slug
31
-
29
+
32
30
  attr_accessor :namespace
33
31
 
34
-
32
+
35
33
  def kind
36
34
  self.class.to_s
37
35
  end
38
36
  def uniq
39
37
  self.class.to_s + self.id.to_s
40
38
  end
41
-
39
+
42
40
  def dimensions
43
41
  self.class::DIMENSIONS
44
42
  end
@@ -53,7 +51,7 @@ class Book < ActiveRecord::Base
53
51
  @query = '`peopleables`.`role` = "' + requested_role.to_s + '"'
54
52
  self.peoples.includes(:peopleables).where(@query)
55
53
  end
56
-
54
+
57
55
  def content_raw
58
56
  puts 'trying to open content'
59
57
  unless self.id.nil?
@@ -70,7 +68,7 @@ class Book < ActiveRecord::Base
70
68
  @content = nil
71
69
  end
72
70
  end
73
-
71
+
74
72
  def content
75
73
  markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
76
74
  markdown.render(self.content_raw)
@@ -177,7 +175,7 @@ class Book < ActiveRecord::Base
177
175
  def revise_title params
178
176
  self.title.update(value: params[:title])
179
177
  end
180
-
178
+
181
179
  def setup_subtitle params
182
180
  self.build_subtitle({value: params[:subtitle]})
183
181
  end
@@ -191,12 +189,12 @@ class Book < ActiveRecord::Base
191
189
  def revise_slug params
192
190
  self.slug.update(value: params[:slug])
193
191
  end
194
-
192
+
195
193
  def setup_thumbnail params
196
194
  end
197
195
  def revise_thumbnail params
198
196
  end
199
-
197
+
200
198
  def setup_timestamp params
201
199
  puts 'setting up timestamp'
202
200
  self.build_timestamp({
@@ -219,10 +217,9 @@ class Book < ActiveRecord::Base
219
217
  self.setup_timestamp params
220
218
  end
221
219
  end
222
-
220
+
223
221
  def sync_content params
224
- puts 'we are trying to sync the content = ' + params[:content]
225
- path = Iatelier.configuration.storage_dir + params[:database].to_s + self.class.name.downcase + '/' + self.id.to_s
222
+ path = Iatelier.configuration.storage_dir + @namespace.to_s + self.class.name.downcase + '/' + self.id.to_s
226
223
  Dir.mkdir(path) unless File.exists?(path)
227
224
  File.open(path + '/main.md', 'w+') do |file|
228
225
  file.puts params[:content]
@@ -232,4 +229,4 @@ class Book < ActiveRecord::Base
232
229
  self.save
233
230
  puts self.loc.to_s
234
231
  end
235
- end
232
+ end
@@ -1,3 +1,3 @@
1
1
  module Iatelier
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iatelier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Captain Husayn Pinguin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-26 00:00:00.000000000 Z
11
+ date: 2020-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler