Class: FlyingSphinx::Tasks::Deprecated

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/flying_sphinx/tasks/deprecated.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(old_name, new_name) ⇒ Deprecated

Returns a new instance of Deprecated.



8
9
10
11
# File 'lib/flying_sphinx/tasks/deprecated.rb', line 8

def initialize(old_name, new_name)
  @old_name = old_name
  @new_name = new_name
end

Class Method Details

.call(old_name, new_name = nil) ⇒ Object



4
5
6
# File 'lib/flying_sphinx/tasks/deprecated.rb', line 4

def self.call(old_name, new_name = nil)
  new(old_name, new_name || old_name).call
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/flying_sphinx/tasks/deprecated.rb', line 13

def call
  namespace :fs do
    desc "Deprecated: Use ts:#{new_name} instead."
    task old_name do
      puts <<-MESSAGE
The task fs:#{old_name} is now deprecated. Please use the standard Thinking
Sphinx task instead: ts:#{new_name} (Thinking Sphinx tasks will now invoke the
appropriate behaviour for both local and Flying Sphinx environments).
      MESSAGE

      Rake::Task["ts:#{new_name}"].invoke
    end
  end
end