boa 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +2 -0
- data/bin/boa +10 -0
- data/boa.gemspec +24 -0
- data/lib/boa.rb +2 -0
- data/lib/boa/commands.rb +80 -0
- data/lib/boa/module/module.rb +76 -0
- data/lib/boa/module/templates/DataManager.h +13 -0
- data/lib/boa/module/templates/DataManager.m +13 -0
- data/lib/boa/module/templates/DependenciesBody.m +32 -0
- data/lib/boa/module/templates/DependenciesHead.m +4 -0
- data/lib/boa/module/templates/Interactor.h +21 -0
- data/lib/boa/module/templates/Interactor.m +13 -0
- data/lib/boa/module/templates/ModuleInterface.h +17 -0
- data/lib/boa/module/templates/Presenter.h +27 -0
- data/lib/boa/module/templates/Presenter.m +17 -0
- data/lib/boa/module/templates/ViewController.h +20 -0
- data/lib/boa/module/templates/ViewController.m +52 -0
- data/lib/boa/module/templates/ViewInterface.h +13 -0
- data/lib/boa/module/templates/Wireframe.h +24 -0
- data/lib/boa/module/templates/Wireframe.m +33 -0
- data/lib/boa/templates/AppDelegate.h +15 -0
- data/lib/boa/templates/AppDelegate.m +38 -0
- data/lib/boa/templates/AppDependencies.h +17 -0
- data/lib/boa/templates/AppDependencies.m +50 -0
- data/lib/boa/templates/RootWireframe.h +16 -0
- data/lib/boa/templates/RootWireframe.m +27 -0
- data/lib/boa/version.rb +3 -0
- metadata +126 -0
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Balazs Kovacs
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Boa
|
2
|
+
|
3
|
+
Boa is a simple gem to initialize VIPER projects and add modules to them.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'boa'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install boa
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
1. Create an Xcode project
|
22
|
+
|
23
|
+
2. Initialize basic VIPER structure with
|
24
|
+
|
25
|
+
boa init
|
26
|
+
|
27
|
+
3. Input your project name and the author (these will be used in generated files). You can change these settings in `.boa.yml`
|
28
|
+
|
29
|
+
4. Create your module with
|
30
|
+
|
31
|
+
boa module create Example
|
32
|
+
|
data/Rakefile
ADDED
data/bin/boa
ADDED
data/boa.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'boa/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "boa"
|
8
|
+
spec.version = Boa::VERSION
|
9
|
+
spec.authors = ["Balazs Kovacs"]
|
10
|
+
spec.email = ["balazs.kovacs@jbslabs.com"]
|
11
|
+
spec.summary = %q{A simple gem for creating VIPER projects and modules.}
|
12
|
+
spec.description = %q{This gem provides VIPER initialization and module generation functionalities.}
|
13
|
+
spec.homepage = "http://jbslabs.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "thor"
|
24
|
+
end
|
data/lib/boa.rb
ADDED
data/lib/boa/commands.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'boa/module/module'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Boa
|
5
|
+
class Commands < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
# ----
|
9
|
+
# register additional moduls
|
10
|
+
register(Boa::Module, 'module', 'module [COMMAND]', 'Managing modules.')
|
11
|
+
Boa::Commands.source_root(File.dirname(__FILE__))
|
12
|
+
|
13
|
+
# ----
|
14
|
+
# initialize VIPER hierarchy
|
15
|
+
BASE_FILES = {
|
16
|
+
'AppDelegate.h' => 'Classes',
|
17
|
+
'AppDelegate.m' => 'Classes',
|
18
|
+
'AppDependencies.h' => 'Classes',
|
19
|
+
'AppDependencies.m' => 'Classes'
|
20
|
+
}
|
21
|
+
|
22
|
+
PROJECT_FILES = {
|
23
|
+
'RootWireframe.h' => 'Classes/Common/Wireframe',
|
24
|
+
'RootWireframe.m' => 'Classes/Common/Wireframe'
|
25
|
+
}
|
26
|
+
|
27
|
+
desc 'init', 'initializes VIPER project'
|
28
|
+
def init
|
29
|
+
config = invoke(:configure, [])
|
30
|
+
|
31
|
+
# Classes
|
32
|
+
empty_directory 'Classes'
|
33
|
+
|
34
|
+
# Classes/Common
|
35
|
+
empty_directory 'Classes/Common'
|
36
|
+
empty_directory 'Classes/Common/Categories'
|
37
|
+
empty_directory 'Classes/Common/Model'
|
38
|
+
empty_directory 'Classes/Common/Store'
|
39
|
+
empty_directory 'Classes/Common/Utils'
|
40
|
+
empty_directory 'Classes/Common/Wireframe'
|
41
|
+
|
42
|
+
# Classes/Modules
|
43
|
+
empty_directory 'Classes/Modules'
|
44
|
+
|
45
|
+
# Add config
|
46
|
+
@project = config[:project]
|
47
|
+
@author = config[:author]
|
48
|
+
@date = Time.now.strftime('%d/%m/%y')
|
49
|
+
|
50
|
+
# Generate files
|
51
|
+
BASE_FILES.each do |file_name, folder|
|
52
|
+
template "templates/#{file_name}", "#{folder}/#{@project}#{file_name}"
|
53
|
+
end
|
54
|
+
|
55
|
+
PROJECT_FILES.each do |file_name, folder|
|
56
|
+
template "templates/#{file_name}", "#{folder}/#{file_name}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# ----
|
61
|
+
# configuration
|
62
|
+
CONFIG_FILE = '.boa.yml'
|
63
|
+
|
64
|
+
desc 'configure', 'configures project properties'
|
65
|
+
def configure
|
66
|
+
return YAML.load_file(CONFIG_FILE) if File.exists? CONFIG_FILE
|
67
|
+
|
68
|
+
config = {
|
69
|
+
project: ask('Project name:'),
|
70
|
+
author: ask('Author:')
|
71
|
+
}
|
72
|
+
|
73
|
+
File.open(CONFIG_FILE, 'w') do |f|
|
74
|
+
f.write config.to_yaml
|
75
|
+
end
|
76
|
+
|
77
|
+
config
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
module Boa
|
4
|
+
class Module < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
BASE_PATH = 'Classes/Modules'
|
8
|
+
|
9
|
+
FILES = {
|
10
|
+
'DataManager.h' => 'DataManager',
|
11
|
+
'DataManager.m' => 'DataManager',
|
12
|
+
'Interactor.h' => 'Interactor',
|
13
|
+
'Interactor.m' => 'Interactor',
|
14
|
+
'ModuleInterface.h' => 'ModuleInterface',
|
15
|
+
'Presenter.h' => 'Presenter',
|
16
|
+
'Presenter.m' => 'Presenter',
|
17
|
+
'ViewInterface.h' => 'View',
|
18
|
+
'ViewController.h' => 'View',
|
19
|
+
'ViewController.m' => 'View',
|
20
|
+
'Wireframe.h' => 'Wireframe',
|
21
|
+
'Wireframe.m' => 'Wireframe'
|
22
|
+
}
|
23
|
+
|
24
|
+
Boa::Module.source_root(File.dirname(__FILE__))
|
25
|
+
|
26
|
+
desc 'list', 'lists available VIPER modules'
|
27
|
+
def list
|
28
|
+
return unless File.exists? BASE_PATH
|
29
|
+
|
30
|
+
module_names = Dir.entries(BASE_PATH).reject { |d| d == '.' || d == '..' }
|
31
|
+
print_table module_names.map.with_index { |m, i| [i+1, m] }
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'create NAME', 'adds a new VIPER module with the specified name'
|
35
|
+
def create(module_name)
|
36
|
+
config = invoke('boa:commands:configure', [])
|
37
|
+
|
38
|
+
@module = module_name
|
39
|
+
@author = config[:author]
|
40
|
+
@project = config[:project]
|
41
|
+
@date = Time.now.strftime('%d/%m/%y')
|
42
|
+
|
43
|
+
# copying template files
|
44
|
+
FILES.each do |file_name, folder|
|
45
|
+
template "templates/#{file_name}", "#{BASE_PATH}/#{@module}/#{folder}/#{@module}#{file_name}"
|
46
|
+
end
|
47
|
+
|
48
|
+
# rendering dependencies head
|
49
|
+
path = Dir::Tmpname.create('dep') { |path| path }
|
50
|
+
template 'templates/DependenciesHead.m', path
|
51
|
+
|
52
|
+
say "\nAdd these lines to the AppDependencies imports:\n\n", :green
|
53
|
+
say File.open(path).read + "\n", :yellow
|
54
|
+
|
55
|
+
# rendering dependencies body
|
56
|
+
path = Dir::Tmpname.create('dep') { |path| path }
|
57
|
+
template 'templates/DependenciesBody.m', path
|
58
|
+
|
59
|
+
say "\nAdd these lines to the AppDependencies#configureDependencies:\n\n", :green
|
60
|
+
say File.open(path).read + "\n", :yellow
|
61
|
+
end
|
62
|
+
|
63
|
+
desc 'destroy NAME', 'destroys VIPER module with the specified name'
|
64
|
+
def destroy(module_name)
|
65
|
+
@module = module_name
|
66
|
+
|
67
|
+
module_path = "#{BASE_PATH}/#{@module}"
|
68
|
+
|
69
|
+
if File.exists? module_path
|
70
|
+
remove_dir module_path if yes?("Really destroy module: #{@module}? [y/N]")
|
71
|
+
else
|
72
|
+
say "No such module: #{@module}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// ------------------------------------------------------------------
|
2
|
+
// begin <%= @module %> module
|
3
|
+
|
4
|
+
// instantiate classes
|
5
|
+
<%= @module %>Wireframe *<%= @module.downcase %>Wireframe = [[<%= @module %>Wireframe alloc] init];
|
6
|
+
<%= @module %>Presenter *<%= @module.downcase %>Presenter = [[<%= @module %>Presenter alloc] init];
|
7
|
+
<%= @module %>DataManager *<%= @module.downcase %>DataManager = [[<%= @module %>DataManager alloc] init];
|
8
|
+
<%= @module %>Interactor *<%= @module.downcase %>Interactor = [[<%= @module %>Interactor alloc] init];
|
9
|
+
|
10
|
+
// presenter <-> wireframe
|
11
|
+
<%= @module.downcase %>Presenter.wireframe = <%= @module.downcase %>Wireframe;
|
12
|
+
<%= @module.downcase %>Wireframe.presenter = <%= @module.downcase %>Presenter;
|
13
|
+
|
14
|
+
// presenter <-> interactor
|
15
|
+
<%= @module.downcase %>Presenter.interactor = <%= @module.downcase %>Interactor;
|
16
|
+
<%= @module.downcase %>Interactor.presenter = <%= @module.downcase %>Presenter;
|
17
|
+
|
18
|
+
// interactor -> data_manager
|
19
|
+
<%= @module.downcase %>Interactor.dataManager = <%= @module.downcase %>DataManager;
|
20
|
+
|
21
|
+
// data_manager -> data_store
|
22
|
+
// *** connect datastore
|
23
|
+
|
24
|
+
// connect wireframes
|
25
|
+
<%= @module.downcase %>Wireframe.rootWireframe = rootWireframe;
|
26
|
+
// *** connect more wireframes
|
27
|
+
|
28
|
+
// configure delegate
|
29
|
+
// *** add delegate here if needed
|
30
|
+
|
31
|
+
// end <%= @module %> module
|
32
|
+
// ------------------------------------------------------------------
|
@@ -0,0 +1,21 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>Interactor.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
#import "<%= @module %>Presenter.h"
|
12
|
+
#import "<%= @module %>DataManager.h"
|
13
|
+
|
14
|
+
@class <%= @module %>Presenter;
|
15
|
+
|
16
|
+
@interface <%= @module %>Interactor : NSObject
|
17
|
+
|
18
|
+
@property (nonatomic, strong) <%= @module %>Presenter *presenter;
|
19
|
+
@property (nonatomic, strong) <%= @module %>DataManager *dataManager;
|
20
|
+
|
21
|
+
@end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>ModuleInterface.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
@protocol <%= @module %>ModuleInterface <NSObject>
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@protocol <%= @module %>ModuleDelegate <NSObject>
|
16
|
+
|
17
|
+
@end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>Presenter.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
#import "<%= @module %>ModuleInterface.h"
|
12
|
+
|
13
|
+
#import "<%= @module %>Interactor.h"
|
14
|
+
#import "<%= @module %>Wireframe.h"
|
15
|
+
#import "<%= @module %>ViewInterface.h"
|
16
|
+
|
17
|
+
@class <%= @module %>Wireframe;
|
18
|
+
@class <%= @module %>Interactor;
|
19
|
+
|
20
|
+
@interface <%= @module %>Presenter : NSObject <<%= @module %>ModuleInterface>
|
21
|
+
|
22
|
+
@property (nonatomic, strong) <%= @module %>Interactor *interactor;
|
23
|
+
@property (nonatomic, strong) <%= @module %>Wireframe *wireframe;
|
24
|
+
|
25
|
+
@property (nonatomic, strong) UIViewController<<%= @module %>ViewInterface> *userInterface;
|
26
|
+
|
27
|
+
@end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>Presenter.m
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "<%= @module %>Presenter.h"
|
10
|
+
|
11
|
+
@implementation <%= @module %>Presenter
|
12
|
+
|
13
|
+
#pragma mark - <%= @module %>ModuleInterface methods
|
14
|
+
|
15
|
+
// implement module interface here
|
16
|
+
|
17
|
+
@end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>ViewController.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
|
11
|
+
#import "<%= @module %>ModuleInterface.h"
|
12
|
+
#import "<%= @module %>ViewInterface.h"
|
13
|
+
|
14
|
+
@interface <%= @module %>ViewController : UIViewController <<%= @module %>ViewInterface>
|
15
|
+
|
16
|
+
@property (nonatomic, strong) id<<%= @module %>ModuleInterface> eventHandler;
|
17
|
+
|
18
|
+
// *** add UI events here
|
19
|
+
|
20
|
+
@end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>ViewController.m
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "<%= @module %>ViewController.h"
|
10
|
+
|
11
|
+
@interface <%= @module %>ViewController ()
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@implementation <%= @module %>ViewController
|
16
|
+
|
17
|
+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
18
|
+
{
|
19
|
+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
20
|
+
if (self)
|
21
|
+
{
|
22
|
+
// Custom initialization
|
23
|
+
}
|
24
|
+
return self;
|
25
|
+
}
|
26
|
+
|
27
|
+
#pragma mark - View lifecycle
|
28
|
+
|
29
|
+
- (void)viewDidLoad
|
30
|
+
{
|
31
|
+
[super viewDidLoad];
|
32
|
+
}
|
33
|
+
|
34
|
+
- (void)viewWillAppear:(BOOL)animated
|
35
|
+
{
|
36
|
+
[super viewWillAppear:animated];
|
37
|
+
}
|
38
|
+
|
39
|
+
- (void)viewDidAppear:(BOOL)animated
|
40
|
+
{
|
41
|
+
[super viewDidAppear:animated];
|
42
|
+
}
|
43
|
+
|
44
|
+
#pragma mark - <%= @module %>ViewInterface methods
|
45
|
+
|
46
|
+
// *** implement view_interface methods here
|
47
|
+
|
48
|
+
#pragma mark - Button event handlers
|
49
|
+
|
50
|
+
// ** handle UI events here
|
51
|
+
|
52
|
+
@end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>Wireframe.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
#import "RootWireframe.h"
|
12
|
+
#import "<%= @module %>Presenter.h"
|
13
|
+
|
14
|
+
@class <%= @module %>Presenter;
|
15
|
+
|
16
|
+
@interface <%= @module %>Wireframe : NSObject
|
17
|
+
|
18
|
+
@property (nonatomic, strong) RootWireframe *rootWireframe;
|
19
|
+
@property (nonatomic, strong) <%= @module %>Presenter *presenter;
|
20
|
+
|
21
|
+
// initialization
|
22
|
+
- (void)presentSelfFromViewController:(UIViewController *)viewController;
|
23
|
+
|
24
|
+
@end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
//
|
2
|
+
// <%= @module %>Wireframe.m
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "<%= @module %>Wireframe.h"
|
10
|
+
#import "<%= @module %>ViewController.h"
|
11
|
+
|
12
|
+
@interface <%= @module %>Wireframe ()
|
13
|
+
|
14
|
+
@property (nonatomic, strong) <%= @module %>ViewController *viewController;
|
15
|
+
|
16
|
+
@end
|
17
|
+
|
18
|
+
@implementation <%= @module %>Wireframe
|
19
|
+
|
20
|
+
- (void)presentSelfFromViewController:(UIViewController *)viewController
|
21
|
+
{
|
22
|
+
// save reference
|
23
|
+
self.viewController = [[<%= @module %>ViewController alloc] initWithNibName:@"<%= @module %>ViewController" bundle:nil];
|
24
|
+
|
25
|
+
// view <-> presenter
|
26
|
+
self.presenter.userInterface = self.viewController;
|
27
|
+
self.viewController.eventHandler = self.presenter;
|
28
|
+
|
29
|
+
// present controller
|
30
|
+
// *** present self with RootViewController
|
31
|
+
}
|
32
|
+
|
33
|
+
@end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// <%= @project %>AppDelegate.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
|
11
|
+
@interface <%= @project %>AppDelegate : UIResponder <UIApplicationDelegate>
|
12
|
+
|
13
|
+
@property (strong, nonatomic) UIWindow *window;
|
14
|
+
|
15
|
+
@end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
//
|
2
|
+
// <%= @project %>AppDelegate.m
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "<%= @project %>AppDelegate.h"
|
10
|
+
#import "<%= @project %>AppDependencies.h"
|
11
|
+
|
12
|
+
@interface <%= @project %>AppDelegate ()
|
13
|
+
|
14
|
+
@property (nonatomic, strong) <%= @project %>AppDependencies *dependencies;
|
15
|
+
|
16
|
+
@end
|
17
|
+
|
18
|
+
@implementation <%= @project %>AppDelegate
|
19
|
+
|
20
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
21
|
+
{
|
22
|
+
// initialize window
|
23
|
+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
24
|
+
_window.backgroundColor = [UIColor whiteColor];
|
25
|
+
|
26
|
+
// initialize dependencies
|
27
|
+
<%= @project %>AppDependencies *dependencies = [[<%= @project %>AppDependencies alloc] initWithWindow:self.window];
|
28
|
+
self.dependencies = dependencies;
|
29
|
+
|
30
|
+
// adding RootViewController
|
31
|
+
[self.dependencies installRootViewController];
|
32
|
+
|
33
|
+
[_window makeKeyAndVisible];
|
34
|
+
|
35
|
+
return YES;
|
36
|
+
}
|
37
|
+
|
38
|
+
@end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
// <%= @project %>AppDependencies.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
#import <UIKit/UIKit.h>
|
11
|
+
|
12
|
+
@interface <%= @project %>AppDependencies : NSObject
|
13
|
+
|
14
|
+
- (id)initWithWindow:(UIWindow *)window;
|
15
|
+
- (void)installRootViewController;
|
16
|
+
|
17
|
+
@end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
//
|
2
|
+
// <%= @project %>AppDependencies.m
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "<%= @project %>AppDependencies.h"
|
10
|
+
|
11
|
+
#import "RootWireframe.h"
|
12
|
+
|
13
|
+
#import "HomeWireframe.h"
|
14
|
+
#import "HomePresenter.h"
|
15
|
+
#import "HomeDataManager.h"
|
16
|
+
#import "HomeInteractor.h"
|
17
|
+
|
18
|
+
@interface <%= @project %>AppDependencies ()
|
19
|
+
|
20
|
+
@end
|
21
|
+
|
22
|
+
@implementation <%= @project %>AppDependencies
|
23
|
+
|
24
|
+
- (id)initWithWindow:(UIWindow *)window
|
25
|
+
{
|
26
|
+
if ((self = [super init]))
|
27
|
+
{
|
28
|
+
[self configureDependencies:window];
|
29
|
+
}
|
30
|
+
|
31
|
+
return self;
|
32
|
+
}
|
33
|
+
|
34
|
+
- (void)installRootViewController
|
35
|
+
{
|
36
|
+
// *** present first wireframe here
|
37
|
+
}
|
38
|
+
|
39
|
+
- (void)configureDependencies:(UIWindow *)window
|
40
|
+
{
|
41
|
+
// -----
|
42
|
+
// root classes
|
43
|
+
RootWireframe *rootWireframe = [[RootWireframe alloc] initWithWindow:window];
|
44
|
+
// *** add datastore
|
45
|
+
|
46
|
+
// *** module initialization
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
@end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//
|
2
|
+
// RootWireframe.h
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
#import <Foundation/Foundation.h>
|
11
|
+
|
12
|
+
@interface RootWireframe : NSObject
|
13
|
+
|
14
|
+
- (id)initWithWindow:(UIWindow *)window;
|
15
|
+
|
16
|
+
@end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
// RootWireframe.m
|
3
|
+
// <%= @project %>
|
4
|
+
//
|
5
|
+
// Created by <%= @author %> on <%= @date %>.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "RootWireframe.h"
|
10
|
+
|
11
|
+
@interface RootWireframe ()
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@implementation RootWireframe
|
16
|
+
|
17
|
+
- (id)initWithWindow:(UIWindow *)window
|
18
|
+
{
|
19
|
+
if ((self = [super init]))
|
20
|
+
{
|
21
|
+
// custom initialization
|
22
|
+
}
|
23
|
+
|
24
|
+
return self;
|
25
|
+
}
|
26
|
+
|
27
|
+
@end
|
data/lib/boa/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: boa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Balazs Kovacs
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.6'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thor
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: This gem provides VIPER initialization and module generation functionalities.
|
63
|
+
email:
|
64
|
+
- balazs.kovacs@jbslabs.com
|
65
|
+
executables:
|
66
|
+
- boa
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/boa
|
76
|
+
- boa.gemspec
|
77
|
+
- lib/boa.rb
|
78
|
+
- lib/boa/commands.rb
|
79
|
+
- lib/boa/module/module.rb
|
80
|
+
- lib/boa/module/templates/DataManager.h
|
81
|
+
- lib/boa/module/templates/DataManager.m
|
82
|
+
- lib/boa/module/templates/DependenciesBody.m
|
83
|
+
- lib/boa/module/templates/DependenciesHead.m
|
84
|
+
- lib/boa/module/templates/Interactor.h
|
85
|
+
- lib/boa/module/templates/Interactor.m
|
86
|
+
- lib/boa/module/templates/ModuleInterface.h
|
87
|
+
- lib/boa/module/templates/Presenter.h
|
88
|
+
- lib/boa/module/templates/Presenter.m
|
89
|
+
- lib/boa/module/templates/ViewController.h
|
90
|
+
- lib/boa/module/templates/ViewController.m
|
91
|
+
- lib/boa/module/templates/ViewInterface.h
|
92
|
+
- lib/boa/module/templates/Wireframe.h
|
93
|
+
- lib/boa/module/templates/Wireframe.m
|
94
|
+
- lib/boa/templates/AppDelegate.h
|
95
|
+
- lib/boa/templates/AppDelegate.m
|
96
|
+
- lib/boa/templates/AppDependencies.h
|
97
|
+
- lib/boa/templates/AppDependencies.m
|
98
|
+
- lib/boa/templates/RootWireframe.h
|
99
|
+
- lib/boa/templates/RootWireframe.m
|
100
|
+
- lib/boa/version.rb
|
101
|
+
homepage: http://jbslabs.com
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 1.8.28
|
123
|
+
signing_key:
|
124
|
+
specification_version: 3
|
125
|
+
summary: A simple gem for creating VIPER projects and modules.
|
126
|
+
test_files: []
|