Class: Maven::Gwt::Generator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/maven/gwt/generator.rb

Instance Method Summary collapse

Instance Method Details

#application_class_nameObject



56
57
58
# File 'lib/maven/gwt/generator.rb', line 56

def application_class_name
  @application_name ||= camelize( application_name )
end

#application_nameObject



48
49
50
# File 'lib/maven/gwt/generator.rb', line 48

def application_name
  @application_name ||= File.basename( @basedir )
end

#application_name_humanizedObject



52
53
54
# File 'lib/maven/gwt/generator.rb', line 52

def application_name_humanized
  @application_name_humanized ||= application_name.split( /_/ ).collect{ |p| p.capitalize }.join( ' ' )
end

#base_packageObject



36
37
38
# File 'lib/maven/gwt/generator.rb', line 36

def base_package
  @base_package ||= @java_package + '.client'
end

#basedirObject



40
41
42
# File 'lib/maven/gwt/generator.rb', line 40

def basedir
  @basedir ||= File.join( layout.java_root, *@java_package.split( /\./ ) )
end

#camelize(str) ⇒ Object



60
61
62
# File 'lib/maven/gwt/generator.rb', line 60

def camelize( str )
  str.split( "_" ).collect { |s| s.capitalize }.join
end

#clientdirObject



44
45
46
# File 'lib/maven/gwt/generator.rb', line 44

def clientdir
  @clientdir ||= File.join( basedir, 'client' )
end

#layoutObject



32
33
34
# File 'lib/maven/gwt/generator.rb', line 32

def layout
  @layout ||= Layout.new
end

#setup(java_package, app_name = nil) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/maven/gwt/generator.rb', line 64

def setup( java_package, app_name = nil )
  @java_package = java_package
  @application_name = app_name
  template( 'Module.gwt.xml',
            "#{basedir}/#{application_class_name}.gwt.xml" )
  template( 'ModuleDevelopment.gwt.xml',
            "#{basedir}/#{application_class_name}Development.gwt.xml" )
  template( 'EntryPoint.java', 
            "#{clientdir}/#{application_class_name}EntryPoint.java" )
  template( 'Application.java', 
            "#{clientdir}/#{application_class_name}Application.java" )
  template( 'Application.ui.xml', 
            "#{clientdir}/#{application_class_name}Application.ui.xml" )
  template( 'index.html',
            'public/index.html' )
  template( 'gwt.css',
            "public/#{application_name}.css" )
  
end