Class: Jax::Generators::Plugin::PluginGenerator
Instance Method Summary
collapse
#menu, #menu_choice, #overwrite, #prompt_yn, #say_option
#each_plugin, #extract_hash_from_response, #find_plugin_list, #get_remote_plugins_matching, #installed_plugin_manifests, #installed_plugins, #load_or_infer_manifest, #matching_plugins, #plugin_version, #rest_resource, #search, #search_query_rx
Methods inherited from Command
inherited
Methods included from Usage
extended, included
Instance Method Details
#check_for_local_name_conflicts ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/jax/generators/plugin/plugin_generator.rb', line 41
def check_for_local_name_conflicts
if File.directory? plugin_base_directory
message = catch(:aborted) do
prompt_yn("'#{name}' conflicts with another installed plugin of the same name. Overwrite?")
FileUtils.rm_rf plugin_base_directory
say_status :remove, plugin_base_directory, :green
nil
end
if message
say_status :aborted, message, :yellow
exit
end
end
end
|
#check_for_remote_name_conflicts ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/jax/generators/plugin/plugin_generator.rb', line 15
def check_for_remote_name_conflicts
return if options[:local]
message = catch :aborted do
begin
plugins = find_plugin_list get_remote_plugins_matching(name)
if plugins.length == 1 && (plugin = plugins.shift)['name'].downcase == name.downcase
say "A plugin named '#{name}' would conflict with an existing upstream plugin called '#{plugin['name']}'."
prompt_yn "Attempts to publish your plugin will be rejected. Are you sure you wish to proceed?"
end
rescue RestClient::Exception, Errno::ECONNREFUSED
say $!.message
say ""
say "An error occurred while checking for conflicting plugin names. If"
say "a plugin named '#{name}' already exists, you will not be able to"
say "publish your plugin until it is renamed."
prompt_yn "Do you wish to continue? "
end
nil
end
if message
say_status :aborted, message, :yellow
exit
end
end
|
#create_manifest ⇒ Object
60
61
62
63
|
# File 'lib/jax/generators/plugin/plugin_generator.rb', line 60
def create_manifest
Jax::Plugin::Manifest.new(name).save
say_status :create, File.join("vendor/plugins", name, 'manifest.yml')
end
|
#create_plugin_directory ⇒ Object
56
57
58
|
# File 'lib/jax/generators/plugin/plugin_generator.rb', line 56
def create_plugin_directory
directory "new_plugin", plugin_base_directory
end
|