boa 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,6 +26,14 @@ boa init
26
26
  boa module create Example
27
27
  ```
28
28
 
29
+ ## Changes
30
+
31
+ #### v0.2.0
32
+ * added class prefix option
33
+
34
+ #### v0.1.1
35
+ * initial version
36
+
29
37
  ## Contributing
30
38
 
31
39
  Contributions are always welcome! :)
@@ -63,12 +63,15 @@ module Boa
63
63
 
64
64
  desc 'configure', 'configures project properties'
65
65
  def configure
66
- return YAML.load_file(CONFIG_FILE) if File.exists? CONFIG_FILE
66
+ config = File.exists?(CONFIG_FILE) ? YAML.load_file(CONFIG_FILE) : {}
67
67
 
68
- config = {
69
- project: ask('Project name:'),
70
- author: ask('Author:')
71
- }
68
+ project = ask("Project name [#{config[:project]}] ?")
69
+ class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
70
+ author = ask("Author [#{config[:author]}] ?")
71
+
72
+ config[:project] = project.empty? ? config[:project] || '' : project
73
+ config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
74
+ config[:author] = author.empty? ? config[:author] || '' : author
72
75
 
73
76
  File.open(CONFIG_FILE, 'w') do |f|
74
77
  f.write config.to_yaml
@@ -35,14 +35,15 @@ module Boa
35
35
  def create(module_name)
36
36
  config = invoke('boa:commands:configure', [])
37
37
 
38
- @module = module_name
39
- @author = config[:author]
40
- @project = config[:project]
41
- @date = Time.now.strftime('%d/%m/%y')
38
+ @module = module_name
39
+ @prefixed_module = config[:class_prefix] + @module
40
+ @project = config[:project]
41
+ @author = config[:author]
42
+ @date = Time.now.strftime('%d/%m/%y')
42
43
 
43
44
  # copying template files
44
45
  FILES.each do |file_name, folder|
45
- template "templates/#{file_name}", "#{BASE_PATH}/#{@module}/#{folder}/#{@module}#{file_name}"
46
+ template "templates/#{file_name}", "#{BASE_PATH}/#{@module}/#{folder}/#{@prefixed_module}#{file_name}"
46
47
  end
47
48
 
48
49
  # rendering dependencies head
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>DataManager.h
2
+ // <%= @prefixed_module %>DataManager.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -8,6 +8,6 @@
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
10
 
11
- @interface <%= @module %>DataManager : NSObject
11
+ @interface <%= @prefixed_module %>DataManager : NSObject
12
12
 
13
13
  @end
@@ -1,13 +1,13 @@
1
1
  //
2
- // <%= @module %>DataManager.m
2
+ // <%= @prefixed_module %>DataManager.m
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
6
6
  //
7
7
  //
8
8
 
9
- #import "<%= @module %>DataManager.h"
9
+ #import "<%= @prefixed_module %>DataManager.h"
10
10
 
11
- @implementation <%= @module %>DataManager
11
+ @implementation <%= @prefixed_module %>DataManager
12
12
 
13
13
  @end
@@ -2,10 +2,10 @@
2
2
  // begin <%= @module %> module
3
3
 
4
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];
5
+ <%= @prefixed_module %>Wireframe *<%= @module.downcase %>Wireframe = [[<%= @prefixed_module %>Wireframe alloc] init];
6
+ <%= @prefixed_module %>Presenter *<%= @module.downcase %>Presenter = [[<%= @prefixed_module %>Presenter alloc] init];
7
+ <%= @prefixed_module %>DataManager *<%= @module.downcase %>DataManager = [[<%= @prefixed_module %>DataManager alloc] init];
8
+ <%= @prefixed_module %>Interactor *<%= @module.downcase %>Interactor = [[<%= @prefixed_module %>Interactor alloc] init];
9
9
 
10
10
  // presenter <-> wireframe
11
11
  <%= @module.downcase %>Presenter.wireframe = <%= @module.downcase %>Wireframe;
@@ -1,4 +1,4 @@
1
- #import "<%= @module %>Wireframe.h"
2
- #import "<%= @module %>Presenter.h"
3
- #import "<%= @module %>DataManager.h"
4
- #import "<%= @module %>Interactor.h"
1
+ #import "<%= @prefixed_module %>Wireframe.h"
2
+ #import "<%= @prefixed_module %>Presenter.h"
3
+ #import "<%= @prefixed_module %>DataManager.h"
4
+ #import "<%= @prefixed_module %>Interactor.h"
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>Interactor.h
2
+ // <%= @prefixed_module %>Interactor.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -8,14 +8,14 @@
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
10
 
11
- #import "<%= @module %>Presenter.h"
12
- #import "<%= @module %>DataManager.h"
11
+ #import "<%= @prefixed_module %>Presenter.h"
12
+ #import "<%= @prefixed_module %>DataManager.h"
13
13
 
14
- @class <%= @module %>Presenter;
14
+ @class <%= @prefixed_module %>Presenter;
15
15
 
16
- @interface <%= @module %>Interactor : NSObject
16
+ @interface <%= @prefixed_module %>Interactor : NSObject
17
17
 
18
- @property (nonatomic, strong) <%= @module %>Presenter *presenter;
19
- @property (nonatomic, strong) <%= @module %>DataManager *dataManager;
18
+ @property (nonatomic, strong) <%= @prefixed_module %>Presenter *presenter;
19
+ @property (nonatomic, strong) <%= @prefixed_module %>DataManager *dataManager;
20
20
 
21
21
  @end
@@ -1,13 +1,13 @@
1
1
  //
2
- // <%= @module %>Interactor.m
2
+ // <%= @prefixed_module %>Interactor.m
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
6
6
  //
7
7
  //
8
8
 
9
- #import "<%= @module %>Interactor.h"
9
+ #import "<%= @prefixed_module %>Interactor.h"
10
10
 
11
- @implementation <%= @module %>Interactor
11
+ @implementation <%= @prefixed_module %>Interactor
12
12
 
13
13
  @end
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>ModuleInterface.h
2
+ // <%= @prefixed_module %>ModuleInterface.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -8,10 +8,10 @@
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
10
 
11
- @protocol <%= @module %>ModuleInterface <NSObject>
11
+ @protocol <%= @prefixed_module %>ModuleInterface <NSObject>
12
12
 
13
13
  @end
14
14
 
15
- @protocol <%= @module %>ModuleDelegate <NSObject>
15
+ @protocol <%= @prefixed_module %>ModuleDelegate <NSObject>
16
16
 
17
17
  @end
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>Presenter.h
2
+ // <%= @prefixed_module %>Presenter.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -8,20 +8,20 @@
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
10
 
11
- #import "<%= @module %>ModuleInterface.h"
11
+ #import "<%= @prefixed_module %>ModuleInterface.h"
12
12
 
13
- #import "<%= @module %>Interactor.h"
14
- #import "<%= @module %>Wireframe.h"
15
- #import "<%= @module %>ViewInterface.h"
13
+ #import "<%= @prefixed_module %>Interactor.h"
14
+ #import "<%= @prefixed_module %>Wireframe.h"
15
+ #import "<%= @prefixed_module %>ViewInterface.h"
16
16
 
17
- @class <%= @module %>Wireframe;
18
- @class <%= @module %>Interactor;
17
+ @class <%= @prefixed_module %>Wireframe;
18
+ @class <%= @prefixed_module %>Interactor;
19
19
 
20
- @interface <%= @module %>Presenter : NSObject <<%= @module %>ModuleInterface>
20
+ @interface <%= @prefixed_module %>Presenter : NSObject <<%= @prefixed_module %>ModuleInterface>
21
21
 
22
- @property (nonatomic, strong) <%= @module %>Interactor *interactor;
23
- @property (nonatomic, strong) <%= @module %>Wireframe *wireframe;
22
+ @property (nonatomic, strong) <%= @prefixed_module %>Interactor *interactor;
23
+ @property (nonatomic, strong) <%= @prefixed_module %>Wireframe *wireframe;
24
24
 
25
- @property (nonatomic, strong) UIViewController<<%= @module %>ViewInterface> *userInterface;
25
+ @property (nonatomic, strong) UIViewController<<%= @prefixed_module %>ViewInterface> *userInterface;
26
26
 
27
27
  @end
@@ -1,16 +1,16 @@
1
1
  //
2
- // <%= @module %>Presenter.m
2
+ // <%= @prefixed_module %>Presenter.m
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
6
6
  //
7
7
  //
8
8
 
9
- #import "<%= @module %>Presenter.h"
9
+ #import "<%= @prefixed_module %>Presenter.h"
10
10
 
11
- @implementation <%= @module %>Presenter
11
+ @implementation <%= @prefixed_module %>Presenter
12
12
 
13
- #pragma mark - <%= @module %>ModuleInterface methods
13
+ #pragma mark - <%= @prefixed_module %>ModuleInterface methods
14
14
 
15
15
  // implement module interface here
16
16
 
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>ViewController.h
2
+ // <%= @prefixed_module %>ViewController.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -8,12 +8,12 @@
8
8
 
9
9
  #import <UIKit/UIKit.h>
10
10
 
11
- #import "<%= @module %>ModuleInterface.h"
12
- #import "<%= @module %>ViewInterface.h"
11
+ #import "<%= @prefixed_module %>ModuleInterface.h"
12
+ #import "<%= @prefixed_module %>ViewInterface.h"
13
13
 
14
- @interface <%= @module %>ViewController : UIViewController <<%= @module %>ViewInterface>
14
+ @interface <%= @prefixed_module %>ViewController : UIViewController <<%= @prefixed_module %>ViewInterface>
15
15
 
16
- @property (nonatomic, strong) id<<%= @module %>ModuleInterface> eventHandler;
16
+ @property (nonatomic, strong) id<<%= @prefixed_module %>ModuleInterface> eventHandler;
17
17
 
18
18
  // *** add UI events here
19
19
 
@@ -1,18 +1,18 @@
1
1
  //
2
- // <%= @module %>ViewController.m
2
+ // <%= @prefixed_module %>ViewController.m
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
6
6
  //
7
7
  //
8
8
 
9
- #import "<%= @module %>ViewController.h"
9
+ #import "<%= @prefixed_module %>ViewController.h"
10
10
 
11
- @interface <%= @module %>ViewController ()
11
+ @interface <%= @prefixed_module %>ViewController ()
12
12
 
13
13
  @end
14
14
 
15
- @implementation <%= @module %>ViewController
15
+ @implementation <%= @prefixed_module %>ViewController
16
16
 
17
17
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
18
18
  {
@@ -41,7 +41,7 @@
41
41
  [super viewDidAppear:animated];
42
42
  }
43
43
 
44
- #pragma mark - <%= @module %>ViewInterface methods
44
+ #pragma mark - <%= @prefixed_module %>ViewInterface methods
45
45
 
46
46
  // *** implement view_interface methods here
47
47
 
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>View.h
2
+ // <%= @prefixed_module %>View.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -8,6 +8,6 @@
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
10
 
11
- @protocol <%= @module %>ViewInterface <NSObject>
11
+ @protocol <%= @prefixed_module %>ViewInterface <NSObject>
12
12
 
13
13
  @end
@@ -1,5 +1,5 @@
1
1
  //
2
- // <%= @module %>Wireframe.h
2
+ // <%= @prefixed_module %>Wireframe.h
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
@@ -9,14 +9,14 @@
9
9
  #import <Foundation/Foundation.h>
10
10
 
11
11
  #import "RootWireframe.h"
12
- #import "<%= @module %>Presenter.h"
12
+ #import "<%= @prefixed_module %>Presenter.h"
13
13
 
14
- @class <%= @module %>Presenter;
14
+ @class <%= @prefixed_module %>Presenter;
15
15
 
16
- @interface <%= @module %>Wireframe : NSObject
16
+ @interface <%= @prefixed_module %>Wireframe : NSObject
17
17
 
18
18
  @property (nonatomic, strong) RootWireframe *rootWireframe;
19
- @property (nonatomic, strong) <%= @module %>Presenter *presenter;
19
+ @property (nonatomic, strong) <%= @prefixed_module %>Presenter *presenter;
20
20
 
21
21
  // initialization
22
22
  - (void)presentSelfFromViewController:(UIViewController *)viewController;
@@ -1,26 +1,26 @@
1
1
  //
2
- // <%= @module %>Wireframe.m
2
+ // <%= @prefixed_module %>Wireframe.m
3
3
  // <%= @project %>
4
4
  //
5
5
  // Created by <%= @author %> on <%= @date %>.
6
6
  //
7
7
  //
8
8
 
9
- #import "<%= @module %>Wireframe.h"
10
- #import "<%= @module %>ViewController.h"
9
+ #import "<%= @prefixed_module %>Wireframe.h"
10
+ #import "<%= @prefixed_module %>ViewController.h"
11
11
 
12
- @interface <%= @module %>Wireframe ()
12
+ @interface <%= @prefixed_module %>Wireframe ()
13
13
 
14
- @property (nonatomic, strong) <%= @module %>ViewController *viewController;
14
+ @property (nonatomic, strong) <%= @prefixed_module %>ViewController *viewController;
15
15
 
16
16
  @end
17
17
 
18
- @implementation <%= @module %>Wireframe
18
+ @implementation <%= @prefixed_module %>Wireframe
19
19
 
20
20
  - (void)presentSelfFromViewController:(UIViewController *)viewController
21
21
  {
22
22
  // save reference
23
- self.viewController = [[<%= @module %>ViewController alloc] initWithNibName:@"<%= @module %>ViewController" bundle:nil];
23
+ self.viewController = [[<%= @prefixed_module %>ViewController alloc] initWithNibName:@"<%= @prefixed_module %>ViewController" bundle:nil];
24
24
 
25
25
  // view <-> presenter
26
26
  self.presenter.userInterface = self.viewController;
@@ -1,3 +1,3 @@
1
1
  module Boa
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-23 00:00:00.000000000 Z
12
+ date: 2014-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler