lib/commands/resource.rb in spring-gen-0.1.3 vs lib/commands/resource.rb in spring-gen-0.2.0
- old
+ new
@@ -28,19 +28,20 @@
end
def create_model
@user_name = user_name
@user_email = user_email
- @package = config.group_id.split(".").each {|part| part.gsub!(/\W/,"")}.join(".")
- fs_path = @package.gsub(".","/")
+ @package = config.group_id.split('.').each {|part| part.gsub!(/\W/,'')}.join('.')
+ fs_path = @package.gsub('.','/')
@artifact_id = config.artifact_id
@full = options['full']
+ @licence = licence
case config.repository_technique
- when "jpa"
- @repository_import = "jpa.repository.JpaRepository"
+ when 'jpa'
+ @repository_import = 'jpa.repository.JpaRepository'
@repository_type = "JpaRepository<#{@model_name},Long>"
@entity_annotation = "@Entity"
@annotation_import = "import javax.persistence.Entity;"
template "templates/resource/test/integration/#{config.repository_technique}/sampleData.xml.erb",
"#{content_root}/src/test/resources/sampledata/#{@model_name.downcase}SampleData.xml"
@@ -61,10 +62,10 @@
raise ("not a suitable repository-technique.")
end
template "templates/resource/model/#{config.repository_technique.capitalize}BaseEntity.java.erb",
- "#{content_root}/src/main/java/#{fs_path}/model/BaseEntity.java"
+ "#{content_root}/src/main/java/#{fs_path}/model/BaseEntity.java" unless File.exist?("#{content_root}/src/main/java/#{fs_path}/model/BaseEntity.java")
template(
'templates/resource/model/Model.java.erb',
"#{content_root}/src/main/java/#{fs_path}/model/#{@model_name}.java")
template(
\ No newline at end of file