rails_log_book 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 762b160793eb148f0dc0d98e1c3b255a9db8e14a
4
- data.tar.gz: b86ea86166f27fc36bd2e5d19490ef3a4c9d9798
3
+ metadata.gz: 67d0353c0e186e2a8264652e9f9c98deb83373bc
4
+ data.tar.gz: 9b95ba2e4073d819ade42d82b4f25db38936d53f
5
5
  SHA512:
6
- metadata.gz: 22149b6c8df55afa94045cd6ce4f21a3fcfee6f1bdb8b85621b9778e7a4ba3f073e649d9fa0ed27cd536bd7b9a926547a1eeb4ed8b14cb12ae0b5bdb86e986d2
7
- data.tar.gz: eec595a8e59e673c9b913346cf8f74e5f4fb391a0c0d77727ec970e67b7d667608ef5ea4ba81a65738010536e9b7e55ae2c9347a48de6dca52fd4b1375bddb55
6
+ metadata.gz: 56f0e225cab9b1f90cd07a20ce44461844b8f0ff46cbdd39e2b0b3c270f73fd2606dddea2f24b7fa995bb13d7f4fbbee1f019fe4b5cf9dfa3295b0a6313fd5d5
7
+ data.tar.gz: f5a82f48790adf8927013a4a4ab14ef42ed354ea924e65a6a3b137911a019cc6b52bf3136272ae0303ddbed9f752fb1885cb99263324c3e833aa980e14731fa5
@@ -0,0 +1,8 @@
1
+ module LogBook
2
+ class Railtie < Rails::Railtie
3
+ rake_tasks do
4
+ spec = Gem::Specification.find_by_name 'rails_log_book'
5
+ load "#{spec.gem_dir}/lib/tasks/log_book.rake"
6
+ end
7
+ end
8
+ end
@@ -9,6 +9,7 @@ module LogBook
9
9
  self.recording_options = options
10
10
 
11
11
  has_many :records, -> { order(created_at: :asc) }, as: :subject, class_name: 'LogBook::Record'
12
+ scope :with_records, -> { joins(:records) }
12
13
 
13
14
  on = Array.wrap(options[:on])
14
15
  after_create :create_record if on.empty? || on.include?(:create)
@@ -1,3 +1,3 @@
1
1
  module LogBook
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -6,6 +6,7 @@ require 'log_book/record'
6
6
  require 'log_book/recorder'
7
7
  require 'log_book/controller_record'
8
8
  require 'log_book/version'
9
+ require 'log_book/railtie'
9
10
 
10
11
  module LogBook
11
12
  class << self
@@ -0,0 +1,11 @@
1
+ namespace :log_book do
2
+ desc 'Update meta of CLASS'
3
+ task update_meta: :environment do
4
+ ENV['CLASS'].constantize.with_records.each do |model|
5
+ model.records.each do |record|
6
+ record.meta = record.meta.reverse_merge(model.log_book_meta(record).stringify_keys)
7
+ record.save
8
+ end
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_log_book
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-20 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -151,11 +151,13 @@ files:
151
151
  - lib/generators/log_book/templates/install.rb
152
152
  - lib/log_book/configuration.rb
153
153
  - lib/log_book/controller_record.rb
154
+ - lib/log_book/railtie.rb
154
155
  - lib/log_book/record.rb
155
156
  - lib/log_book/recorder.rb
156
157
  - lib/log_book/squash_records.rb
157
158
  - lib/log_book/version.rb
158
159
  - lib/rails_log_book.rb
160
+ - lib/tasks/log_book.rake
159
161
  - log_book.gemspec
160
162
  homepage: https://github.com/infinum/rails_log_book
161
163
  licenses: