Class: TheLocal::Generators::ProviderGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- TheLocal::Generators::ProviderGenerator
- Defined in:
- lib/generators/the_local/provider_generator.rb
Constant Summary collapse
- GEMFILE_LINE =
%(gem "the_local")- RAKEFILE_REQUIRE =
%(require "the_local/rake")
Instance Method Summary collapse
- #add_to_gemfile ⇒ Object
- #announce_next_step ⇒ Object
- #hook_check_task_into_rakefile ⇒ Object
- #relocate_to_gem_root ⇒ Object
Instance Method Details
#add_to_gemfile ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/the_local/provider_generator.rb', line 24 def add_to_gemfile return if gem_name == "the_local" gemfile = File.join(destination_root, "Gemfile") return unless File.exist?(gemfile) return if File.read(gemfile).include?(GEMFILE_LINE) append_to_file "Gemfile", "\n#{GEMFILE_LINE}\n" end |
#announce_next_step ⇒ Object
19 20 21 22 |
# File 'lib/generators/the_local/provider_generator.rb', line 19 def announce_next_step say "Declare this gem's public interface in the_local/interface.yml, then " \ "run `rake the_local:author` to write its locals into the_local/agents/." end |
#hook_check_task_into_rakefile ⇒ Object
34 35 36 37 38 39 |
# File 'lib/generators/the_local/provider_generator.rb', line 34 def hook_check_task_into_rakefile return unless File.exist?(File.join(destination_root, "Rakefile")) return if File.read(File.join(destination_root, "Rakefile")).include?(RAKEFILE_REQUIRE) append_to_file "Rakefile", "\n#{RAKEFILE_REQUIRE}\n" end |
#relocate_to_gem_root ⇒ Object
15 16 17 |
# File 'lib/generators/the_local/provider_generator.rb', line 15 def relocate_to_gem_root self.destination_root = gem_root end |