Class: RbsDevise::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- RbsDevise::RakeTask
- Defined in:
- lib/rbs_devise/rake_task.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#signature_root_dir ⇒ Object
Returns the value of attribute signature_root_dir.
Instance Method Summary collapse
- #define_generate_task ⇒ Object
- #define_setup_task ⇒ Object
-
#initialize(name = :"rbs:devise", &block) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(name = :"rbs:devise", &block) ⇒ RakeTask
Returns a new instance of RakeTask.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rbs_devise/rake_task.rb', line 9 def initialize(name = :"rbs:devise", &block) super() @name = name @signature_root_dir = Rails.root / "sig/devise" block&.call(self) define_generate_task define_setup_task end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/rbs_devise/rake_task.rb', line 7 def name @name end |
#signature_root_dir ⇒ Object
Returns the value of attribute signature_root_dir.
7 8 9 |
# File 'lib/rbs_devise/rake_task.rb', line 7 def signature_root_dir @signature_root_dir end |
Instance Method Details
#define_generate_task ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rbs_devise/rake_task.rb', line 28 def define_generate_task desc "Generate a RBS file for Devise" task("#{name}:generate": :environment) do require "rbs_devise" # load RbsDevise lazily next unless RbsDevise::Devise.available? signature_root_dir.mkpath (signature_root_dir / "devise.rbs").write RbsDevise::Devise.generate end end |
#define_setup_task ⇒ Object
21 22 23 24 25 26 |
# File 'lib/rbs_devise/rake_task.rb', line 21 def define_setup_task desc "Run all tasks of rbs_devise" deps = [:"#{name}:generate"] task("#{name}:setup" => deps) end |