swift-boiler 1.0.8 → 1.0.9
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 +4 -4
- data/README.md +8 -21
- data/lib/swift/boiler.rb +20 -5
- data/lib/swift/boiler/builder.rb +0 -1
- data/lib/swift/boiler/templates/help.mustache +25 -0
- data/lib/swift/boiler/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 765c76975b8f6b9706bd3f23606169459401616f
|
4
|
+
data.tar.gz: 1cc95f7349785cbaf9e6014671e40bf669da68ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f37560fdf420ffbfe426d1a1be5505a78b46c91496ebfa3ed1d77c5dddaf90fae0d266071d8e5262d563c94c069b49c76841eeafd54d2a74d017c0a3e53111f
|
7
|
+
data.tar.gz: 060b16020116d5b8b67bbc18ccb9218d01c76ef1e4a22e134c9dcc594e140318629eba049a32d5a511b79d61eb08b35788ec4ac82dd336ddd49e60bba29fac96
|
data/README.md
CHANGED
@@ -4,41 +4,28 @@ Swift-Boiler is a tool developed for iOS developers to speed up the process of i
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
### Install Swift-Boiler
|
7
|
+
### Install Swift-Boiler:
|
8
8
|
|
9
9
|
```sh
|
10
10
|
$ gem install swift-boiler
|
11
11
|
```
|
12
12
|
|
13
|
-
<!-- ### Install it with [Homebrew](http://brew.sh):
|
14
|
-
|
15
|
-
```sh
|
16
|
-
$ gem install swift-boiler
|
17
|
-
``` -->
|
18
|
-
|
19
13
|
## Usage
|
20
14
|
|
21
|
-
|
22
|
-
<summary>swi
|
23
|
-
ft-boil \<option\></summary>
|
15
|
+
Commands follow this specific syntax:
|
24
16
|
|
25
17
|
```sh
|
26
18
|
$ swift-boil --help
|
19
|
+
$ swift-boil v MyView mainlabel:UILabel firstView:UIView secondView:CustomView
|
20
|
+
$ swift-boil view MyView -p mainlabel:UILabel firstView:UIView secondView:CustomView
|
27
21
|
```
|
28
22
|
|
29
|
-
<summary>
|
23
|
+
<summary>To use a custom template use:</summary>
|
30
24
|
|
31
25
|
```sh
|
32
26
|
$ swift-boil -t /Desktop/mytemplate.mustache MyView toplabel:UILabel bottomlabel:UILabel
|
33
|
-
$ swift-boil -t /Desktop/mytemplate.mustache MyView -
|
34
|
-
```
|
35
|
-
|
36
|
-
<summary>swift-boil \<command\> \<class_name\> \<options\> \<properties\></summary>
|
37
|
-
|
38
|
-
``sh
|
39
|
-
$ swift-boil v MyView mainlabel:UILabel firstView:UIView secondView:CustomView
|
40
|
-
$ swift-boil view MyView -d mainlabel:UILabel firstView:UIView secondView:CustomView
|
41
|
-
```
|
27
|
+
$ swift-boil -t /Desktop/mytemplate.mustache MyView -p toplabel:UILabel bottomlabel:UILabel
|
28
|
+
```
|
42
29
|
|
43
30
|
### Commands:
|
44
31
|
- `view or v`: command to generate the boiler plate code for a view
|
@@ -49,7 +36,7 @@ $ swift-boil view MyView -d mainlabel:UILabel firstView:UIView secondView:Custom
|
|
49
36
|
|
50
37
|
### Options:
|
51
38
|
- `--help or -h`: shows usage details
|
52
|
-
- `--
|
39
|
+
- `--protocol or -p`: it indicates that Swift-Boiler should add a delegate or data source to the class being generated
|
53
40
|
- `--template or -t`: allows user to specify a custom template to be used to generate code
|
54
41
|
|
55
42
|
## Development
|
data/lib/swift/boiler.rb
CHANGED
@@ -9,11 +9,15 @@ module Swift
|
|
9
9
|
class << self
|
10
10
|
|
11
11
|
def boil(arguments)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
if is_help_request(arguments)
|
13
|
+
print_help_text()
|
14
|
+
else
|
15
|
+
begin
|
16
|
+
template = build_template_from_arguments(arguments)
|
17
|
+
create_file_from_template(template)
|
18
|
+
rescue ArgumentError => argumentError
|
19
|
+
print "swift-boiler: #{argumentError.message}. Please see 'swift-boil --help'."
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
@@ -32,6 +36,17 @@ module Swift
|
|
32
36
|
template
|
33
37
|
end
|
34
38
|
|
39
|
+
def is_help_request(arguments)
|
40
|
+
return arguments[0] == '-h' || arguments[0] == '--help' || arguments == []
|
41
|
+
end
|
42
|
+
|
43
|
+
def print_help_text()
|
44
|
+
file = File.dirname(__FILE__) + '/boiler/templates/help.mustache'
|
45
|
+
File.readlines(file).each do |line|
|
46
|
+
puts line
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
35
50
|
end
|
36
51
|
end
|
37
52
|
end
|
data/lib/swift/boiler/builder.rb
CHANGED
@@ -6,7 +6,6 @@ module Swift
|
|
6
6
|
Mustache.template_file = template.template_path
|
7
7
|
mustache_template = Mustache.new
|
8
8
|
mustache_template[:class_name] = template.class_name
|
9
|
-
#mustache_template[:dev_name] = template.developer_name
|
10
9
|
mustache_template[:date] = template.date
|
11
10
|
mustache_template[:options] = template.options
|
12
11
|
mustache_template[:properties] = template.properties
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
Usage:
|
3
|
+
|
4
|
+
$ swift-boil <command> <option> <properties>
|
5
|
+
|
6
|
+
Commands:
|
7
|
+
|
8
|
+
view or v: command to generate the boiler plate code for a view
|
9
|
+
model or m: command to generate the boiler plate code for a model
|
10
|
+
controller or c: command to generate the boiler plate code for a controller
|
11
|
+
tableViewCell or tvc: command to generate the boiler plate code for a table view cell
|
12
|
+
singleton or s: command to generate the boiler plate code for a singleton
|
13
|
+
|
14
|
+
Options:
|
15
|
+
|
16
|
+
--help or -h: shows usage details
|
17
|
+
--protocol or -p: it indicates that Swift-Boiler should add a delegate or data source to the class being generated
|
18
|
+
--template or -t: allows user to specify a custom template to be used to generate code
|
19
|
+
|
20
|
+
Examples:
|
21
|
+
|
22
|
+
$ swift-boil view MyView -p mainlabel:UILabel firstView:UIView secondView:CustomView
|
23
|
+
$ swift-boil tvc MyTableViewCell mainlabel:UILabel firstView:UIView secondView:CustomView
|
24
|
+
|
25
|
+
|
data/lib/swift/boiler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swift-boiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Peres
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/swift/boiler/scanner.rb
|
87
87
|
- lib/swift/boiler/template.rb
|
88
88
|
- lib/swift/boiler/templates/controller.mustache
|
89
|
+
- lib/swift/boiler/templates/help.mustache
|
89
90
|
- lib/swift/boiler/templates/model.mustache
|
90
91
|
- lib/swift/boiler/templates/singleton.mustache
|
91
92
|
- lib/swift/boiler/templates/table_view_cell.mustache
|