Class: PluginGenerator
- Inherits:
-
VraptorScaffold::Base
- Object
- Thor::Group
- VraptorScaffold::Base
- PluginGenerator
- Defined in:
- lib/vraptor-scaffold/generators/plugin/plugin_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(args, opts = []) ⇒ PluginGenerator
constructor
A new instance of PluginGenerator.
- #is_ivy? ⇒ Boolean
- #is_maven? ⇒ Boolean
Constructor Details
#initialize(args, opts = []) ⇒ PluginGenerator
Returns a new instance of PluginGenerator.
15 16 17 18 19 |
# File 'lib/vraptor-scaffold/generators/plugin/plugin_generator.rb', line 15 def initialize(args, opts=[]) super([args], opts) @version = [:version] @group = [:group] end |
Class Method Details
.banner ⇒ Object
11 12 13 |
# File 'lib/vraptor-scaffold/generators/plugin/plugin_generator.rb', line 11 def self. "vraptor plugin #{self.arguments.map(&:usage).join(' ')} [options]" end |
Instance Method Details
#build ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vraptor-scaffold/generators/plugin/plugin_generator.rb', line 21 def build if is_ivy? plugin = "\n\t\t<dependency org=\"#{@group}\" name=\"#{name}\" rev=\"#{@version}\" conf=\"default\" />" inject_into_file("ivy.xml", plugin, :after => "<dependencies>") elsif is_maven? plugin = "\n\t\t<dependency>\n\t\t\t<groupId>#{@group}</groupId>\n\t\t\t<artifactId>#{name}</artifactId>\n\t\t\t<version>#{@version}</version>\n\t\t</dependency>" inject_into_file("pom.xml", plugin, :after => "<dependencies>") else plugin = "\n compile group: '#{@group}', name: '#{name}', version: '#{@version}'\n" inject_into_file("build.gradle", plugin, :after => "dependencies {") end end |
#is_ivy? ⇒ Boolean
34 35 36 |
# File 'lib/vraptor-scaffold/generators/plugin/plugin_generator.rb', line 34 def is_ivy? File.exist?("ivy.xml") end |
#is_maven? ⇒ Boolean
38 39 40 |
# File 'lib/vraptor-scaffold/generators/plugin/plugin_generator.rb', line 38 def is_maven? File.exist?("pom.xml") end |