motion-util 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -5
- data/lib/motion-util/command/ib_header.rb +3 -3
- data/lib/motion-util/version.rb +1 -1
- data/test/test_ib_header.rb +4 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -40,8 +40,8 @@ Your ruby motion class:
|
|
40
40
|
# app_delegate.rb
|
41
41
|
class AppDelegate
|
42
42
|
|
43
|
-
attr_accessor :window #
|
44
|
-
attr_accessor :controller #
|
43
|
+
attr_accessor :window # IBOutlet UIWindow
|
44
|
+
attr_accessor :controller # IBOutlet UIViewController
|
45
45
|
|
46
46
|
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
47
47
|
@window.rootViewController = @controller
|
@@ -55,9 +55,12 @@ class AppDelegate
|
|
55
55
|
end
|
56
56
|
</pre>
|
57
57
|
|
58
|
-
|
59
|
-
If it's not specified it will be id type.
|
60
|
-
|
58
|
+
IBOutlet is a marker to describe a class by Objective-C.
|
59
|
+
If it's not specified it will be id type.
|
60
|
+
(@type_info is deprecated. Instead use IBOutlet.)
|
61
|
+
|
62
|
+
IBAction is a marker to describe an action method.
|
63
|
+
|
61
64
|
After execution 'motion-util ibh', AppDelegate.h was generated in tmp/header directory like this.
|
62
65
|
|
63
66
|
<pre>
|
@@ -71,8 +71,8 @@ module Motion
|
|
71
71
|
case l
|
72
72
|
|
73
73
|
# property
|
74
|
-
when /(attr_accessor|attr_reader)\s+([A-Za-z0-9:, ]+)(#\s*(@type_info\s+(\w+)?)?)?/
|
75
|
-
type = type_of $
|
74
|
+
when /(attr_accessor|attr_reader)\s+([A-Za-z0-9:, ]+)(#\s*((@type_info|IBOutlet)\s+(\w+)?)?)?/
|
75
|
+
type = type_of $6
|
76
76
|
$2.split(",").each do |p|
|
77
77
|
p = eval(p.strip)
|
78
78
|
@properties[p] = { type:type }
|
@@ -80,7 +80,7 @@ module Motion
|
|
80
80
|
end if $2
|
81
81
|
|
82
82
|
# action
|
83
|
-
when /def\s+(
|
83
|
+
when /def\s+(.+?)\s+(.+?)\s+#\s*IBAction/
|
84
84
|
actions << [$1, $2]
|
85
85
|
end
|
86
86
|
end
|
data/lib/motion-util/version.rb
CHANGED
data/test/test_ib_header.rb
CHANGED
@@ -55,9 +55,11 @@ class TestIbHeader < Test::Unit::TestCase
|
|
55
55
|
class Foo
|
56
56
|
attr_accessor :foo # no type
|
57
57
|
attr_accessor :bar # @type_info UILabel
|
58
|
-
attr_reader :hoge #
|
58
|
+
attr_reader :hoge # IBOutlet UIView
|
59
59
|
def action sender # IBAction
|
60
60
|
end
|
61
|
+
def didChangeValue sender # IBAction
|
62
|
+
end
|
61
63
|
end
|
62
64
|
EOF
|
63
65
|
|
@@ -67,6 +69,7 @@ end
|
|
67
69
|
@property (strong, nonatomic) IBOutlet UILabel *bar;
|
68
70
|
@property (strong, nonatomic, readonly) IBOutlet UIView *hoge;
|
69
71
|
- (IBAction)action:(id)sender;
|
72
|
+
- (IBAction)didChangeValue:(id)sender;
|
70
73
|
@end
|
71
74
|
EOF
|
72
75
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
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-01-
|
12
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: It generate class and spec files.
|
15
15
|
email:
|