Class: Jax::Generators::PluginGenerator
Instance Method Summary
collapse
Methods included from Actions
#menu, #menu_choice, #overwrite, #prompt_yn, #say_option
Methods included from PluginBase
#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 included from SourceRoot
#source_root
included
Instance Method Details
#check_for_local_name_conflicts ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/generators/jax/plugin/plugin_generator.rb', line 38
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_relative_directory, :green
nil
end
if message
say_status :aborted, message, :yellow
exit
end
end
end
|
#check_for_remote_name_conflicts ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/generators/jax/plugin/plugin_generator.rb', line 12
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
57
58
59
60
|
# File 'lib/generators/jax/plugin/plugin_generator.rb', line 57
def create_manifest
Jax::Plugin::Manifest.new(name).save
say_status :create, File.join("vendor/plugins", name, 'manifest.yml')
end
|
#create_plugin_directory ⇒ Object
53
54
55
|
# File 'lib/generators/jax/plugin/plugin_generator.rb', line 53
def create_plugin_directory
directory "new_plugin", plugin_relative_directory
end
|