vipergen-afnan 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +157 -0
  4. data/bin/vipergen +9 -0
  5. data/lib/templates/MAU/objc/Application Logic/DataManager/API/VIPERAPIDataManager.h +15 -0
  6. data/lib/templates/MAU/objc/Application Logic/DataManager/API/VIPERAPIDataManager.m +13 -0
  7. data/lib/templates/MAU/objc/Application Logic/DataManager/Local/VIPERLocalDataManager.h +15 -0
  8. data/lib/templates/MAU/objc/Application Logic/DataManager/Local/VIPERLocalDataManager.m +13 -0
  9. data/lib/templates/MAU/objc/Application Logic/Interactor/VIPERInteractor.h +19 -0
  10. data/lib/templates/MAU/objc/Application Logic/Interactor/VIPERInteractor.m +14 -0
  11. data/lib/templates/MAU/objc/Application Logic/Interactor/VIPERItem.h +13 -0
  12. data/lib/templates/MAU/objc/Application Logic/Interactor/VIPERItem.m +13 -0
  13. data/lib/templates/MAU/objc/Module Interface/VIPERProtocols.h +83 -0
  14. data/lib/templates/MAU/objc/User Interface/Presenter/VIPERPresenter.h +20 -0
  15. data/lib/templates/MAU/objc/User Interface/Presenter/VIPERPresenter.m +14 -0
  16. data/lib/templates/MAU/objc/User Interface/View/VIPERView.h +16 -0
  17. data/lib/templates/MAU/objc/User Interface/View/VIPERView.m +35 -0
  18. data/lib/templates/MAU/objc/User Interface/WireFrame/VIPERWireFrame.h +21 -0
  19. data/lib/templates/MAU/objc/User Interface/WireFrame/VIPERWireFrame.m +35 -0
  20. data/lib/templates/MAU/swift/Application Logic/DataManager/API/VIPERAPIDataManager.swift +14 -0
  21. data/lib/templates/MAU/swift/Application Logic/DataManager/Local/VIPERLocalDataManager.swift +14 -0
  22. data/lib/templates/MAU/swift/Application Logic/Interactor/VIPERInteractor.swift +18 -0
  23. data/lib/templates/MAU/swift/Application Logic/Interactor/VIPERItem.swift +16 -0
  24. data/lib/templates/MAU/swift/Module Interface/VIPERProtocols.swift +73 -0
  25. data/lib/templates/MAU/swift/User Interface/Presenter/VIPERPresenter.swift +18 -0
  26. data/lib/templates/MAU/swift/User Interface/View/VIPERView.swift +15 -0
  27. data/lib/templates/MAU/swift/User Interface/WireFrame/VIPERWireFrame.swift +31 -0
  28. data/lib/templates/MAU/viperspec.yml +4 -0
  29. data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.h +12 -0
  30. data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.m +10 -0
  31. data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.h +12 -0
  32. data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.m +10 -0
  33. data/lib/templates/default/objc/Interactor/VIPERInteractor.h +16 -0
  34. data/lib/templates/default/objc/Interactor/VIPERInteractor.m +10 -0
  35. data/lib/templates/default/objc/Interactor/VIPERItem.h +10 -0
  36. data/lib/templates/default/objc/Interactor/VIPERItem.m +10 -0
  37. data/lib/templates/default/objc/Presenter/VIPERPresenter.h +17 -0
  38. data/lib/templates/default/objc/Presenter/VIPERPresenter.m +11 -0
  39. data/lib/templates/default/objc/Protocols/VIPERProtocols.h +80 -0
  40. data/lib/templates/default/objc/View/VIPERView.h +13 -0
  41. data/lib/templates/default/objc/View/VIPERView.m +32 -0
  42. data/lib/templates/default/objc/WireFrame/VIPERWireFrame.h +18 -0
  43. data/lib/templates/default/objc/WireFrame/VIPERWireFrame.m +32 -0
  44. data/lib/templates/default/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
  45. data/lib/templates/default/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
  46. data/lib/templates/default/swift/Interactor/VIPERInteractor.swift +15 -0
  47. data/lib/templates/default/swift/Interactor/VIPERItem.swift +13 -0
  48. data/lib/templates/default/swift/Presenter/VIPERPresenter.swift +15 -0
  49. data/lib/templates/default/swift/Protocols/VIPERProtocols.swift +70 -0
  50. data/lib/templates/default/swift/View/VIPERView.swift +12 -0
  51. data/lib/templates/default/swift/WireFrame/VIPERWireFrame.swift +29 -0
  52. data/lib/templates/default/viperspec.yml +4 -0
  53. data/lib/templates/testable/objc/DataManager/VIPERDataManager.h +15 -0
  54. data/lib/templates/testable/objc/DataManager/VIPERDataManager.m +11 -0
  55. data/lib/templates/testable/objc/Interactor/VIPERInteractor.h +16 -0
  56. data/lib/templates/testable/objc/Interactor/VIPERInteractor.m +10 -0
  57. data/lib/templates/testable/objc/Interactor/VIPERInteractorSpec.m +31 -0
  58. data/lib/templates/testable/objc/Presenter/VIPERPresenter.h +18 -0
  59. data/lib/templates/testable/objc/Presenter/VIPERPresenter.m +11 -0
  60. data/lib/templates/testable/objc/Presenter/VIPERPresenterSpec.m +31 -0
  61. data/lib/templates/testable/objc/Protocols/VIPERProtocols.h +64 -0
  62. data/lib/templates/testable/objc/ViewController/VIPERViewController.h +13 -0
  63. data/lib/templates/testable/objc/ViewController/VIPERViewController.m +32 -0
  64. data/lib/templates/testable/objc/ViewController/VIPERViewControllerSpec.m +31 -0
  65. data/lib/templates/testable/objc/WireFrame/VIPERWireFrame.h +19 -0
  66. data/lib/templates/testable/objc/WireFrame/VIPERWireFrame.m +31 -0
  67. data/lib/templates/testable/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
  68. data/lib/templates/testable/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
  69. data/lib/templates/testable/swift/Interactor/VIPERInteractor.swift +15 -0
  70. data/lib/templates/testable/swift/Interactor/VIPERInteractorSpec.swift +22 -0
  71. data/lib/templates/testable/swift/Interactor/VIPERItem.swift +13 -0
  72. data/lib/templates/testable/swift/Presenter/VIPERPresenter.swift +15 -0
  73. data/lib/templates/testable/swift/Presenter/VIPERPresenterSpec.swift +22 -0
  74. data/lib/templates/testable/swift/Protocols/VIPERProtocols.swift +70 -0
  75. data/lib/templates/testable/swift/View/VIPERView.swift +12 -0
  76. data/lib/templates/testable/swift/View/VIPERViewSpec.swift +22 -0
  77. data/lib/templates/testable/swift/WireFrame/VIPERWireFrame.swift +29 -0
  78. data/lib/templates/testable/viperspec.yml +4 -0
  79. data/lib/vipergen.rb +6 -0
  80. data/lib/vipergen/dirutils.rb +17 -0
  81. data/lib/vipergen/filemanager.rb +51 -0
  82. data/lib/vipergen/generator.rb +74 -0
  83. data/lib/vipergen/templatemanager.rb +53 -0
  84. data/lib/vipergen/version.rb +4 -0
  85. data/lib/vipergen/viperthor.rb +23 -0
  86. data/spec/spec_helper.rb +4 -0
  87. data/spec/vipergen/vipergen_spec.rb +133 -0
  88. metadata +206 -0
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERPresenter.h"
7
+ #import "VIPERWireframe.h"
8
+
9
+ @implementation VIPERPresenter
10
+
11
+ @end
@@ -0,0 +1,80 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import <UIKit/UIKit.h>
8
+
9
+ @protocol VIPERInteractorOutputProtocol;
10
+ @protocol VIPERInteractorInputProtocol;
11
+ @protocol VIPERViewProtocol;
12
+ @protocol VIPERPresenterProtocol;
13
+ @protocol VIPERLocalDataManagerInputProtocol;
14
+ @protocol VIPERAPIDataManagerInputProtocol;
15
+
16
+
17
+ @class VIPERWireFrame;
18
+
19
+ @protocol VIPERViewProtocol
20
+ @required
21
+ @property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
22
+ /**
23
+ * Add here your methods for communication PRESENTER -> VIEWCONTROLLER
24
+ */
25
+ @end
26
+
27
+ @protocol VIPERWireFrameProtocol
28
+ @required
29
+ + (void)presentVIPERModuleFrom:(id)fromView;
30
+ /**
31
+ * Add here your methods for communication PRESENTER -> WIREFRAME
32
+ */
33
+ @end
34
+
35
+ @protocol VIPERPresenterProtocol
36
+ @required
37
+ @property (nonatomic, weak) id <VIPERViewProtocol> view;
38
+ @property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
39
+ @property (nonatomic, strong) id <VIPERWireFrameProtocol> wireFrame;
40
+ /**
41
+ * Add here your methods for communication VIEWCONTROLLER -> PRESENTER
42
+ */
43
+ @end
44
+
45
+ @protocol VIPERInteractorOutputProtocol
46
+ /**
47
+ * Add here your methods for communication INTERACTOR -> PRESENTER
48
+ */
49
+ @end
50
+
51
+ @protocol VIPERInteractorInputProtocol
52
+ @required
53
+ @property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
54
+ @property (nonatomic, strong) id <VIPERAPIDataManagerInputProtocol> APIDataManager;
55
+ @property (nonatomic, strong) id <VIPERLocalDataManagerInputProtocol> localDataManager;
56
+ /**
57
+ * Add here your methods for communication PRESENTER -> INTERACTOR
58
+ */
59
+ @end
60
+
61
+
62
+ @protocol VIPERDataManagerInputProtocol
63
+ /**
64
+ * Add here your methods for communication INTERACTOR -> DATAMANAGER
65
+ */
66
+ @end
67
+
68
+ @protocol VIPERAPIDataManagerInputProtocol <VIPERDataManagerInputProtocol>
69
+ /**
70
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
71
+ */
72
+ @end
73
+
74
+ @protocol VIPERLocalDataManagerInputProtocol <VIPERDataManagerInputProtocol>
75
+ /**
76
+ * Add here your methods for communication INTERACTOR -> LOCLDATAMANAGER
77
+ */
78
+ @end
79
+
80
+
@@ -0,0 +1,13 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <UIKit/UIKit.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+ @interface VIPERView : UIViewController <VIPERViewProtocol>
10
+
11
+ @property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
12
+
13
+ @end
@@ -0,0 +1,32 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERView.h"
7
+
8
+ @implementation VIPERView
9
+
10
+ #pragma mark - ViewController Lifecycle
11
+
12
+ - (void)viewDidLoad
13
+ {
14
+ [super viewDidLoad];
15
+ }
16
+
17
+ - (void)viewDidDisappear:(BOOL)animated
18
+ {
19
+ [super viewDidDisappear:animated];
20
+ }
21
+
22
+ - (void)viewWillAppear:(BOOL)animated
23
+ {
24
+ [super viewWillAppear:animated];
25
+ }
26
+
27
+ - (void)viewWillDisappear:(BOOL)animated
28
+ {
29
+ [super viewWillDisappear:animated];
30
+ }
31
+
32
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+ #import "VIPERView.h"
9
+ #import "VIPERLocalDataManager.h"
10
+ #import "VIPERAPIDataManager.h"
11
+ #import "VIPERInteractor.h"
12
+ #import "VIPERPresenter.h"
13
+ #import "VIPERWireframe.h"
14
+ #import <UIKit/UIKit.h>
15
+
16
+ @interface VIPERWireFrame : NSObject <VIPERWireFrameProtocol>
17
+
18
+ @end
@@ -0,0 +1,32 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERWireFrame.h"
7
+
8
+ @implementation VIPERWireFrame
9
+
10
+ + (void)presentVIPERModuleFrom:(UIViewController*)fromViewController
11
+ {
12
+ // Generating module components
13
+ id <VIPERViewProtocol> view = [[VIPERView alloc] init];
14
+ id <VIPERPresenterProtocol, VIPERInteractorOutputProtocol> presenter = [VIPERPresenter new];
15
+ id <VIPERInteractorInputProtocol> interactor = [VIPERInteractor new];
16
+ id <VIPERAPIDataManagerInputProtocol> APIDataManager = [VIPERAPIDataManager new];
17
+ id <VIPERLocalDataManagerInputProtocol> localDataManager = [VIPERLocalDataManager new];
18
+ id <VIPERWireFrameProtocol> wireFrame= [VIPERWireFrame new];
19
+
20
+ // Connecting
21
+ view.presenter = presenter;
22
+ presenter.view = view;
23
+ presenter.wireFrame = wireFrame;
24
+ presenter.interactor = interactor;
25
+ interactor.presenter = presenter;
26
+ interactor.APIDataManager = APIDataManager;
27
+ interactor.localDataManager = localDataManager;
28
+
29
+ //TOODO - New view controller presentation (present, push, pop, .. )
30
+ }
31
+
32
+ @end
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERAPIDataManager: VIPERAPIDataManagerInputProtocol
9
+ {
10
+ init() {}
11
+ }
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERLocalDataManager: VIPERLocalDataManagerInputProtocol
9
+ {
10
+ init() {}
11
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERInteractor: VIPERInteractorInputProtocol
9
+ {
10
+ weak var presenter: VIPERInteractorOutputProtocol?
11
+ var APIDataManager: VIPERAPIDataManagerInputProtocol?
12
+ var localDatamanager: VIPERLocalDataManagerInputProtocol?
13
+
14
+ init() {}
15
+ }
@@ -0,0 +1,13 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ struct VIPERItem
9
+ {
10
+ /**
11
+ * Attributes here
12
+ */
13
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERPresenter: VIPERPresenterProtocol, VIPERInteractorOutputProtocol
9
+ {
10
+ weak var view: VIPERViewProtocol?
11
+ var interactor: VIPERInteractorInputProtocol?
12
+ var wireFrame: VIPERWireFrameProtocol?
13
+
14
+ init() {}
15
+ }
@@ -0,0 +1,70 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ protocol VIPERViewProtocol: class
9
+ {
10
+ var presenter: VIPERPresenterProtocol? { get set }
11
+ /**
12
+ * Add here your methods for communication PRESENTER -> VIEW
13
+ */
14
+ }
15
+
16
+ protocol VIPERWireFrameProtocol: class
17
+ {
18
+ class func presentVIPERModule(fromView view: AnyObject)
19
+ /**
20
+ * Add here your methods for communication PRESENTER -> WIREFRAME
21
+ */
22
+ }
23
+
24
+ protocol VIPERPresenterProtocol: class
25
+ {
26
+ var view: VIPERViewProtocol? { get set }
27
+ var interactor: VIPERInteractorInputProtocol? { get set }
28
+ var wireFrame: VIPERWireFrameProtocol? { get set }
29
+ /**
30
+ * Add here your methods for communication VIEW -> PRESENTER
31
+ */
32
+ }
33
+
34
+ protocol VIPERInteractorOutputProtocol: class
35
+ {
36
+ /**
37
+ * Add here your methods for communication INTERACTOR -> PRESENTER
38
+ */
39
+ }
40
+
41
+ protocol VIPERInteractorInputProtocol: class
42
+ {
43
+ var presenter: VIPERInteractorOutputProtocol? { get set }
44
+ var APIDataManager: VIPERAPIDataManagerInputProtocol? { get set }
45
+ var localDatamanager: VIPERLocalDataManagerInputProtocol? { get set }
46
+ /**
47
+ * Add here your methods for communication PRESENTER -> INTERACTOR
48
+ */
49
+ }
50
+
51
+ protocol VIPERDataManagerInputProtocol: class
52
+ {
53
+ /**
54
+ * Add here your methods for communication INTERACTOR -> DATAMANAGER
55
+ */
56
+ }
57
+
58
+ protocol VIPERAPIDataManagerInputProtocol: class
59
+ {
60
+ /**
61
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
62
+ */
63
+ }
64
+
65
+ protocol VIPERLocalDataManagerInputProtocol: class
66
+ {
67
+ /**
68
+ * Add here your methods for communication INTERACTOR -> LOCALDATAMANAGER
69
+ */
70
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+ import UIKit
8
+
9
+ class VIPERView: UIViewController, VIPERViewProtocol
10
+ {
11
+ var presenter: VIPERPresenterProtocol?
12
+ }
@@ -0,0 +1,29 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERWireFrame: VIPERWireFrameProtocol
9
+ {
10
+ class func presentVIPERModule(fromView view: AnyObject)
11
+ {
12
+ // Generating module components
13
+ var view: VIPERViewProtocol = VIPERView()
14
+ var presenter: protocol<VIPERPresenterProtocol, VIPERInteractorOutputProtocol> = VIPERPresenter()
15
+ var interactor: VIPERInteractorInputProtocol = VIPERInteractor()
16
+ var APIDataManager: VIPERAPIDataManagerInputProtocol = VIPERAPIDataManager()
17
+ var localDataManager: VIPERLocalDataManagerInputProtocol = VIPERLocalDataManager()
18
+ var wireFrame: VIPERWireFrameProtocol = VIPERWireFrame()
19
+
20
+ // Connecting
21
+ view.presenter = presenter
22
+ presenter.view = view
23
+ presenter.wireFrame = wireFrame
24
+ presenter.interactor = interactor
25
+ interactor.presenter = presenter
26
+ interactor.APIDataManager = APIDataManager
27
+ interactor.localDatamanager = localDataManager
28
+ }
29
+ }
@@ -0,0 +1,4 @@
1
+ author: pepi
2
+ author_email: pepibumur@gmail.com
3
+ template_description: Default template with the simplest structure using VIPER
4
+ updated_at: 2014-08-24
@@ -0,0 +1,15 @@
1
+ //
2
+ // Created by AUTHOR.
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERDataManager : NSObject <VIPERDataManagerInputProtocol>
11
+
12
+ // Properties
13
+ @property (nonatomic, weak) id <VIPERDataManagerOutputProtocol> interactor;
14
+
15
+ @end
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR.
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERDataManager.h"
7
+
8
+
9
+ @implementation VIPERDataManager
10
+
11
+ @end
@@ -0,0 +1,16 @@
1
+ //
2
+ // Created by AUTHOR.
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERInteractor : NSObject <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol>
11
+
12
+ // Properties
13
+ @property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
14
+ @property (nonatomic, strong) id <VIPERDataManagerInputProtocol> dataManager;
15
+
16
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by AUTHOR.
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERInteractor.h"
7
+
8
+ @implementation VIPERInteractor
9
+
10
+ @end