editstore 1.1.8 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTcyOGQ0NjQ0NzdiMDhmNWFiYjkxNjE4ZGI0OWQ1YWQxMWVhZDNiMg==
4
+ ODNlOTUwNGIyOGRhODk5ZDVkNjc0NDg3MzIyODA3ZDg0MzZhMDY1OQ==
5
5
  data.tar.gz: !binary |-
6
- YzJlY2U5NGY4ZGE5OWM2OThjZGYzYjdiYzdiMDAzYWI5NzU2Y2JlNw==
6
+ MzM0NTkzNjkzYWQ0ODA0MjM2MzI2OTUxNDZjMjQ1MjVhYmJjMDJjNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWYxZjcxMWE4ODZjMzRmNTE1NWUwYTQzNDRlYTY4NDdjZGQ0ZjMwZDcwZDkw
10
- NWIzN2Q1MmE2Njg3OGNmNDk1ZTFlZTBkNjE1ZDZlNGNhZDBhNDI3YjlhYzQ5
11
- NjQwYzRiYmU0YzQwYjVlYWJiNWU3ZjA2ZGVmOWVmM2QyODg4YjE=
9
+ Yzg1MDcxNzZmZDJlNjViN2U0Nzc4NDI2OWE5YjFkMjViMzA3NGZhOWY2ODdh
10
+ NzNmYWQ5OWU2NDZjMzEwODQ0NGNjZTAzZjgwN2YyNTliZmY1YmIzMmZjMjg0
11
+ MGU0Y2E1OTZkZDk1NDg2YTg1MTQzZDBiNTYwODU5NTYwNTg3MTM=
12
12
  data.tar.gz: !binary |-
13
- MWZjYWI5ZGNkMWE5OTZjNmIzNzliMTM1MGM2NDgzNDYwNjMwZmM0ZjFmNDc3
14
- NDdhN2UxODNhMzc0NDIxMzU5NDdjMGE0OTQ3YzAwODJkZjFiZWMxNDhlZDky
15
- OTIyM2UyYTU0M2JlMWJkZWQ0Yjc3MzIxMjVhZDZkMTQ1YTY5NmY=
13
+ NDBmZTZhOGI2Y2VjYzgwZDk0ZTc2NDBiYmYxOTEzNDM3OTg3MzFlMGI5ODU5
14
+ MGE1MzQ4MTk1NzBhNzBmNDU4YzkyYzVmMWZiYTE1OTM0Njk4ZDE5MGEyZmQ3
15
+ YTlmNmQ3ZjhhZTNiOTdiOWFjOGUxNjA2OWNkMTAxMzIzNjk4ZGE=
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ begin
4
4
  rescue LoadError
5
5
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
6
  end
7
+
7
8
  begin
8
9
  require 'rdoc/task'
9
10
  rescue LoadError
@@ -23,22 +24,15 @@ end
23
24
  APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
25
  load 'rails/tasks/engine.rake'
25
26
 
26
-
27
-
28
27
  Bundler::GemHelper.install_tasks
29
28
 
30
- require 'rake/testtask'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec)
31
31
 
32
- Rake::TestTask.new(:test) do |t|
33
- t.libs << 'lib'
34
- t.libs << 'test'
35
- t.pattern = 'test/**/*_test.rb'
36
- t.verbose = false
32
+ task :ci do
33
+ ENV['RAILS_ENV'] = "test"
34
+ Rake::Task["db:migrate"].invoke
35
+ Rake::Task["spec"].invoke
37
36
  end
38
37
 
39
-
40
- task :default => :test
41
-
42
- # DLSS specific stuff
43
- require 'dlss/rake/dlss_release'
44
- Dlss::Release.new
38
+ task :default => :ci
@@ -5,7 +5,11 @@ module Editstore
5
5
  belongs_to :state
6
6
  belongs_to :project
7
7
  belongs_to :object_lock, :primary_key=>:druid, :foreign_key=>:druid
8
- attr_accessible :field,:project_id,:old_value,:new_value,:operation,:client_note,:druid,:state_id,:error,:pending
8
+
9
+ # THESE REALLY BELONG IN THE CONTROLLER and are only necessary for mass assignment
10
+ # def change_params
11
+ # params.require(:change).permit(:field,:project_id,:old_value,:new_value,:operation,:client_note,:druid,:state_id,:error,:pending)
12
+ # end
9
13
 
10
14
  OPERATIONS=%w{create update delete}
11
15
 
@@ -29,7 +33,8 @@ module Editstore
29
33
 
30
34
  def self.by_project_id(project_id)
31
35
  if project_id.to_s.empty?
32
- scoped
36
+ #scoped
37
+ where(nil)
33
38
  else
34
39
  where(:project_id=>project_id)
35
40
  end
@@ -37,7 +42,8 @@ module Editstore
37
42
 
38
43
  def self.by_state_id(state_id)
39
44
  if state_id.to_s.empty?
40
- scoped
45
+ #scoped
46
+ where(nil)
41
47
  else
42
48
  where(:state_id=>state_id)
43
49
  end
@@ -52,7 +58,8 @@ module Editstore
52
58
  project_id=params[:project_id]
53
59
  druid=params[:druid]
54
60
 
55
- changes = scoped
61
+ #changes = scoped
62
+ changes = where(nil)
56
63
  changes = changes.includes(:project)
57
64
  changes = changes.where(:state_id=>state_id) if state_id != '*'
58
65
  changes = changes.where(:project_id=>project_id) if project_id
@@ -70,7 +77,8 @@ module Editstore
70
77
  limit=params[:limit]
71
78
  project_id=params[:project_id]
72
79
 
73
- changes = scoped
80
+ #changes = scoped
81
+ changes = where(nil)
74
82
  changes = changes.includes(:project)
75
83
  changes = changes.where(:state_id=>state_id) if state_id != '*'
76
84
  changes = changes.where(:project_id=>project_id) if project_id
@@ -1,6 +1,6 @@
1
1
  module Editstore
2
2
  class Connection < ActiveRecord::Base
3
3
  self.abstract_class = true
4
- establish_connection "editstore_#{Rails.env}"
4
+ establish_connection "editstore_#{Rails.env}".parameterize.underscore.to_sym
5
5
  end
6
6
  end
@@ -1,6 +1,10 @@
1
1
  module Editstore
2
2
  class Field < Connection
3
3
  belongs_to :project
4
- attr_accessible :project_id,:name
4
+
5
+ # THESE REALLY BELONG IN THE CONTROLLER and are only necessary for mass assignment
6
+ # def field_params
7
+ # params.require(:field).permit(:project_id,:name)
8
+ # end
5
9
  end
6
10
  end
@@ -1,6 +1,10 @@
1
1
  module Editstore
2
2
  class ObjectLock < Connection
3
- attr_accessible :locked, :druid
3
+
4
+ # THESE REALLY BELONG IN THE CONTROLLER and are only necessary for mass assignment
5
+ # def objectlock_params
6
+ # params.require(:objectlock).permit(:locked, :druid)
7
+ # end
4
8
 
5
9
  def self.prune_all
6
10
  self.destroy_all(:locked=>nil) # anything that is not locked
@@ -1,8 +1,14 @@
1
1
  module Editstore
2
2
  class Project < Connection
3
- has_many :changes, :dependent => :destroy
3
+
4
+ has_many :alterations, :dependent => :destroy, :foreign_key => :changes
4
5
  has_many :fields, :dependent => :destroy
5
- attr_accessible :name, :template
6
+
7
+ # THESE REALLY BELONG IN THE CONTROLLER and are only necessary for mass assignment
8
+ # def project_params
9
+ # params.require(:project).permit(:name, :template)
10
+ # end
11
+
6
12
  validates :name, presence: true
7
13
  validates :template, presence: true
8
14
  end
@@ -1,21 +1,30 @@
1
1
  module Editstore
2
2
  class RunLog < Connection
3
- attr_accessible :started,:ended,:total_druids,:total_changes,:num_errors,:num_pending,:note
3
+
4
+ # THESE REALLY BELONG IN THE CONTROLLER and are only necessary for mass assignment
5
+ # def runlog_params
6
+ # params.require(:runlog).permit(:started,:ended,:total_druids,:total_changes,:num_errors,:num_pending,:note)
7
+ # end
8
+
4
9
  def self.currently_running
5
10
  Editstore::RunLog.where(:ended=>nil).order('ended DESC')
6
11
  end
12
+
7
13
  def self.last_completed_run
8
14
  Editstore::RunLog.where('ended IS NOT NULL').order('ended DESC').limit(1).first
9
15
  end
16
+
10
17
  def self.prune
11
18
  self.where('updated_at < ?',1.day.ago).where('ended IS NULL').each {|obj| obj.destroy} # anything older than 1 day that is not marked as finished running (but must be crashed and not actually running)
12
19
  self.where('updated_at < ?',1.month.ago).each {|obj| obj.destroy} # anything older than 1 month
13
20
  self.where(:total_druids=>0).where('updated_at < ?',1.day.ago).each {|obj| obj.destroy} # anything older than 1 day with no activity
14
21
  self.where('total_changes = num_pending').where('updated_at < ?',1.day.ago).each {|obj| obj.destroy} # anything older than 1 day where all the changes are pending
15
22
  end
23
+
16
24
  def self.prune_all
17
25
  self.where('ended IS NOT NULL').each {|obj| obj.destroy} # anything that is done
18
26
  end
27
+
19
28
  end
20
29
  end
21
30
 
@@ -1,7 +1,13 @@
1
1
  module Editstore
2
2
  class State < Connection
3
- has_many :changes
4
- attr_accessible :name
3
+
4
+ has_many :alterations, :foreign_key => :changes #Using an alias and pointed to changes
5
+
6
+ # THESE REALLY BELONG IN THE CONTROLLER and are only necessary for mass assignment
7
+ # def editstore_params
8
+ # params.require(:editstore).permit(:name)
9
+ # end
10
+
5
11
  validates :name, presence: true
6
12
 
7
13
  # these helper methods allow you to easily refer to a particular state like this, with the query cached in the object:
@@ -1,3 +1,3 @@
1
1
  module Editstore
2
- VERSION = "1.1.8"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.13
19
+ version: '4.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.13
26
+ version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: druid-tools
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,48 +52,20 @@ dependencies:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: lyberteam-devel
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 1.0.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: 1.0.1
69
- - !ruby/object:Gem::Dependency
70
- name: lyberteam-gems-devel
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ! '>'
74
- - !ruby/object:Gem::Version
75
- version: 1.0.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ! '>'
81
- - !ruby/object:Gem::Version
82
- version: 1.0.0
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: rspec
85
57
  requirement: !ruby/object:Gem::Requirement
86
58
  requirements:
87
- - - ! '>='
59
+ - - ~>
88
60
  - !ruby/object:Gem::Version
89
- version: '0'
61
+ version: '3.0'
90
62
  type: :development
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
- - - ! '>='
66
+ - - ~>
95
67
  - !ruby/object:Gem::Version
96
- version: '0'
68
+ version: '3.0'
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: rspec-rails
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -146,14 +118,6 @@ files:
146
118
  - lib/editstore/version.rb
147
119
  - lib/tasks/editstore_tasks.rake
148
120
  - lib/validators/is_druid_validator.rb
149
- - test/editstore_test.rb
150
- - test/fixtures/editstore/editstore_fields.yml
151
- - test/fixtures/editstore/editstore_projects.yml
152
- - test/test_helper.rb
153
- - test/unit/editstore/change_test.rb
154
- - test/unit/editstore/field_test.rb
155
- - test/unit/editstore/project_test.rb
156
- - test/unit/editstore/state_test.rb
157
121
  homepage: ''
158
122
  licenses: []
159
123
  metadata: {}
@@ -178,12 +142,5 @@ signing_key:
178
142
  specification_version: 4
179
143
  summary: The editstore gem is used by client web applications (like Revs Digital Library)
180
144
  to stage changes to descriptive metadata in DOR
181
- test_files:
182
- - test/editstore_test.rb
183
- - test/fixtures/editstore/editstore_fields.yml
184
- - test/fixtures/editstore/editstore_projects.yml
185
- - test/test_helper.rb
186
- - test/unit/editstore/change_test.rb
187
- - test/unit/editstore/field_test.rb
188
- - test/unit/editstore/project_test.rb
189
- - test/unit/editstore/state_test.rb
145
+ test_files: []
146
+ has_rdoc:
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class EditstoreTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, Editstore
6
- end
7
- end
@@ -1,23 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- # This model initially had no columns defined. If you add columns to the
4
- # model remove the '{}' from the fixture names and add the columns immediately
5
- # below each fixture, per the syntax in the comments below
6
- #
7
- title:
8
- name: title
9
- project_id: 1 # generic
10
- created_at: <%=Time.now%>
11
- updated_at: <%=Time.now%>
12
-
13
- description:
14
- name: description
15
- project_id: 1 # generic
16
- created_at: <%=Time.now%>
17
- updated_at: <%=Time.now%>
18
-
19
- title_revs:
20
- name: title
21
- project_id: 2 # revs
22
- created_at: <%=Time.now%>
23
- updated_at: <%=Time.now%>
@@ -1,20 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
-
3
- # This model initially had no columns defined. If you add columns to the
4
- # model remove the '{}' from the fixture names and add the columns immediately
5
- # below each fixture, per the syntax in the comments below
6
- #
7
- generic:
8
- id: 1
9
- name: generic
10
- template: generic
11
- created_at: <%=Time.now%>
12
- updated_at: <%=Time.now%>
13
-
14
- revs:
15
- id: 2
16
- name: revs
17
- template: revs
18
- created_at: <%=Time.now%>
19
- updated_at: <%=Time.now%>
20
-
@@ -1,15 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- require File.expand_path("../spec/dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
-
7
- Rails.backtrace_cleaner.remove_silencers!
8
-
9
- # Load support files
10
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
-
12
- # Load fixtures from the engine
13
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Editstore
4
- class ChangeTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Editstore
4
- class FieldTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Editstore
4
- class ProjectTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Editstore
4
- class StateTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end