diff --git a/lib/pluginmanager/generate.rb b/lib/pluginmanager/generate.rb index 658ff395793..ccd0009ce79 100644 --- a/lib/pluginmanager/generate.rb +++ b/lib/pluginmanager/generate.rb @@ -4,6 +4,7 @@ require "erb" require "ostruct" require "fileutils" +require "pathname" class LogStash::PluginManager::Generate < LogStash::PluginManager::Command @@ -14,17 +15,17 @@ class LogStash::PluginManager::Generate < LogStash::PluginManager::Command arg end - option "--name", "PLUGIN", "Name of the new plugin" + option "--name", "PLUGIN", "Name of the new plugin", :required => true option "--path", "PATH", "Location where the plugin skeleton will be created", :default => Dir.pwd def execute source = File.join(File.dirname(__FILE__), "templates", "#{type}-plugin") - target_path = File.join(path, full_plugin_name) - FileUtils.mkdir(target_path) - puts " Creating #{target_path}" + @target_path = File.join(path, full_plugin_name) + FileUtils.mkdir(@target_path) + puts " Creating #{@target_path}" begin - create_scaffold(source, target_path) + create_scaffold(source, @target_path) rescue Errno::EACCES => exception report_exception("Permission denied when executing the plugin manager", exception) rescue => exception @@ -55,7 +56,7 @@ def transform_r(source, target) else FileUtils.cp(source_entry, target_entry) end - puts "\t create #{File.join(full_plugin_name, File.basename(target_entry))}" + puts "\t create #{File.join(full_plugin_name, Pathname.new(target_entry).relative_path_from(Pathname.new(@target_path)))}" end end end diff --git a/lib/pluginmanager/templates/filter-plugin/logstash-filter-example.gemspec.erb b/lib/pluginmanager/templates/filter-plugin/logstash-filter-example.gemspec.erb index ada485d36fb..5f910dc40fb 100644 --- a/lib/pluginmanager/templates/filter-plugin/logstash-filter-example.gemspec.erb +++ b/lib/pluginmanager/templates/filter-plugin/logstash-filter-example.gemspec.erb @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.licenses = ['Apache License (2.0)'] s.summary = 'TODO: Write a short summary, because Rubygems requires one.' s.description = 'TODO: Write a longer description or delete this line.' - s.homepage = 'TODO: Put your plugin's website or public repo URL here.' + s.homepage = 'TODO: Put your plugin''s website or public repo URL here.' s.authors = ['<%= author %>'] s.email = '<%= email %>' s.require_paths = ['lib'] diff --git a/lib/pluginmanager/templates/input-plugin/lib/logstash/inputs/example.rb.erb b/lib/pluginmanager/templates/input-plugin/lib/logstash/inputs/example.rb.erb index 5a7707c4717..176467ccb5c 100644 --- a/lib/pluginmanager/templates/input-plugin/lib/logstash/inputs/example.rb.erb +++ b/lib/pluginmanager/templates/input-plugin/lib/logstash/inputs/example.rb.erb @@ -9,7 +9,7 @@ require "socket" # for Socket.gethostname # This plugin is intented only as an example. class LogStash::Inputs::<%= classify(plugin_name) %> < LogStash::Inputs::Base - config_name "<%= @lugin_name %>" + config_name "<%= @plugin_name %>" # If undefined, Logstash will complain, even if codec is unused. default :codec, "plain" diff --git a/lib/pluginmanager/templates/input-plugin/logstash-input-example.gemspec.erb b/lib/pluginmanager/templates/input-plugin/logstash-input-example.gemspec.erb index 435fdcf875f..9f8543887b2 100644 --- a/lib/pluginmanager/templates/input-plugin/logstash-input-example.gemspec.erb +++ b/lib/pluginmanager/templates/input-plugin/logstash-input-example.gemspec.erb @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.licenses = ['Apache License (2.0)'] s.summary = 'TODO: Write a short summary, because Rubygems requires one.' s.description = '{TODO: Write a longer description or delete this line.' - s.homepage = 'TODO: Put your plugin's website or public repo URL here.' + s.homepage = 'TODO: Put your plugin''s website or public repo URL here.' s.authors = ['<%= author %>'] s.email = '<%= email %>' s.require_paths = ['lib'] diff --git a/lib/pluginmanager/templates/output-plugin/logstash-output-example.gemspec.erb b/lib/pluginmanager/templates/output-plugin/logstash-output-example.gemspec.erb index 1d8613225f2..db396e1ff1c 100644 --- a/lib/pluginmanager/templates/output-plugin/logstash-output-example.gemspec.erb +++ b/lib/pluginmanager/templates/output-plugin/logstash-output-example.gemspec.erb @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.licenses = ['Apache License (2.0)'] s.summary = 'TODO: Write a short summary, because Rubygems requires one.' s.description = 'TODO: Write a longer description or delete this line.' - s.homepage = 'TODO: Put your plugin's website or public repo URL here.' + s.homepage = 'TODO: Put your plugin''s website or public repo URL here.' s.authors = ['<%= author %>'] s.email = '<%= email %>' s.require_paths = ['lib']