spring-gen 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/commands/resource.rb +6 -5
  3. data/lib/commands/service.rb +14 -13
  4. data/lib/templates/layout/build.gradle.erb +1 -14
  5. data/lib/templates/layout/{intellij/config → config}/checkstyle/checkstyle.xml +0 -0
  6. data/lib/templates/layout/src/java/config/AppConfig.java.erb +1 -15
  7. data/lib/templates/layout/src/java/main/App.java.erb +1 -15
  8. data/lib/templates/licence.erb +12 -0
  9. data/lib/templates/resource/assembler/Assembler.java.erb +1 -14
  10. data/lib/templates/resource/assembler/BaseAssembler.java.erb +1 -14
  11. data/lib/templates/resource/controller/BaseController.java.erb +1 -14
  12. data/lib/templates/resource/controller/Controller.java.erb +1 -14
  13. data/lib/templates/resource/model/JpaBaseEntity.java.erb +1 -14
  14. data/lib/templates/resource/model/Model.java.erb +1 -14
  15. data/lib/templates/resource/model/MongodbBaseEntity.java.erb +2 -14
  16. data/lib/templates/resource/model/Neo4jBaseEntity.java.erb +1 -14
  17. data/lib/templates/resource/repository/Repository.java.erb +1 -14
  18. data/lib/templates/resource/resource/Resource.java.erb +1 -14
  19. data/lib/templates/resource/test/TestUtil.java.erb +1 -14
  20. data/lib/templates/resource/test/integration/jpa/IntegrationTest.java.erb +2 -14
  21. data/lib/templates/resource/test/integration/jpa/IntegrationTestConfig.java.erb +1 -14
  22. data/lib/templates/resource/test/integration/jpa/sampleData.xml.erb +0 -14
  23. data/lib/templates/resource/test/integration/mongodb/IntegrationTest.java.erb +2 -14
  24. data/lib/templates/resource/test/integration/mongodb/IntegrationTestConfig.java.erb +1 -14
  25. data/lib/templates/resource/test/integration/mongodb/SampleData.java.erb +1 -14
  26. data/lib/templates/resource/test/integration/neo4j/IntegrationTest.java.erb +2 -14
  27. data/lib/templates/resource/test/integration/neo4j/IntegrationTestConfig.java.erb +1 -14
  28. data/lib/templates/resource/test/integration/neo4j/SampleData.java.erb +1 -14
  29. data/lib/templates/resource/test/unit/assembler/AssemblerUnitTest.java.erb +1 -14
  30. data/lib/templates/resource/test/unit/assembler/AssemblerUnitTestConfig.java.erb +1 -14
  31. data/lib/templates/resource/test/unit/controller/ControllerUnitTest.java.erb +2 -14
  32. data/lib/templates/resource/test/unit/controller/ControllerUnitTestConfig.java.erb +1 -15
  33. data/lib/util.rb +18 -3
  34. data/lib/{spring-gen/version.rb → version.rb} +1 -1
  35. data/spring-gen.gemspec +1 -1
  36. metadata +5 -9
  37. data/lib/spring-gen.rb +0 -5
  38. data/lib/templates/layout/intellij/config/codestyle/Codestyle.xml +0 -34
  39. data/lib/templates/layout/intellij/config/copyright/gnu.xml +0 -6
  40. data/lib/templates/layout/intellij/config/copyright/profiles_settings.xml +0 -10
  41. data/lib/templates/resource/exception/NotCreatedException.java.erb +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 687798e9061535dd0147c89cbce77476c83eaf52
4
- data.tar.gz: 79a5513cfeec4a6e179c56881e500254a9dfc7f1
3
+ metadata.gz: d7b89b76034affdf78a9f2d29b213598f544d8e9
4
+ data.tar.gz: ae76a6c39cc1421b841b7b4fb93de183ac5e764b
5
5
  SHA512:
6
- metadata.gz: d300b2b9e5ac0c1dac2f45a15903ad4ca5426993e08f5a612601c1e9b2e5e0846e6da0d9e9db54da1dcde4410d5ae7b9c269662b9cbeeed059620ed2e9beaef8
7
- data.tar.gz: c25a808146b5bd7045d7652ba2b9b906d84ac2b32e058d7ee8698279ef466a4a6ffee91f2c91b7dc4930e114e81769b6d281f635b07888ebc42fd7787b842850
6
+ metadata.gz: 6762eeef8205bb121d6146bdce0754e942f83a8dab86c24a8e3bec720d4602990642bd8aaf543bb5e1defbad26c0dcb30382792572637839359b512c996ed5fd
7
+ data.tar.gz: 338d444426092a65beace1a9f16fc12414e77eb554fe177ff946b35663356082023284e56959e4ad59ed5fde68a10a3adc75398f841c51535a6a196f70e4745b
@@ -30,15 +30,16 @@ class Resource < Thor::Group
30
30
  def create_model
31
31
  @user_name = user_name
32
32
  @user_email = user_email
33
- @package = config.group_id.split(".").each {|part| part.gsub!(/\W/,"")}.join(".")
34
- fs_path = @package.gsub(".","/")
33
+ @package = config.group_id.split('.').each {|part| part.gsub!(/\W/,'')}.join('.')
34
+ fs_path = @package.gsub('.','/')
35
35
  @artifact_id = config.artifact_id
36
36
  @full = options['full']
37
+ @licence = licence
37
38
 
38
39
 
39
40
  case config.repository_technique
40
- when "jpa"
41
- @repository_import = "jpa.repository.JpaRepository"
41
+ when 'jpa'
42
+ @repository_import = 'jpa.repository.JpaRepository'
42
43
  @repository_type = "JpaRepository<#{@model_name},Long>"
43
44
  @entity_annotation = "@Entity"
44
45
  @annotation_import = "import javax.persistence.Entity;"
@@ -63,7 +64,7 @@ class Resource < Thor::Group
63
64
 
64
65
 
65
66
  template "templates/resource/model/#{config.repository_technique.capitalize}BaseEntity.java.erb",
66
- "#{content_root}/src/main/java/#{fs_path}/model/BaseEntity.java"
67
+ "#{content_root}/src/main/java/#{fs_path}/model/BaseEntity.java" unless File.exist?("#{content_root}/src/main/java/#{fs_path}/model/BaseEntity.java")
67
68
  template(
68
69
  'templates/resource/model/Model.java.erb',
69
70
  "#{content_root}/src/main/java/#{fs_path}/model/#{@model_name}.java")
@@ -1,10 +1,12 @@
1
1
  require 'thor/group'
2
2
  require 'thor'
3
3
  require 'git'
4
+ require 'erb'
4
5
 
5
6
 
6
7
  class Service < Thor::Group
7
8
  include Thor::Actions
9
+ include Util
8
10
 
9
11
  argument :name, :type => :string, :desc => 'Microservice name'
10
12
 
@@ -25,30 +27,29 @@ class Service < Thor::Group
25
27
  @package = @group_id.split(".").each {|part| part.gsub!(/\W/,"")}.join(".")
26
28
  end
27
29
 
30
+
31
+ def prepare_project
32
+ @repository_technique = options['repository_technique'] || 'jpa'
33
+ copy_file 'templates/licence.erb',"#{@name}/.spring-gen/licence.erb"
34
+ template 'templates/service.yml.erb',"#{@name}/.spring-gen/service.yml"
35
+ directory 'templates/layout/config',"#{@name}/config"
36
+ copy_file 'templates/layout/.gitignore',"#{@name}/.gitignore"
37
+ end
38
+
28
39
  def init_git
29
40
  g = Git.init @name
30
41
  @user_name = g.config['user.name']
31
42
  @user_email = g.config['user.email']
32
43
  end
33
44
 
34
- # TODO evtl. für andere entwicklugnsumgebungen erweitern.
35
-
36
- def create_layout
37
-
38
- @repository_technique = options['repository_technique'] || 'jpa'
39
-
40
- #TODO templates vervollständigen.
41
- directory 'templates/layout/intellij/config',"#{@name}/config"
42
-
45
+ def add_sources
46
+ Dir.chdir(@name) {@licence = licence}
43
47
  template 'templates/layout/src/java/main/App.java.erb',"#{@name}/src/main/java/#{@group_id.gsub(".","/")}/main/App.java"
44
48
  template 'templates/layout/src/java/config/AppConfig.java.erb',"#{@name}/src/main/java/#{@group_id.gsub(".","/")}/config/AppConfig.java"
45
- copy_file 'templates/layout/.gitignore',"#{@name}/.gitignore"
46
49
  template 'templates/layout/src/resources/application.yml.erb',"#{@name}/src/main/resources/application.yml"
47
50
  template 'templates/layout/src/resources/bootstrap.yml.erb',"#{@name}/src/main/resources/bootstrap.yml"
48
51
  template 'templates/layout/build.gradle.erb',"#{@name}/build.gradle"
49
- template 'templates/service.yml.erb',"#{@name}/service.yml"
50
- end
51
-
52
52
 
53
+ end
53
54
 
54
55
  end
@@ -1,17 +1,4 @@
1
- /*
2
- * Copyright (c) 2015 <%=@user_name%>.
3
- * This program is free software; you can redistribute it and/or modify
4
- * it under the terms of the GNU General Public License as published by
5
- * the Free Software Foundation; either version 3 of the License, or
6
- * (at your option) any later version.
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- * You should have received a copy of the GNU General Public License
12
- * along with this program; if not, write to the Free Software Foundation,
13
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14
- */
1
+ <%=@licence%>
15
2
 
16
3
  buildscript {
17
4
  repositories {
@@ -1,20 +1,6 @@
1
1
  package <%=@package%>.config;
2
2
 
3
-
4
- /*
5
- * Copyright (c) 2015 <%=@user_name%>.
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 3 of the License, or
9
- * (at your option) any later version.
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software Foundation,
16
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
- */
3
+ <%=@licence%>
18
4
 
19
5
  <%if @repository_technique == "jpa"-%>
20
6
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@@ -1,20 +1,6 @@
1
1
  package <%=@package%>.main;
2
2
 
3
-
4
- /*
5
- * Copyright (c) 2015 <%=@user_name%>.
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 3 of the License, or
9
- * (at your option) any later version.
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software Foundation,
16
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
- */
3
+ <%=@licence%>
18
4
 
19
5
  import org.springframework.boot.CommandLineRunner;
20
6
  import org.springframework.boot.SpringApplication;
@@ -0,0 +1,12 @@
1
+ Copyright (c) <%=Time.now.year%> <%=@user_name%>.
2
+ This program is free software; you can redistribute it and/or modify
3
+ it under the terms of the GNU General Public License as published by
4
+ the Free Software Foundation; either version 3 of the License, or
5
+ (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful,
7
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
8
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
+ GNU General Public License for more details.
10
+ You should have received a copy of the GNU General Public License
11
+ along with this program; if not, write to the Free Software Foundation,
12
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.assembler;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
19
6
  import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.assembler;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.model.BaseEntity;
19
6
  import org.springframework.beans.factory.annotation.Autowired;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.controller;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.exception.NotCreatedException;
19
6
  import <%=@package%>.model.BaseEntity;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.controller;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.assembler.<%=@model_name%>Assembler;
19
6
  import <%=@package%>.model.<%=@model_name%>;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.model;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import org.springframework.hateoas.Identifiable;
19
6
 
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.model;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  <%=@annotation_import%>
19
6
 
@@ -1,19 +1,7 @@
1
1
  package <%=@package%>.model;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
4
+
17
5
  import org.springframework.hateoas.Identifiable;
18
6
  /**
19
7
  * A mongodb-base entity.
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.model;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import com.fasterxml.jackson.annotation.JsonIdentityInfo;
19
6
  import com.fasterxml.jackson.annotation.JsonInclude;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.repository;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.model.<%=@model_name%>;
19
6
  import org.springframework.stereotype.Repository;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.resource;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.model.<%=@model_name%>;
19
6
  import org.springframework.hateoas.ResourceSupport;
@@ -1,19 +1,6 @@
1
1
  package util;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import com.fasterxml.jackson.core.JsonProcessingException;
19
6
  import com.fasterxml.jackson.databind.ObjectMapper;
@@ -1,18 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>.routes;
2
- /*
3
- * Copyright (c) 2015 <%=@user_name%>.
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 3 of the License, or
7
- * (at your option) any later version.
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software Foundation,
14
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
- */
2
+
3
+ <%=@licence%>
16
4
 
17
5
  import static org.hamcrest.Matchers.hasSize;
18
6
  import static org.hamcrest.Matchers.is;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
19
6
  import org.springframework.boot.orm.jpa.EntityScan;
@@ -1,17 +1,3 @@
1
- <!--
2
- ~ Copyright (c) 2015 <%=@user_name%>.
3
- ~ This program is free software; you can redistribute it and/or modify
4
- ~ it under the terms of the GNU General Public License as published by
5
- ~ the Free Software Foundation; either version 3 of the License, or
6
- ~ (at your option) any later version.
7
- ~ This program is distributed in the hope that it will be useful,
8
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- ~ GNU General Public License for more details.
11
- ~ You should have received a copy of the GNU General Public License
12
- ~ along with this program; if not, write to the Free Software Foundation,
13
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14
- -->
15
1
 
16
2
  <dataset>
17
3
  <%10.times do |i|%>
@@ -1,18 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
- /*
3
- * Copyright (c) 2015 <%=@user_name%>.
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 3 of the License, or
7
- * (at your option) any later version.
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software Foundation,
14
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
- */
2
+
3
+ <%=@licence%>
16
4
 
17
5
  import static org.hamcrest.Matchers.hasSize;
18
6
  import static org.hamcrest.Matchers.is;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import com.github.fakemongo.Fongo;
19
6
  import com.mongodb.Mongo;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.model.<%=@model_name%>;
19
6
  import org.springframework.beans.factory.annotation.Autowired;
@@ -1,18 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
- /*
3
- * Copyright (c) 2015 <%=@user_name%>.
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 3 of the License, or
7
- * (at your option) any later version.
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software Foundation,
14
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
- */
2
+
3
+ <%=@licence%>
16
4
 
17
5
  import static org.hamcrest.Matchers.hasSize;
18
6
  import static org.hamcrest.Matchers.is;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
19
6
  import org.springframework.boot.orm.jpa.EntityScan;
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.integration.<%=@model_name.downcase%>;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  public class SampleData {
19
6
 
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.unit.<%=@model_name.downcase%>.assembler;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
3
+ <%=@licence%>
17
4
 
18
5
  import static org.junit.Assert.assertEquals;
19
6
 
@@ -1,19 +1,6 @@
1
1
  package <%=@package%>.unit.<%=@model_name.downcase%>.assembler;
2
- /*
3
- * Copyright (c) 2015 <%=@user_name%>.
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 3 of the License, or
7
- * (at your option) any later version.
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software Foundation,
14
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
- */
16
2
 
3
+ <%=@licence%>
17
4
 
18
5
  import <%=@package%>.assembler.<%=@model_name%>Assembler;
19
6
  import org.mockito.Mockito;
@@ -1,18 +1,6 @@
1
1
  package <%=@package%>.unit.<%=@model_name.downcase%>.controller;
2
- /*
3
- * Copyright (c) 2015 <%=@user_name%>.
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 3 of the License, or
7
- * (at your option) any later version.
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software Foundation,
14
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
- */
2
+
3
+ <%=@licence%>
16
4
 
17
5
  import static org.junit.Assert.assertEquals;
18
6
  import static org.mockito.Matchers.any;
@@ -1,20 +1,6 @@
1
1
  package <%=@package%>.unit.<%=@model_name.downcase%>.controller;
2
2
 
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
17
-
3
+ <%=@licence%>
18
4
 
19
5
  import <%=@package%>.assembler.<%=@model_name%>Assembler;
20
6
  import <%=@package%>.repository.<%=@model_name%>Repository;
data/lib/util.rb CHANGED
@@ -1,30 +1,45 @@
1
1
  require 'yaml'
2
+ require 'erb'
2
3
 
3
4
  module Util
4
5
  Config = Struct.new(:service_name,:repository_technique,:group_id,:artifact_id)
6
+
7
+ CONFIG_DIR = '.spring-gen'
8
+
5
9
  def content_root
6
10
  return @root_dir if @root_dir
7
11
  search_dir = Dir.pwd
8
- while search_dir && !File.exist?("#{search_dir}/service.yml")
12
+ while search_dir && !Dir.exist?("#{search_dir}/#{CONFIG_DIR}")
9
13
  parent = File.dirname(search_dir)
10
14
  # project_root wird entweder der Root-pfad oder false. Wenn es false
11
15
  # wird, bricht die Schleife ab. Vgl. Rails
12
16
  search_dir = (parent != search_dir) && parent
13
17
  end
14
- project_root = search_dir if File.exist? "#{search_dir}/service.yml"
18
+ project_root = search_dir if Dir.exist? "#{search_dir}/#{CONFIG_DIR}"
15
19
  raise 'you are not within a service directory.' unless project_root
16
20
  @root_dir = Pathname.new(File.realpath project_root)
17
21
  end
18
22
 
19
23
  def config
20
24
  return @config if @config
21
- config_hash = YAML.load_file("#{content_root}/service.yml")
25
+ config_hash = YAML.load_file("#{content_root}/#{CONFIG_DIR}/service.yml")
22
26
  @config = Config.new(config_hash['service_name'],
23
27
  config_hash['repository_technique'],
24
28
  config_hash['group_id'],
25
29
  config_hash['artifact_id'])
26
30
  end
27
31
 
32
+ # TODO this only works if user has a valid username in git.
33
+ def licence
34
+ return @licence if @licence
35
+
36
+ content = File.foreach("#{content_root}/#{CONFIG_DIR}/licence.erb")
37
+ .map { |line| "* #{line}"}
38
+ .join
39
+ content = "/*\n#{content}\n*/"
40
+ @licence = ERB.new(content).result binding
41
+ end
42
+
28
43
  def user_name
29
44
  return @user_name if @user_name
30
45
  g = Git.open(content_root)
@@ -1,3 +1,3 @@
1
1
  module SpringGen
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
data/spring-gen.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'spring-gen/version'
4
+ require 'version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "spring-gen"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spring-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rene Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,23 +86,18 @@ files:
86
86
  - lib/command_router.rb
87
87
  - lib/commands/resource.rb
88
88
  - lib/commands/service.rb
89
- - lib/spring-gen.rb
90
- - lib/spring-gen/version.rb
91
89
  - lib/templates/layout/.gitignore
92
90
  - lib/templates/layout/build.gradle.erb
93
- - lib/templates/layout/intellij/config/checkstyle/checkstyle.xml
94
- - lib/templates/layout/intellij/config/codestyle/Codestyle.xml
95
- - lib/templates/layout/intellij/config/copyright/gnu.xml
96
- - lib/templates/layout/intellij/config/copyright/profiles_settings.xml
91
+ - lib/templates/layout/config/checkstyle/checkstyle.xml
97
92
  - lib/templates/layout/src/java/config/AppConfig.java.erb
98
93
  - lib/templates/layout/src/java/main/App.java.erb
99
94
  - lib/templates/layout/src/resources/application.yml.erb
100
95
  - lib/templates/layout/src/resources/bootstrap.yml.erb
96
+ - lib/templates/licence.erb
101
97
  - lib/templates/resource/assembler/Assembler.java.erb
102
98
  - lib/templates/resource/assembler/BaseAssembler.java.erb
103
99
  - lib/templates/resource/controller/BaseController.java.erb
104
100
  - lib/templates/resource/controller/Controller.java.erb
105
- - lib/templates/resource/exception/NotCreatedException.java.erb
106
101
  - lib/templates/resource/model/JpaBaseEntity.java.erb
107
102
  - lib/templates/resource/model/Model.java.erb
108
103
  - lib/templates/resource/model/MongodbBaseEntity.java.erb
@@ -125,6 +120,7 @@ files:
125
120
  - lib/templates/resource/test/unit/controller/ControllerUnitTestConfig.java.erb
126
121
  - lib/templates/service.yml.erb
127
122
  - lib/util.rb
123
+ - lib/version.rb
128
124
  - spring-gen.gemspec
129
125
  homepage: https://github.com/Richterrettich/spring-gen
130
126
  licenses:
data/lib/spring-gen.rb DELETED
@@ -1,5 +0,0 @@
1
- require "spring-gen/version"
2
-
3
- module SpringGen
4
- # Your code goes here...
5
- end
@@ -1,34 +0,0 @@
1
- <code_scheme name="Codestyle">
2
- <option name="OTHER_INDENT_OPTIONS">
3
- <value>
4
- <option name="INDENT_SIZE" value="2" />
5
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
6
- <option name="TAB_SIZE" value="2" />
7
- <option name="USE_TAB_CHARACTER" value="false" />
8
- <option name="SMART_TABS" value="false" />
9
- <option name="LABEL_INDENT_SIZE" value="0" />
10
- <option name="LABEL_INDENT_ABSOLUTE" value="false" />
11
- <option name="USE_RELATIVE_INDENTS" value="false" />
12
- </value>
13
- </option>
14
- <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
15
- <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
16
- <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
17
- <value />
18
- </option>
19
- <option name="IMPORT_LAYOUT_TABLE">
20
- <value>
21
- <package name="" withSubpackages="true" static="true" />
22
- <emptyLine />
23
- <package name="" withSubpackages="true" static="false" />
24
- <emptyLine />
25
- <package name="java" withSubpackages="true" static="false" />
26
- <package name="javax" withSubpackages="true" static="false" />
27
- <emptyLine />
28
- </value>
29
- </option>
30
- <option name="RIGHT_MARGIN" value="80" />
31
- <XML>
32
- <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
33
- </XML>
34
- </code_scheme>
@@ -1,6 +0,0 @@
1
- <component name="CopyrightManager">
2
- <copyright>
3
- <option name="myName" value="gnu" />
4
- <option name="notice" value="Copyright (c) &amp;#36;today.year Rene Richter. &#10;This program is free software; you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation; either version 3 of the License, or&#10;(at your option) any later version.&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;You should have received a copy of the GNU General Public License&#10;along with this program; if not, write to the Free Software Foundation,&#10;Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA" />
5
- </copyright>
6
- </component>
@@ -1,10 +0,0 @@
1
- <component name="CopyrightManager">
2
- <settings default="gnu">
3
- <module2copyright>
4
- <element module="All" copyright="gnu" />
5
- </module2copyright>
6
- <LanguageOptions name="JAVA">
7
- <option name="fileLocation" value="2" />
8
- </LanguageOptions>
9
- </settings>
10
- </component>
@@ -1,34 +0,0 @@
1
- package <%=@package%>.exception;
2
-
3
- /*
4
- * Copyright (c) 2015 <%=@user_name%>.
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 3 of the License, or
8
- * (at your option) any later version.
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
- */
17
-
18
- /**
19
- * Exception that gets thrown, when the entity couldn't get created.
20
- * Violation of constraints can be a reason.
21
- *
22
- * @author <%=@user_name%> Richte
23
- */
24
- public class NotCreatedException extends RuntimeException {
25
-
26
- public NotCreatedException(String message) {
27
- super(message);
28
- }
29
-
30
- public NotCreatedException() {
31
- }
32
-
33
-
34
- }