base_indexer 0.3.6 → 0.3.8

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
- MGZmODc0Mzc3MjgwNTc3ZDFmYjQ0Mzc3YWFhOTkxOWNjNTkyZjI3ZQ==
4
+ ODBjNWU5ODFlZjY4YmM2MmMxNzQ0YzY3OTJjZTAzNzg5MzkwYjQ1ZQ==
5
5
  data.tar.gz: !binary |-
6
- YTY1Y2M4NTY5YmYxYThkZDgwMGJmMDcxYjUyZGNkNDQxZTEwMmFjNw==
6
+ YzBlNWY5ZGNkZjU5MjdkMWYwZWY4NzI3Yjg3MjllMzQ5ODlmNzNhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGI0Mjk0NTZhMDE4ZjhhOWZmMjk0ZDA5N2Y1ZDlkMTY0OGY2YTIxNmY1YTc3
10
- YTM2YzVlMzJhNzg1YjZiZmYzMDU2ZjgwZjJiYTIxNjVlYTg0Mzc0ZThhM2Qz
11
- MjAwN2NmZDc3MGRlNmRhNGM3ODgwNDk5YmRiNDNiYWMyYWRjZDU=
9
+ YzQzMDRmMGQ0ZmY5NTAzYTdhNGNjZDBhY2U2NDhmZjU2MThkNjE0N2JmNDI4
10
+ MjMwMWIxNzg4ODU2NGI3MWI2NmQ5NmFhMDUwMDRhMmU4OTdlZjM5OTRkMDYy
11
+ OWEwNTlkYTZmNDQxZDViZTQ1YTc2MTI1MzRkMzY4MjA1M2JkN2M=
12
12
  data.tar.gz: !binary |-
13
- N2FjOGVjM2UwNGRhMmNmMWNiYzc0YTNhMDFkZjE5ZmU0YmQyNTc4NDA0YTZj
14
- YWE5M2EzZWEzMGRhMjYyNmY4ZGNmNGE4ZjBlODlkNWQ5MTEzODhiOWM2NzA4
15
- OGQ1ZGVlY2JhMmFkMmY4ZmRhZmJiYTBkM2MyNjA5YjZlOTZmZjc=
13
+ MTNiMzFlYWQzNzU0ZmQ4YmMzYmZhOWM5ZjYzMWNhNTU0NTRiN2Q2OGFjMmZk
14
+ M2YyMzE1YzhkNzhjZGMyYWJlNzFkMGJkYzVjOWM3YmNjNjk3N2UzNjE0NmYy
15
+ YjExMTk0OGUzNWY1ZGJhNDFjMTJkNzBlN2UwZTM4MmFhNjQ3YmQ=
@@ -71,3 +71,12 @@ rake reindexer RAILS_ENV=production target=revs_prod file=log/logfile.log
71
71
  nohup rake reindexer RAILS_ENV=production target=revs_prod file=log/logfile.log & # probably no need to nohup unless there were alot of errors
72
72
 
73
73
 
74
+ == Delete Druids
75
+
76
+ Delete a list of druids specified in a CSV/txt file. Be careful, this will delete from all targets! Put one druid per line, no header is necessary.
77
+
78
+ rake delete_druids RAILS_ENV=production file=druid_list.txt
79
+
80
+ Delete a single druid
81
+
82
+ rake delete RAILS_ENV=production druid=oo000oo0001
@@ -7,7 +7,7 @@ module BaseIndexer
7
7
 
8
8
  def version
9
9
 
10
- @result={:app_name=>Rails.configuration.app_name,:rails_env=>Rails.env,:version=>Rails.configuration.app_version,:last_restart=>(File.exists?('tmp/restart.txt') ? File.new('tmp/restart.txt').mtime : "n/a"),:last_deploy=>(File.exists?('REVISION') ? File.new('REVISION').mtime : "n/a")}
10
+ @result={:app_name=>Rails.configuration.app_name,:rails_env=>Rails.env,:version=>Rails.configuration.app_version,:last_restart=>(File.exists?('tmp/restart.txt') ? File.new('tmp/restart.txt').mtime : "n/a"),:last_deploy=>(File.exists?('REVISION') ? File.new('REVISION').mtime : "n/a"),:revision=>(File.exists?('REVISION') ? File.read('REVISION') : "n/a")}
11
11
  @result.update({:solr_cores=>BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash})
12
12
 
13
13
  respond_to do |format|
@@ -6,6 +6,7 @@
6
6
  <p>
7
7
  <strong>Last deployed time:</strong> <%=@result[:last_deploy]%><br />
8
8
  <strong>Current deployed version:</strong> <%=@result[:version]%><br />
9
+ <strong>Current deployed revision:</strong> <%=@result[:revision]%><br />
9
10
  <strong>Last restart time:</strong> <%=@result[:last_restart]%> <br />
10
11
  <strong>Registered SOLR cores: </strong> <%=@result[:solr_cores]%> <br />
11
12
  </p>
@@ -0,0 +1,4 @@
1
+ require 'is_it_working'
2
+ Rails.configuration.middleware.use(IsItWorking::Handler) do |h|
3
+
4
+ end
@@ -1,6 +1,7 @@
1
1
  BaseIndexer::Engine.routes.draw do
2
2
  root 'about#index'
3
3
  get 'about/version' => 'about#version'
4
+ get 'about' => 'about#version'
4
5
 
5
6
  post '/items/:druid', to: 'items#new'
6
7
  delete '/items/:druid', to: 'items#destroy'
@@ -1,3 +1,3 @@
1
1
  module BaseIndexer
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.8"
3
3
  end
@@ -62,7 +62,7 @@ task :log_indexer => :environment do |t, args|
62
62
  log my_logger,"** Indexing #{druids.size} druids from #{log_file_path} into solr server #{solr_server} (target=#{target}). Log file is of type #{log_type}."
63
63
  log my_logger,"Indexing started at #{start_time}"
64
64
 
65
- indexer = BaseIndexer::MainIndexerEngine.new
65
+ indexer = BaseIndexer.indexer_class.constantize.new
66
66
 
67
67
  counter=0
68
68
 
@@ -91,6 +91,28 @@ task :log_indexer => :environment do |t, args|
91
91
 
92
92
  end
93
93
 
94
+ desc "Delete a single druid. It will be deleted from all targets!"
95
+ #Run me: rake delete RAILS_ENV=production druid=oo000oo0001
96
+ # Examples:
97
+ task :delete => :environment do |t, args|
98
+
99
+ druid = ENV['druid']
100
+
101
+ raise 'You must specify a druid.' if druid.blank?
102
+
103
+ print "Are you sure you wish to delete this druid from all targets? (y/n) "
104
+ STDOUT.flush
105
+ answer=STDIN.gets.chomp
106
+
107
+ raise 'STOP!' unless (answer && ['y','yes'].include?(answer.downcase))
108
+
109
+ puts "** Delete #{druid} druid from all targets."
110
+
111
+ indexer = BaseIndexer.indexer_class.constantize.new
112
+ indexer.delete druid.gsub('druid:','')
113
+
114
+ end
115
+
94
116
  desc 'Index a single druid. Specify target to index into and druid to index.'
95
117
  #Run me: rake index RAILS_ENV=production target=revs_prod druid=oo000oo0001
96
118
  # Examples:
@@ -109,7 +131,7 @@ task :index => :environment do |t, args|
109
131
 
110
132
  puts "** Indexing #{druid} druid into solr server #{solr_server} (target=#{target})."
111
133
 
112
- indexer = BaseIndexer::MainIndexerEngine.new
134
+ indexer = BaseIndexer.indexer_class.constantize.new
113
135
  indexer.index(druid.gsub('druid:',''),[target])
114
136
 
115
137
  end
@@ -138,7 +160,7 @@ task :collection_indexer => :environment do |t, args|
138
160
  start_time=Time.now
139
161
  log my_logger,"Indexing started at #{start_time}"
140
162
 
141
- indexer = BaseIndexer::MainIndexerEngine.new
163
+ indexer = BaseIndexer.indexer_class.constantize.new
142
164
 
143
165
  df = DorFetcher::Client.new({:service_url => Rails.application.config.dor_fetcher_url})
144
166
 
@@ -208,7 +230,7 @@ task :reindexer => :environment do |t, args|
208
230
  log my_logger,"** Indexing errored out druids from #{file_path} into solr server #{solr_server} (target=#{target})."
209
231
  log my_logger,"Indexing started at #{start_time}"
210
232
 
211
- indexer = BaseIndexer::MainIndexerEngine.new
233
+ indexer = BaseIndexer.indexer_class.constantize.new
212
234
 
213
235
  counter=0
214
236
 
@@ -271,7 +293,7 @@ task :delete_druids => :environment do |t, args|
271
293
  log my_logger,"** Deleting druids from #{file_path} in all targets."
272
294
  log my_logger,"Deleting started at #{start_time}"
273
295
 
274
- indexer = BaseIndexer::MainIndexerEngine.new
296
+ indexer = BaseIndexer.indexer_class.constantize.new
275
297
 
276
298
  counter=0
277
299
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base_indexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed Alsum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-28 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ! '>='
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: is_it_working-cbeer
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: sqlite3
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -216,6 +230,7 @@ files:
216
230
  - app/views/base_indexer/items/destroy.json.erb
217
231
  - app/views/base_indexer/items/new.json.erb
218
232
  - config/initializers/base_indexer.rb
233
+ - config/initializers/is_it_working.rb
219
234
  - config/routes.rb
220
235
  - lib/base_indexer.rb
221
236
  - lib/base_indexer/collection.rb