vsvipergen 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2237d50089bbb1374fe4783be7b0abd6e07da584ec8536f559cff3fa732c8a05
4
- data.tar.gz: 95da7c8c0b649e1b9f5777ef200b05b722d84340e93d0fbaa45d01a24fd6660b
3
+ metadata.gz: 7f552f327f810c4c2a4062820a094842adc7c9f11ab61c733807e7575eca2c85
4
+ data.tar.gz: baa628bcd652087c7dcf35f99c3da6530158b5520c7152a11be74a6891f84b23
5
5
  SHA512:
6
- metadata.gz: 9e6a776ed620fc46b68106f3a371dce7c8705bc6a9dc4a982497fd8807a869dc847129ffe853f6b963bcda10a1ba433f46babc6d50c5ef6899b1a2d05aad1819
7
- data.tar.gz: 4766da2836e839a3524e31339d7206784a7b6a7adec765cadfa405750620a4ceb021a8a77a609c0fc14696bc0198dd447d93c5ba79a62d898dac990928919b28
6
+ metadata.gz: f8dff4fbd309c3c7a898e7b798dc03e03caf57eb387e49e6e56759ed0bc6664d7ddfa8bd74b5caba01732298d21764f79d7fd1284b32c355ec0c0ca5a49f10ec
7
+ data.tar.gz: 197d4d6c066ea0e6aaf3420e80d644a4959302473743b88f36a14e0fe7007a5f4ce0e8afd4eb72f19d0f874462753feff19562c2ea51acc0661b2f529200413d
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vsvipergen (0.1.3)
4
+ vsvipergen (0.1.4)
5
+ colorize (~> 0.8.1)
5
6
  xcodeproj (~> 1.7.0)
6
7
 
7
8
  GEM
@@ -11,6 +12,7 @@ GEM
11
12
  atomos (0.1.3)
12
13
  claide (1.0.2)
13
14
  colored2 (3.1.2)
15
+ colorize (0.8.1)
14
16
  nanaimo (0.2.6)
15
17
  rake (10.5.0)
16
18
  xcodeproj (1.7.0)
@@ -25,8 +27,10 @@ PLATFORMS
25
27
 
26
28
  DEPENDENCIES
27
29
  bundler (~> 1.16)
30
+ colorize (~> 0.8.1)
28
31
  rake (~> 10.0)
29
32
  vsvipergen!
33
+ xcodeproj (~> 1.7.0)
30
34
 
31
35
  BUNDLED WITH
32
36
  1.16.2
data/bin/console CHANGED
@@ -9,6 +9,7 @@ require "vsvipergen_presenter"
9
9
  require "vsvipergen_view"
10
10
  require "vsvipergen_router"
11
11
  require "xcodeproj"
12
+ require "colorize"
12
13
 
13
14
  #################################################
14
15
  ############ handle user input start ############
@@ -29,7 +30,7 @@ end
29
30
 
30
31
  # objective-c 선택일 경우 프로젝트 파일 이름 입력 요구
31
32
  if lang.strip == "objc" || lang.strip == "o" then
32
- puts "input project file name [ex:VLunch] :"
33
+ puts "input xcode project file name [ex:VLunch] :"
33
34
  while true
34
35
  projectName = gets
35
36
 
@@ -38,7 +39,7 @@ if lang.strip == "objc" || lang.strip == "o" then
38
39
  end
39
40
 
40
41
  # 파일 prefix 입력 요구
41
- puts "input file prefix [ex:type Login for VSLoginViewController(or VSLoginPage), ...] : "
42
+ puts "input file prefix [ex:type" + " Login".yellow + " for VS" + "Login".yellow + "ViewController(or VS" + "Login".yellow + "Page), ...] : "
42
43
  filePrefix = gets
43
44
 
44
45
  if filePrefix == "" then
@@ -47,7 +48,7 @@ end
47
48
 
48
49
  # objective-c 선택일 경우 모델 prefix 입력 요구
49
50
  if lang.strip == "objc" || lang.strip == "o" then
50
- puts "input model prefix [ex:type User for VSUserVO] : "
51
+ puts "input model prefix [ex:type" + " User".yellow + " for VS" + "User".yellow + "VO] : "
51
52
  modelPrefix = gets
52
53
 
53
54
  if modelPrefix == "" then
@@ -65,6 +66,7 @@ end
65
66
  ############# create file generator #############
66
67
  fileGenerators = []
67
68
  generatedFilePaths = []
69
+ subPathAndFilePathHashes = []
68
70
 
69
71
  generatorFactory = Vsvipergen::ViperGeneratorFactory.new
70
72
  generatorFactory.init(filePrefix, modelPrefix, now, year)
@@ -84,6 +86,8 @@ end
84
86
  for generator in fileGenerators
85
87
  files = generator.makeFiles
86
88
 
89
+ subPathAndFilePathHashes.push(generator.subPathAndFilePathHash)
90
+
87
91
  for file in files
88
92
  generatedFilePaths.push(file)
89
93
  end
@@ -99,11 +103,39 @@ if lang.strip == "objc" || lang.strip == "o" then
99
103
  project = Xcodeproj::Project.open(xcodeProjectFile.strip)
100
104
  targets = project.targets
101
105
  mainTarget = project.targets.first
102
- newGroup = project.new_group(filePrefix.strip)
106
+ newGroup = project.new_group(filePrefix.strip.downcase)
103
107
 
104
- # Add a file to the project in the main group
108
+ # Add files, groups to the project in the main group
105
109
  for filePath in generatedFilePaths
106
- file = newGroup.new_file(filePath.strip)
110
+
111
+ # extract child group name from file path
112
+ pathArr = filePath.split("/")
113
+ childGroupName = pathArr[pathArr.count - 2]
114
+ childGroup = nil
115
+
116
+ if childGroupName != "" then
117
+ # check same child group added to newGroup
118
+ addChildGroupAlready = false
119
+ newGroup.groups.each { |group|
120
+ if group.name == childGroupName then
121
+ addChildGroupAlready = true
122
+ childGroup = group
123
+ end
124
+ }
125
+
126
+ # add child group to newGroup
127
+ if addChildGroupAlready == false then
128
+ puts "add child group : #{childGroupName}"
129
+ childGroup = newGroup.new_group(childGroupName)
130
+ end
131
+
132
+ # Add file to child group
133
+ file = childGroup.new_file(filePath.strip)
134
+ else
135
+ puts "could not extract child group name from file path, add file to parent group(#{newGroup.name})".red
136
+ # Add file to new group
137
+ file = newGroup.new_file(filePath.strip)
138
+ end
107
139
 
108
140
  # Add the file to the main target
109
141
  mainTarget.add_file_references([file])
data/exe/vsvipergen CHANGED
@@ -8,6 +8,7 @@ require "vsvipergen_presenter"
8
8
  require "vsvipergen_view"
9
9
  require "vsvipergen_router"
10
10
  require "xcodeproj"
11
+ require "colorize"
11
12
 
12
13
  #################################################
13
14
  ############ handle user input start ############
@@ -28,7 +29,7 @@ end
28
29
 
29
30
  # objective-c 선택일 경우 프로젝트 파일 이름 입력 요구
30
31
  if lang.strip == "objc" || lang.strip == "o" then
31
- puts "input project file name [ex:VLunch] :"
32
+ puts "input xcode project file name [ex:VLunch] :"
32
33
  while true
33
34
  projectName = gets
34
35
 
@@ -37,7 +38,7 @@ if lang.strip == "objc" || lang.strip == "o" then
37
38
  end
38
39
 
39
40
  # 파일 prefix 입력 요구
40
- puts "input file prefix [ex:type Login for VSLoginViewController(or VSLoginPage), ...] : "
41
+ puts "input file prefix [ex:type" + " Login".yellow + " for VS" + "Login".yellow + "ViewController(or VS" + "Login".yellow + "Page), ...] : "
41
42
  filePrefix = gets
42
43
 
43
44
  if filePrefix == "" then
@@ -46,7 +47,7 @@ end
46
47
 
47
48
  # objective-c 선택일 경우 모델 prefix 입력 요구
48
49
  if lang.strip == "objc" || lang.strip == "o" then
49
- puts "input model prefix [ex:type User for VSUserVO] : "
50
+ puts "input model prefix [ex:type" + " User".yellow + " for VS" + "User".yellow + "VO] : "
50
51
  modelPrefix = gets
51
52
 
52
53
  if modelPrefix == "" then
@@ -98,11 +99,39 @@ if lang.strip == "objc" || lang.strip == "o" then
98
99
  project = Xcodeproj::Project.open(xcodeProjectFile.strip)
99
100
  targets = project.targets
100
101
  mainTarget = project.targets.first
101
- newGroup = project.new_group(filePrefix.strip)
102
+ newGroup = project.new_group(filePrefix.strip.downcase)
102
103
 
103
- # Add a file to the project in the main group
104
+ # Add files, groups to the project in the main group
104
105
  for filePath in generatedFilePaths
105
- file = newGroup.new_file(filePath.strip)
106
+
107
+ # extract child group name from file path
108
+ pathArr = filePath.split("/")
109
+ childGroupName = pathArr[pathArr.count - 2]
110
+ childGroup = nil
111
+
112
+ if childGroupName != "" then
113
+ # check same child group added to newGroup
114
+ addChildGroupAlready = false
115
+ newGroup.groups.each { |group|
116
+ if group.name == childGroupName then
117
+ addChildGroupAlready = true
118
+ childGroup = group
119
+ end
120
+ }
121
+
122
+ # add child group to newGroup
123
+ if addChildGroupAlready == false then
124
+ puts "add child group : #{childGroupName}"
125
+ childGroup = newGroup.new_group(childGroupName)
126
+ end
127
+
128
+ # Add file to child group
129
+ file = childGroup.new_file(filePath.strip)
130
+ else
131
+ puts "could not extract child group name from file path, add file to parent group(#{newGroup.name})".red
132
+ # Add file to new group
133
+ file = newGroup.new_file(filePath.strip)
134
+ end
106
135
 
107
136
  # Add the file to the main target
108
137
  mainTarget.add_file_references([file])
@@ -10,23 +10,23 @@
10
10
  #import <UIKit/UIKit.h>
11
11
  #import "VS<$modelPrefix$>VO.h"
12
12
 
13
- // view -> presenter
13
+ // presenter 클래스가 구현해야 할 프로토콜 : view 클래스가 호출
14
14
  @protocol I<$prefix$>PresenterForView <NSObject>
15
15
  @end
16
16
 
17
- // presenter -> view
17
+ // view 클래스가 구현해야 할 프로토콜 : presenter 클래스가 호출
18
18
  @protocol I<$prefix$>ViewForPresenter <NSObject>
19
19
  @end
20
20
 
21
- // presenter -> Interactor
21
+ // interactor 클래스가 구현해야 할 프로토콜 : presenter 클래스가 호출
22
22
  @protocol I<$prefix$>InteractorForPresenter <NSObject>
23
23
  @end
24
24
 
25
- // interactor -> presenter
25
+ // presenter 클래스가 구현해야 할 프로토콜 : interactor 클래스가 호출
26
26
  @protocol I<$prefix$>PresenterForInteractor <NSObject>
27
27
  @end
28
28
 
29
- // router
29
+ // router 클래스가 구현해야 할 프로토콜 : 외부 viper 모듈에서 호출
30
30
  @protocol I<$prefix$>Router <NSObject>
31
31
  + (UIViewController *)create<$prefix$>Module;
32
32
  @end
@@ -10,5 +10,5 @@
10
10
  #import "VS<$prefix$>Contracts.h"
11
11
 
12
12
  @interface VS<$prefix$>ViewController : UIViewController <I<$prefix$>ViewForPresenter>
13
- @property (nonatomic, weak) id<I<$prefix$>PresenterForView> presenter;
13
+ @property (nonatomic, strong) id<I<$prefix$>PresenterForView> presenter;
14
14
  @end
@@ -1,3 +1,3 @@
1
1
  module Vsvipergen
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -56,7 +56,7 @@ module Vsvipergen
56
56
  templateJavaFileContents.gsub! "<$now$>", now.strip
57
57
  templateJavaFileContents.gsub! "<$year$>", year.strip
58
58
  templateJavaFileContents.gsub! "<$prefix$>", prefix.strip
59
-
59
+
60
60
  ViperFileWriter.new.writeFile(newJavaFilePath, templateJavaFileContents)
61
61
  end
62
62
  end
data/vsvipergen.gemspec CHANGED
@@ -34,6 +34,10 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.add_development_dependency "bundler", "~> 1.16"
36
36
  spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency 'xcodeproj', '~> 1.7.0'
38
+ spec.add_development_dependency 'colorize', '~> 0.8.1'
39
+
37
40
  # spec.add_development_dependency "rpec", "~> 3.0"
38
41
  spec.add_runtime_dependency 'xcodeproj', '~> 1.7.0'
42
+ spec.add_runtime_dependency 'colorize', '~> 0.8.1'
39
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vsvipergen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - vendys-choohyoung
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: xcodeproj
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.7.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.1
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: xcodeproj
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +80,20 @@ dependencies:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: 1.7.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: colorize
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.8.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.8.1
55
97
  description: generating VS<$prefix$>Protocol.h, VS<$prefix$>ViewController.h, VS<$prefix$>ViewController.m,
56
98
  VS<$prefix$>Presenter.h, VS<$prefix$>Presenter.m, VS<$prefix$>Interactor.h, VS<$prefix$>Interactor.m,
57
99
  VS<$prefix$>Router.h, VS<$prefix$>Router.m