active_metadata 0.8.5 → 0.8.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -21
- data/lib/active_metadata/persistence/history.rb +1 -0
- data/lib/active_metadata/version.rb +1 -1
- data/lib/tasks/active_metadata_tasks.rake +19 -18
- data/spec/dummy/tmp/cache/.gitkeep +0 -0
- data/spec/lib/history_spec.rb +11 -0
- data/spec/support/migrations.rb +3 -0
- metadata +65 -23
data/Rakefile
CHANGED
@@ -4,30 +4,11 @@ begin
|
|
4
4
|
rescue LoadError
|
5
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
6
|
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'ActiveMetadata'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
|
-
load 'rails/tasks/engine.rake'
|
25
|
-
|
26
|
-
require 'ci/reporter/rake/rspec'
|
27
7
|
require 'rspec/core/rake_task'
|
28
8
|
require 'cucumber/rake/task'
|
29
|
-
RSpec::Core::RakeTask.new(:spec)
|
30
9
|
|
10
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
11
|
+
load 'rails/tasks/engine.rake'
|
31
12
|
|
32
13
|
Bundler::GemHelper.install_tasks
|
33
14
|
|
@@ -10,6 +10,7 @@ module ActiveMetadata::Persistence::History
|
|
10
10
|
return if ActiveMetadata.skip_history?
|
11
11
|
self.changes.each do |key, value|
|
12
12
|
# Do not go on in case if new and old values are nil
|
13
|
+
# https://github.com/rails/rails/issues/8874
|
13
14
|
return if value.compact.empty?
|
14
15
|
next if ActiveMetadata::CONFIG['history_skip_fields'].include?(key)
|
15
16
|
ActiveMetadata::History.create! :value => value[1],:model_class => metadata_class, :model_id => metadata_id,:label => key.to_s, :created_by => current_user_id
|
@@ -1,30 +1,31 @@
|
|
1
1
|
namespace :active_metadata do
|
2
|
+
|
2
3
|
namespace :ci do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
sh "mkdir -p spec/dummy/tmp/cache"
|
9
|
-
Rake::Task["app:db:create"].invoke
|
10
|
-
Rake::Task["app:db:migrate"].invoke
|
4
|
+
|
5
|
+
Rails.env = "test"
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec_run) do |t|
|
8
|
+
t.rspec_opts = ["-fp", "--format RspecJunitFormatter", "--out spec/reports/rspec.xml"]
|
11
9
|
end
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
Cucumber::Rake::Task.new(:cucumber_run) do |task|
|
12
|
+
format_output = ENV['CUCUMBER_FORMAT'] || 'progress'
|
13
|
+
task.cucumber_opts = ["--format #{format_output}", "--format junit", "--out features/reports", "--format html", "--out features/reports/cucumber.html"]
|
14
|
+
task.cucumber_opts.push("-p #{ENV['CUCUMBER_PROFILE']}") if ENV['CUCUMBER_PROFILE']
|
16
15
|
end
|
17
16
|
|
18
|
-
task :
|
19
|
-
|
20
|
-
Rake::Task["app:
|
17
|
+
task :rspec do :environment
|
18
|
+
rm_rf "spec/reports"
|
19
|
+
Rake::Task["app:active_metadata:ci:spec_run"].invoke
|
21
20
|
end
|
22
|
-
end
|
23
|
-
end
|
24
21
|
|
25
|
-
task
|
22
|
+
task :cucumber do :environment
|
23
|
+
Rake::Task["app:active_metadata:ci:cucumber_run"].invoke
|
24
|
+
end
|
26
25
|
|
27
|
-
|
26
|
+
end
|
27
|
+
|
28
|
+
task :ci => ["active_metadata:ci:rspec", "active_metadata:ci:cucumber"]
|
28
29
|
|
29
30
|
desc "Install the active_metadata gem requirements file ***TASK IS ON ALPHA STAGE***"
|
30
31
|
task :install do
|
File without changes
|
data/spec/lib/history_spec.rb
CHANGED
@@ -27,6 +27,17 @@ describe ActiveMetadata do
|
|
27
27
|
@document.history_for(:name)[0].created_at.should be_a_kind_of Time
|
28
28
|
end
|
29
29
|
|
30
|
+
it "should not save the history and send any notification if new value and old are both nil" do
|
31
|
+
# see
|
32
|
+
# https://github.com/rails/rails/issues/8874
|
33
|
+
@user = User.create!(:email => "email@email.it", :firstname => 'John', :lastname => 'smith')
|
34
|
+
ActiveMetadata::Watcher.create! :model_class => "Document", :label => :date, :owner_id => @user.id
|
35
|
+
@document.date = ""
|
36
|
+
@document.save
|
37
|
+
@document.notifier.should be_nil
|
38
|
+
@document.history_for(:date).should be_empty
|
39
|
+
end
|
40
|
+
|
30
41
|
it "should verify that history return records only for the self document" do
|
31
42
|
# fixtures
|
32
43
|
@another_doc = Document.create :name => "Andrea"
|
data/spec/support/migrations.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.5
|
4
|
+
version: 0.8.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,22 +10,27 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-01-10 00:00:00.
|
13
|
+
date: 2013-01-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- - =
|
20
|
+
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.2.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - '='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.2.10
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: sqlite3
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :development
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rspec-rails
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '0'
|
45
55
|
type: :development
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: sqlite3
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: cucumber-rails
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,10 +86,15 @@ dependencies:
|
|
66
86
|
version: '0'
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
72
|
-
requirement:
|
96
|
+
name: rspec_junit_formatter
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,10 +102,15 @@ dependencies:
|
|
77
102
|
version: '0'
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
81
111
|
- !ruby/object:Gem::Dependency
|
82
112
|
name: paperclip
|
83
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
84
114
|
none: false
|
85
115
|
requirements:
|
86
116
|
- - ! '>='
|
@@ -88,10 +118,15 @@ dependencies:
|
|
88
118
|
version: '0'
|
89
119
|
type: :runtime
|
90
120
|
prerelease: false
|
91
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
92
127
|
- !ruby/object:Gem::Dependency
|
93
128
|
name: mime-types
|
94
|
-
requirement:
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
95
130
|
none: false
|
96
131
|
requirements:
|
97
132
|
- - ! '>='
|
@@ -99,7 +134,12 @@ dependencies:
|
|
99
134
|
version: '0'
|
100
135
|
type: :runtime
|
101
136
|
prerelease: false
|
102
|
-
version_requirements:
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
103
143
|
description: First implementation will write metadata on mongodb
|
104
144
|
email:
|
105
145
|
- acampolonghi@gmail.com
|
@@ -205,6 +245,7 @@ files:
|
|
205
245
|
- spec/dummy/public/500.html
|
206
246
|
- spec/dummy/public/favicon.ico
|
207
247
|
- spec/dummy/script/rails
|
248
|
+
- spec/dummy/tmp/cache/.gitkeep
|
208
249
|
- spec/helpers/active_metadata/stream_helpers_spec.rb
|
209
250
|
- spec/lib/active_metadata_spec.rb
|
210
251
|
- spec/lib/attachments_spec.rb
|
@@ -237,7 +278,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
278
|
version: '0'
|
238
279
|
segments:
|
239
280
|
- 0
|
240
|
-
hash: -
|
281
|
+
hash: -2334406097981202284
|
241
282
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
283
|
none: false
|
243
284
|
requirements:
|
@@ -246,10 +287,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
287
|
version: '0'
|
247
288
|
segments:
|
248
289
|
- 0
|
249
|
-
hash: -
|
290
|
+
hash: -2334406097981202284
|
250
291
|
requirements: []
|
251
292
|
rubyforge_project: active_metadata
|
252
|
-
rubygems_version: 1.8.
|
293
|
+
rubygems_version: 1.8.24
|
253
294
|
signing_key:
|
254
295
|
specification_version: 3
|
255
296
|
summary: Add metadata to fields in an active record model
|
@@ -299,6 +340,7 @@ test_files:
|
|
299
340
|
- spec/dummy/public/500.html
|
300
341
|
- spec/dummy/public/favicon.ico
|
301
342
|
- spec/dummy/script/rails
|
343
|
+
- spec/dummy/tmp/cache/.gitkeep
|
302
344
|
- spec/helpers/active_metadata/stream_helpers_spec.rb
|
303
345
|
- spec/lib/active_metadata_spec.rb
|
304
346
|
- spec/lib/attachments_spec.rb
|