class Tennpipes::Generators::Plugin
Responsible for executing plugins instructions within a Tennpipes
project.
Constants
- PLUGIN_URL
Defines the default URL for official tennpipes recipe plugins.
Public Class Methods
source_root()
click to toggle source
# File lib/tennpipes-init/generators/plugin.rb, line 14 def self.source_root; File.expand_path(File.dirname(__FILE__)); end
Public Instance Methods
list_plugins()
click to toggle source
# File lib/tennpipes-init/generators/plugin.rb, line 50 def list_plugins plugins = {} uri = URI.parse(PLUGIN_URL) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == "https" http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.start do http.request_get(uri.path) do |res| plugins = res.body.scan(%r{/plugins/(\w+)_plugin.rb}).uniq end end say "Available plugins:", :green say plugins.map { |plugin| " - #{plugin}" }.join("\n") end
setup_plugin()
click to toggle source
# File lib/tennpipes-init/generators/plugin.rb, line 35 def setup_plugin if options[:list] || plugin_file.nil? list_plugins else # executing the plugin instructions self.destination_root = options[:root] if in_app_root? self.behavior = :revoke if options[:destroy] execute_runner(:plugin, plugin_file) else say "You are not at the root of a Tennpipes application! (config/boot.rb not found)" end end end