vipergen 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.h +12 -0
  4. data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.m +10 -0
  5. data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.h +12 -0
  6. data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.m +10 -0
  7. data/lib/templates/default/objc/Interactor/VIPERInteractor.h +4 -4
  8. data/lib/templates/default/objc/Interactor/VIPERInteractor.m +1 -1
  9. data/lib/templates/default/objc/Interactor/VIPERItem.h +13 -0
  10. data/lib/templates/default/objc/Interactor/VIPERItem.m +13 -0
  11. data/lib/templates/default/objc/Presenter/VIPERPresenter.h +2 -3
  12. data/lib/templates/default/objc/Presenter/VIPERPresenter.m +1 -1
  13. data/lib/templates/default/objc/Protocols/VIPERProtocols.h +28 -12
  14. data/lib/templates/default/objc/{ViewController/VIPERViewController.h → View/VIPERView.h} +2 -2
  15. data/lib/templates/default/objc/{ViewController/VIPERViewController.m → View/VIPERView.m} +3 -3
  16. data/lib/templates/default/objc/WireFrame/VIPERWireFrame.h +6 -9
  17. data/lib/templates/default/objc/WireFrame/VIPERWireFrame.m +11 -11
  18. data/lib/templates/default/swift/DataManager/API/VIPERAPIDataManager.swift +14 -0
  19. data/lib/templates/default/swift/DataManager/Local/VIPERLocalDataManager.swift +14 -0
  20. data/lib/templates/default/swift/Interactor/VIPERInteractor.swift +18 -0
  21. data/lib/templates/default/swift/Interactor/VIPERItem.swift +16 -0
  22. data/lib/templates/default/swift/Presenter/VIPERPresenter.swift +18 -0
  23. data/lib/templates/default/swift/Protocols/VIPERProtocols.swift +45 -21
  24. data/lib/templates/default/swift/View/VIPERView.swift +15 -0
  25. data/lib/templates/default/swift/WireFrame/VIPERWireFrame.swift +32 -0
  26. data/lib/vipergen/version.rb +2 -2
  27. data/spec/vipergen/vipergen_spec.rb +6 -6
  28. metadata +17 -6
  29. data/lib/templates/default/objc/DataManager/VIPERDataManager.h +0 -15
  30. data/lib/templates/default/objc/DataManager/VIPERDataManager.m +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bfa207d1655b511bde53f922178556a1c38587c
4
- data.tar.gz: c49c20a1ff08b29f6fe0da68cf98e7f04cd20911
3
+ metadata.gz: e0e9a2fe1c4464f75cd7dfa761e575b2111d9dc7
4
+ data.tar.gz: 6d674ca32c2ae04c1630e785e7306d45b1d8cb76
5
5
  SHA512:
6
- metadata.gz: 1baf6163d61958aaedb7885bc444dbffeefd788930e7582238e6598d0e041bcc0e243f049dd9e23dcc8f7f5873be94a9c0689006b4329a89a7792d4e0dd63f81
7
- data.tar.gz: 729d280916961e52a0c284b27d3c04a039e99aecb0f9f880a02015d5d85cb42214b6156ef04dab902517a61b8709237c0df3e5e0deb497cdc99d04281082e752
6
+ metadata.gz: 8f062cf785ee645e99a3980bee3dc717c6652097d7a88a35c1ff7eeec3a3bfcb39f00f751ac94ac981d9ee8e042df6958af8b814bf75928395fc4439f4ea3268
7
+ data.tar.gz: e904e13533cdb6fe616896cf07e8b63a0543ecfec9ca9fb95237259f396895b560c5fecb414252196a7c469242f8e6755ff812bbcf6b38b813871fa32ad65929
data/README.md CHANGED
@@ -118,6 +118,7 @@ updated_at: 2014-08-24
118
118
  - XCode Plugins: http://nshipster.com/xcode-plugins/
119
119
  - XCodeProj gem (to modify project groups structure): https://github.com/CocoaPods/Xcodeproj
120
120
  - Thor, powerful Ruby library for command line: http://whatisthor.com/
121
+ - Cocoa Design Patters: https://developer.apple.com/legacy/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html
121
122
 
122
123
  ## Contact
123
124
  If you have any doubt about the gem or even if you want to make any suggestion you can do it directly to my email address, pedro@redbooth.com . You can use the issues Github page too
@@ -0,0 +1,12 @@
1
+ //
2
+ // Created by Pedro Piñera Buendía on 2014.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERAPIDataManager : NSObject <VIPERAPIDataManagerInputProtocol>
11
+
12
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by Pedro Piñera Buendía on 2014.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERAPIDataManager.h"
7
+
8
+ @implementation VIPERAPIDataManager
9
+
10
+ @end
@@ -0,0 +1,12 @@
1
+ //
2
+ // Created by Pedro Piñera Buendía on 2014.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERLocalDataManager : NSObject <VIPERLocalDataManagerInputProtocol>
11
+
12
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by Pedro Piñera Buendía on 2014.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERLocalDataManager.h"
7
+
8
+ @implementation VIPERLocalDataManager
9
+
10
+ @end
@@ -1,16 +1,16 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import <Foundation/Foundation.h>
7
7
  #import "VIPERProtocols.h"
8
8
 
9
9
 
10
- @interface VIPERInteractor : NSObject <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol>
10
+ @interface VIPERInteractor : NSObject <VIPERInteractorInputProtocol>
11
11
 
12
- // Properties
13
12
  @property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
14
- @property (nonatomic, strong) id <VIPERDataManagerInputProtocol> dataManager;
13
+ @property (nonatomic, strong) id <VIPERAPIDataManagerInputProtocol> APIDataManager;
14
+ @property (nonatomic, strong) id <VIPERLocalDataManagerInputProtocol> localDataManager;
15
15
 
16
16
  @end
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import "VIPERInteractor.h"
@@ -0,0 +1,13 @@
1
+ //
2
+ // VIPERItem.h
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___PPinera___. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ @interface VIPERItem : NSObject
12
+
13
+ @end
@@ -0,0 +1,13 @@
1
+ //
2
+ // VIPERItem.m
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___PPinera___. All rights reserved.
7
+ //
8
+
9
+ #import "VIPERItem.h"
10
+
11
+ @implementation VIPERItem
12
+
13
+ @end
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import <Foundation/Foundation.h>
@@ -10,9 +10,8 @@
10
10
 
11
11
  @interface VIPERPresenter : NSObject <VIPERPresenterProtocol, VIPERInteractorOutputProtocol>
12
12
 
13
- // Properties
14
13
  @property (nonatomic, weak) id <VIPERViewProtocol> view;
15
14
  @property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
16
- @property (nonatomic, strong) VIPERWireFrame *wireFrame;
15
+ @property (nonatomic, strong) id <VIPERWireFrameProtocol> wireFrame;
17
16
 
18
17
  @end
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import "VIPERPresenter.h"
@@ -1,26 +1,34 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import <Foundation/Foundation.h>
7
7
  #import <UIKit/UIKit.h>
8
8
 
9
- @protocol VIPERDataManagerOutputProtocol;
10
9
  @protocol VIPERInteractorOutputProtocol;
11
10
  @protocol VIPERInteractorInputProtocol;
12
11
  @protocol VIPERViewProtocol;
13
12
  @protocol VIPERPresenterProtocol;
14
- @protocol VIPERDataManagerInputProtocol;
15
- @class VIPERWireFrame;
13
+ @protocol VIPERLocalDataManagerInputProtocol;
14
+ @protocol VIPERAPIDataManagerInputProtocol;
15
+
16
16
 
17
- typedef void (^CompletionBlock)(NSError **error);
17
+ @class VIPERWireFrame;
18
18
 
19
19
  @protocol VIPERViewProtocol
20
20
  @required
21
21
  @property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
22
22
  /**
23
- * Add here your methods for communication VIEWCONTROLLER -> PRESENTER
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
24
32
  */
25
33
  @end
26
34
 
@@ -28,9 +36,9 @@ typedef void (^CompletionBlock)(NSError **error);
28
36
  @required
29
37
  @property (nonatomic, weak) id <VIPERViewProtocol> view;
30
38
  @property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
31
- @property (nonatomic, strong) VIPERWireFrame *wireFrame;
39
+ @property (nonatomic, strong) id <VIPERWireFrameProtocol> wireFrame;
32
40
  /**
33
- * Add here your methods for communication VIEWCONTROLLER/WIREFRAME -> PRESENTER
41
+ * Add here your methods for communication VIEWCONTROLLER -> PRESENTER
34
42
  */
35
43
  @end
36
44
 
@@ -43,6 +51,8 @@ typedef void (^CompletionBlock)(NSError **error);
43
51
  @protocol VIPERInteractorInputProtocol
44
52
  @required
45
53
  @property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
54
+ @property (nonatomic, strong) id <VIPERAPIDataManagerInputProtocol> APIDataManager;
55
+ @property (nonatomic, strong) id <VIPERLocalDataManagerInputProtocol> localDataManager;
46
56
  /**
47
57
  * Add here your methods for communication PRESENTER -> INTERACTOR
48
58
  */
@@ -50,15 +60,21 @@ typedef void (^CompletionBlock)(NSError **error);
50
60
 
51
61
 
52
62
  @protocol VIPERDataManagerInputProtocol
53
- @property (nonatomic, weak) id <VIPERDataManagerOutputProtocol> interactor;
54
63
  /**
55
64
  * Add here your methods for communication INTERACTOR -> DATAMANAGER
56
65
  */
57
66
  @end
58
67
 
59
- @protocol VIPERDataManagerOutputProtocol
60
- @property (nonatomic, strong) id <VIPERDataManagerInputProtocol> dataManager;
68
+ @protocol VIPERAPIDataManagerInputProtocol <VIPERDataManagerInputProtocol>
69
+ /**
70
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
71
+ */
72
+ @end
73
+
74
+ @protocol VIPERLocalDataManagerInputProtocol <VIPERDataManagerInputProtocol>
61
75
  /**
62
- * Add here your methods for communication DATAMANAGER -> INTERACTOR
76
+ * Add here your methods for communication INTERACTOR -> LOCLDATAMANAGER
63
77
  */
64
78
  @end
79
+
80
+
@@ -1,12 +1,12 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import <UIKit/UIKit.h>
7
7
  #import "VIPERProtocols.h"
8
8
 
9
- @interface VIPERViewController : UIViewController <VIPERViewProtocol>
9
+ @interface VIPERView : UIViewController <VIPERViewProtocol>
10
10
 
11
11
  @property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
12
12
 
@@ -1,11 +1,11 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
- #import "VIPERViewController.h"
6
+ #import "VIPERView.h"
7
7
 
8
- @implementation VIPERViewController
8
+ @implementation VIPERView
9
9
 
10
10
  #pragma mark - ViewController Lifecycle
11
11
 
@@ -1,21 +1,18 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import <Foundation/Foundation.h>
7
7
  #import "VIPERProtocols.h"
8
- #import "VIPERViewController.h"
9
- #import "VIPERDataManager.h"
8
+ #import "VIPERView.h"
9
+ #import "VIPERLocalDataManager.h"
10
+ #import "VIPERAPIDataManager.h"
10
11
  #import "VIPERInteractor.h"
11
12
  #import "VIPERPresenter.h"
12
13
  #import "VIPERWireframe.h"
13
14
  #import <UIKit/UIKit.h>
14
15
 
15
- @interface VIPERWireFrame : NSObject
16
+ @interface VIPERWireFrame : NSObject <VIPERWireFrameProtocol>
16
17
 
17
- @property (nonatomic, weak) id view;
18
-
19
- + (void)presentVIPERModuleFrom:(id)fromView;
20
-
21
- @end
18
+ @end
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
3
+ // Copyright (c) 2014 PPinera. All rights reserved.
4
4
  //
5
5
 
6
6
  #import "VIPERWireFrame.h"
@@ -10,22 +10,22 @@
10
10
  + (void)presentVIPERModuleFrom:(UIViewController*)fromViewController
11
11
  {
12
12
  // Generating module components
13
- UIViewController <VIPERViewProtocol> *viewController = [[VIPERViewController alloc] init];
13
+ id <VIPERViewProtocol> view = [[VIPERView alloc] init];
14
14
  id <VIPERPresenterProtocol, VIPERInteractorOutputProtocol> presenter = [VIPERPresenter new];
15
- id <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol> interactor = [VIPERInteractor new];
16
- id <VIPERDataManagerInputProtocol> dataManager = [VIPERDataManager new];
17
- VIPERWireFrame *wireFrame = [VIPERWireFrame 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];
18
19
 
19
20
  // Connecting
20
- viewController.presenter = presenter;
21
- presenter.view = viewController;
21
+ view.presenter = presenter;
22
+ presenter.view = view;
22
23
  presenter.wireFrame = wireFrame;
23
- wireFrame.view = viewController;
24
24
  presenter.interactor = interactor;
25
25
  interactor.presenter = presenter;
26
- interactor.dataManager = dataManager;
27
- dataManager.interactor = interactor;
28
-
26
+ interactor.APIDataManager = APIDataManager;
27
+ interactor.localDataManager = localDataManager;
28
+
29
29
  //TOODO - New view controller presentation (present, push, pop, .. )
30
30
  }
31
31
 
@@ -0,0 +1,14 @@
1
+ //
2
+ // VIPERAPIDataManager.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ class VIPERAPIDataManager: VIPERAPIDataManagerInputProtocol
12
+ {
13
+ init() {}
14
+ }
@@ -0,0 +1,14 @@
1
+ //
2
+ // VIPERLocalDataManager.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ class VIPERLocalDataManager: VIPERLocalDataManagerInputProtocol
12
+ {
13
+ init() {}
14
+ }
@@ -0,0 +1,18 @@
1
+ //
2
+ // VIPERInteractor.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ class VIPERInteractor: VIPERInteractorInputProtocol
12
+ {
13
+ weak var presenter: VIPERInteractorOutputProtocol?
14
+ var APIDataManager: VIPERAPIDataManagerInputProtocol?
15
+ var localDatamanager: VIPERLocalDataManagerInputProtocol?
16
+
17
+ init() {}
18
+ }
@@ -0,0 +1,16 @@
1
+ //
2
+ // VIPERItem.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ struct VIPERItem
12
+ {
13
+ /**
14
+ * Attributes here
15
+ */
16
+ }
@@ -0,0 +1,18 @@
1
+ //
2
+ // VIPERPresenter.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ class VIPERPresenter: VIPERPresenterProtocol, VIPERInteractorOutputProtocol
12
+ {
13
+ weak var view: VIPERViewProtocol?
14
+ var interactor: VIPERInteractorInputProtocol?
15
+ var wireFrame: VIPERWireFrameProtocol?
16
+
17
+ init() {}
18
+ }
@@ -6,44 +6,68 @@
6
6
  // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
7
  //
8
8
 
9
- //Problem with a bucle in protocols: http://stackoverflow.com/questions/26205809/cyclic-loop-between-protocols-in-swift
9
+ import Foundation
10
10
 
11
- protocol VIPERPresenterProtocol
11
+ protocol VIPERViewProtocol: class
12
12
  {
13
- var view: VIPERViewProtocol? { get set }
14
- var interactor: VIPERInteractorInputProtocol? { get set }
15
- //var wireFrame: VIPERWireFrame? { get set }
13
+ var presenter: VIPERPresenterProtocol? { get set }
14
+ /**
15
+ * Add here your methods for communication VIEWCONTROLLER -> PRESENTER
16
+ */
17
+ }
16
18
 
17
- // /* Add your extra communication methods here */
18
- // /* Presenter -> ViewController */
19
+ protocol VIPERWireFrameProtocol: class
20
+ {
21
+ class func presentVIPERModule(fromView view: AnyObject)
22
+ /**
23
+ * Add here your methods for communication PRESENTER -> WIREFRAME
24
+ */
19
25
  }
20
26
 
21
- protocol VIPERViewProtocol
27
+ protocol VIPERPresenterProtocol: class
22
28
  {
23
- //var presenter: VIPERPresenterProtocol? { get set }
29
+ var view: VIPERViewProtocol? { get set }
30
+ var interactor: VIPERInteractorInputProtocol? { get set }
31
+ var wireFrame: VIPERWireFrameProtocol? { get set }
32
+ /**
33
+ * Add here your methods for communication VIEWCONTROLLER -> PRESENTER
34
+ */
24
35
  }
25
36
 
26
- protocol VIPERDataManagerInputProtocol
37
+ protocol VIPERInteractorOutputProtocol: class
27
38
  {
28
- var interactor: VIPERDataManagerOutputProtocol? { get set }
39
+ /**
40
+ * Add here your methods for communication INTERACTOR -> PRESENTER
41
+ */
29
42
  }
30
43
 
31
- protocol VIPERDataManagerOutputProtocol
44
+ protocol VIPERInteractorInputProtocol: class
32
45
  {
33
- //var dataManager: VIPERDataManagerInputProtocol? { get set }
46
+ var presenter: VIPERInteractorOutputProtocol? { get set }
47
+ var APIDataManager: VIPERAPIDataManagerInputProtocol? { get set }
48
+ var localDatamanager: VIPERLocalDataManagerInputProtocol? { get set }
49
+ /**
50
+ * Add here your methods for communication PRESENTER -> INTERACTOR
51
+ */
34
52
  }
35
53
 
54
+ protocol VIPERDataManagerInputProtocol: class
55
+ {
56
+ /**
57
+ * Add here your methods for communication INTERACTOR -> DATAMANAGER
58
+ */
59
+ }
36
60
 
37
- protocol VIPERInteractorOutputProtocol
61
+ protocol VIPERAPIDataManagerInputProtocol: class
38
62
  {
39
- /* Add your extra communication methods here */
40
- /* Interactor -> Presenter */
63
+ /**
64
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
65
+ */
41
66
  }
42
67
 
43
- protocol VIPERInteractorInputProtocol
68
+ protocol VIPERLocalDataManagerInputProtocol: class
44
69
  {
45
- var presenter: VIPERInteractorOutputProtocol? { get set }
46
-
47
- /* Add your extra communication methods here */
48
- /* Presenter -> Interactor */
70
+ /**
71
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
72
+ */
49
73
  }
@@ -0,0 +1,15 @@
1
+ //
2
+ // VIPERView.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+ import UIKit
11
+
12
+ class VIPERView: UIViewController, VIPERViewProtocol
13
+ {
14
+ var presenter: VIPERPresenterProtocol?
15
+ }
@@ -0,0 +1,32 @@
1
+ //
2
+ // VIPERWireFrame.swift
3
+ // VIPERGenDemo
4
+ //
5
+ // Created by Pedro Piñera Buendía on 24/10/14.
6
+ // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ class VIPERWireFrame: VIPERWireFrameProtocol
12
+ {
13
+ class func presentVIPERModule(fromView view: AnyObject)
14
+ {
15
+ // Generating module components
16
+ var view: VIPERViewProtocol = VIPERView()
17
+ var presenter: protocol<VIPERPresenterProtocol, VIPERInteractorOutputProtocol> = VIPERPresenter()
18
+ var interactor: VIPERInteractorInputProtocol = VIPERInteractor()
19
+ var APIDataManager: VIPERAPIDataManagerInputProtocol = VIPERAPIDataManager()
20
+ var localDataManager: VIPERLocalDataManagerInputProtocol = VIPERLocalDataManager()
21
+ var wireFrame: VIPERWireFrameProtocol = VIPERWireFrame()
22
+
23
+ // Connecting
24
+ view.presenter = presenter
25
+ presenter.view = view
26
+ presenter.wireFrame = wireFrame
27
+ presenter.interactor = interactor
28
+ interactor.presenter = presenter
29
+ interactor.APIDataManager = APIDataManager
30
+ interactor.localDatamanager = localDataManager
31
+ }
32
+ }
@@ -1,4 +1,4 @@
1
1
  module Vipergen
2
2
  NAME = "vipergen"
3
- VERSION = "0.2.1"
4
- end
3
+ VERSION = "0.2.2"
4
+ end
@@ -44,7 +44,7 @@ end
44
44
  describe Vipergen::Generator do
45
45
  context "when renaming file content" do
46
46
  before (:each) do
47
- File.open("test.txt", 'w') {|f| f.write("I'm a #{Vipergen::Generator.REPLACEMENT_KEY} file") }
47
+ File.open("test.txt", 'w') {|f| f.write("I'm a #{Vipergen::Generator::REPLACEMENT_KEY} file") }
48
48
  end
49
49
 
50
50
  it "should rename every VIPER word to the given name" do
@@ -61,12 +61,12 @@ describe Vipergen::Generator do
61
61
 
62
62
  context "when renaming file" do
63
63
  before (:each) do
64
- File.open("#{Vipergen::Generator.REPLACEMENT_KEY}test.txt", 'w') {|f| f.write("I'm a #{Vipergen::Generator.REPLACEMENT_KEY} file") }
64
+ File.open("#{Vipergen::Generator::REPLACEMENT_KEY}test.txt", 'w') {|f| f.write("I'm a #{Vipergen::Generator::REPLACEMENT_KEY} file") }
65
65
  end
66
66
 
67
67
  it "every file should be renamed in rename_files" do
68
68
  expect(Vipergen::Generator).to receive(:rename_file)
69
- Vipergen::Generator.rename_files(["#{Vipergen::Generator.REPLACEMENT_KEY}file.txt"], "pepito")
69
+ Vipergen::Generator.rename_files(["#{Vipergen::Generator::REPLACEMENT_KEY}file.txt"], "pepito")
70
70
  end
71
71
 
72
72
  it "should raise a SyntaxError exeption if there's a file in the template without the proper name" do
@@ -74,21 +74,21 @@ describe Vipergen::Generator do
74
74
  end
75
75
 
76
76
  it "should rename the VIPER in name to the given name" do
77
- file = "#{Vipergen::Generator.REPLACEMENT_KEY}test.txt"
77
+ file = "#{Vipergen::Generator::REPLACEMENT_KEY}test.txt"
78
78
  name = "RENAMED"
79
79
  Vipergen::Generator.rename_file(file, name)
80
80
  expect(File.exist? "RENAMEDtest.txt").to eq(true)
81
81
  end
82
82
 
83
83
  it "should rename the file content after the file name rename" do
84
- file = "#{Vipergen::Generator.REPLACEMENT_KEY}test.txt"
84
+ file = "#{Vipergen::Generator::REPLACEMENT_KEY}test.txt"
85
85
  name = "RENAMED"
86
86
  expect(Vipergen::Generator).to receive(:rename_file_content)
87
87
  Vipergen::Generator.rename_file(file, name)
88
88
  end
89
89
 
90
90
  after (:each) do
91
- File.delete "#{Vipergen::Generator.REPLACEMENT_KEY}test.txt" if File.exist? "#{Vipergen::Generator.REPLACEMENT_KEY}test.txt"
91
+ File.delete "#{Vipergen::Generator::REPLACEMENT_KEY}test.txt" if File.exist? "#{Vipergen::Generator::REPLACEMENT_KEY}test.txt"
92
92
  File.delete "RENAMEDtest.txt" if File.exist? "RENAMEDtest.txt"
93
93
  end
94
94
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vipergen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Piñera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -92,18 +92,29 @@ files:
92
92
  - LICENSE
93
93
  - README.md
94
94
  - bin/vipergen
95
- - lib/templates/default/objc/DataManager/VIPERDataManager.h
96
- - lib/templates/default/objc/DataManager/VIPERDataManager.m
95
+ - lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.h
96
+ - lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.m
97
+ - lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.h
98
+ - lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.m
97
99
  - lib/templates/default/objc/Interactor/VIPERInteractor.h
98
100
  - lib/templates/default/objc/Interactor/VIPERInteractor.m
101
+ - lib/templates/default/objc/Interactor/VIPERItem.h
102
+ - lib/templates/default/objc/Interactor/VIPERItem.m
99
103
  - lib/templates/default/objc/Presenter/VIPERPresenter.h
100
104
  - lib/templates/default/objc/Presenter/VIPERPresenter.m
101
105
  - lib/templates/default/objc/Protocols/VIPERProtocols.h
102
- - lib/templates/default/objc/ViewController/VIPERViewController.h
103
- - lib/templates/default/objc/ViewController/VIPERViewController.m
106
+ - lib/templates/default/objc/View/VIPERView.h
107
+ - lib/templates/default/objc/View/VIPERView.m
104
108
  - lib/templates/default/objc/WireFrame/VIPERWireFrame.h
105
109
  - lib/templates/default/objc/WireFrame/VIPERWireFrame.m
110
+ - lib/templates/default/swift/DataManager/API/VIPERAPIDataManager.swift
111
+ - lib/templates/default/swift/DataManager/Local/VIPERLocalDataManager.swift
112
+ - lib/templates/default/swift/Interactor/VIPERInteractor.swift
113
+ - lib/templates/default/swift/Interactor/VIPERItem.swift
114
+ - lib/templates/default/swift/Presenter/VIPERPresenter.swift
106
115
  - lib/templates/default/swift/Protocols/VIPERProtocols.swift
116
+ - lib/templates/default/swift/View/VIPERView.swift
117
+ - lib/templates/default/swift/WireFrame/VIPERWireFrame.swift
107
118
  - lib/templates/default/viperspec.yml
108
119
  - lib/vipergen.rb
109
120
  - lib/vipergen/dirutils.rb
@@ -1,15 +0,0 @@
1
- //
2
- // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. 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
@@ -1,11 +0,0 @@
1
- //
2
- // Created by Pedro Piñera Buendía on 2014.
3
- // Copyright (c) 2014 Redbooth. All rights reserved.
4
- //
5
-
6
- #import "VIPERDataManager.h"
7
-
8
-
9
- @implementation VIPERDataManager
10
-
11
- @end