ib 0.2.7 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14673dfc0d5e8858596f53d44641d0f8f5f96288
4
- data.tar.gz: f30e7bfbf818a0feb2824be4d1abc549d5788440
3
+ metadata.gz: 3e294dc4222e7afc58e33850727fdfe7c8196fbc
4
+ data.tar.gz: f478bc0484d46085a22c95f7d62902af044faf9f
5
5
  SHA512:
6
- metadata.gz: b81eb553fe779a211923770eda002fbfaaf9be509e54ed89da0f388e4765dbb995f616c4048e87f81949f56fdf0a726a88ed544e6808e6ca469a0673f335924e
7
- data.tar.gz: 8dc6b1fb2d55b2c9eeec9bc5746191fc79344026f3fb1d4fa582e001e5a99f5b8bb4e61a8d46210f301b0d26dd6eab41d8c8802940e7502180e942654c1cbf24
6
+ metadata.gz: 58437fdd08f5a13cebcaee22f160f776a58970490e7a12c80705f65998189b2286a76e6073481e48ece01001f6f79fbc21fff46aef3b8396fedbf34eb0f3f084
7
+ data.tar.gz: e19cf4f40b619f307f619edcd5961594a0c8c4a52c39081b3eb2f231fe30b7c673cdae521fd47d976b063b0ac4be410b4fdeceddd1f9349542ed40b5740a5077
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  rubymotion interface builder support (yes, with outlets)
4
4
 
5
- [![SpellHub](http://spellhub.com/projects/status/7)](http://spellhub.com/projects/project/7)
5
+ <a href='http://spellhub.com/projects/project/7'><img src="http://spellhub.com/projects/status/7" height="18"></a>
6
6
 
7
7
  [**Change Log**](https://github.com/yury/ib/wiki/Change-Log)
8
8
 
data/lib/ib/generator.rb CHANGED
@@ -71,6 +71,6 @@ OBJC
71
71
  end
72
72
 
73
73
  def generate_action action
74
- action[1] ? "#{action[0]}:(id) #{action[1]}" : "#{action[0]}"
74
+ action[1] ? "#{action[0]}:(#{action[2] ? "#{action[2]}*" : 'id'}) #{action[1]}" : "#{action[0]}"
75
75
  end
76
76
  end
data/lib/ib/outlets.rb CHANGED
@@ -14,7 +14,7 @@ module IB
14
14
  attr_accessor name
15
15
  end
16
16
 
17
- def ib_action name
17
+ def ib_action name, type = "id"
18
18
  end
19
19
 
20
20
  end
data/lib/ib/parser.rb CHANGED
@@ -3,10 +3,13 @@ class IB::Parser
3
3
  CLASS_REGEX = /^[ \t]*class[ \t]+(#{NAME_REGEX})([ \t]*<[ \t]*(#{NAME_REGEX}))?/
4
4
  OUTLET_REGEX = /^[ \t]+(ib_)?outlet(_accessor)?[ \t]+:(#{NAME_REGEX})[ \t]*?(,[ \t]*['"]?(#{NAME_REGEX}))?/
5
5
  OUTLET_COLLECTION_REGEX = /^[ \t]+(ib_)?outlet_collection(_accessor)?[ \t]+:(#{NAME_REGEX})[ \t]*?(,[ \t]*['"]?(#{NAME_REGEX}))?/
6
- METHOD_REF_REGEX = /^[ \t]+(ib_action)[ \t]:(#{NAME_REGEX})/
7
- METHOD_DEF_REGEX = /^[ \t]+(def)[ \t](#{NAME_REGEX})([ \t(]+)?(#{NAME_REGEX})?([ \t)]*)(#.*)?$/
6
+ METHOD_ARGUMENT_REGEX = /(#{NAME_REGEX})(?:[ \t]*=[^,#)]*)?/
7
+ METHOD_REF_REGEX = /^[ \t]+(ib_action)[ \t]:(#{NAME_REGEX})[ \t]*?(,[ \t]*['"]?(#{NAME_REGEX}))?/
8
+ METHOD_DEF_REGEX = /^[ \t]+(def)[ \t]#{METHOD_ARGUMENT_REGEX}([ \t(]+)?#{METHOD_ARGUMENT_REGEX}?([ \t)]*)(#.*)?$/
8
9
  ACTION_REGEX = Regexp.union METHOD_DEF_REGEX, METHOD_REF_REGEX
9
10
 
11
+ p METHOD_DEF_REGEX
12
+
10
13
  def find_all(dir_or_files)
11
14
  all = {}
12
15
  files = case dir_or_files
@@ -81,9 +84,9 @@ class IB::Parser
81
84
  def find_actions src
82
85
  src.scan(ACTION_REGEX).map do |groups|
83
86
  if groups[0] == "def"
84
- [groups[1], groups[3]]
87
+ [groups[1], groups[3], nil]
85
88
  elsif groups[6] == "ib_action"
86
- [groups[7], 'sender']
89
+ [groups[7], 'sender', groups[9]]
87
90
  else
88
91
  nil
89
92
  end
data/lib/ib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IB
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -16,6 +16,7 @@ class CustomView < UIView
16
16
  outlet_collection :yellowLabelCollection
17
17
 
18
18
  ib_action :someAction
19
+ ib_action :segueAction, UIStoryboardSegue
19
20
 
20
21
  def anotherAction button
21
22
  end
@@ -32,4 +33,7 @@ class CustomView < UIView
32
33
  def actionWithoutArgs
33
34
  end
34
35
 
36
+ def actionWithDefaultedArgs(sender = nil) #comment
37
+ end
38
+
35
39
  end
@@ -32,10 +32,12 @@ describe IB::Generator do
32
32
  @property IBOutletCollection(id) NSArray * yellowLabelCollection;
33
33
 
34
34
  -(IBAction) someAction:(id) sender;
35
+ -(IBAction) segueAction:(UIStoryboardSegue*) sender;
35
36
  -(IBAction) anotherAction:(id) button;
36
37
  -(IBAction) actionWithComment:(id) sender;
37
38
  -(IBAction) actionWithBrackets:(id) sender;
38
39
  -(IBAction) actionWithoutArgs;
40
+ -(IBAction) actionWithDefaultedArgs:(id) sender;
39
41
 
40
42
  @end
41
43
 
data/spec/parser_spec.rb CHANGED
@@ -19,11 +19,13 @@ describe IB::Parser do
19
19
  ["yellowLabelCollection", "id"]
20
20
  ]
21
21
  info[:actions].should == [
22
- ["someAction", "sender"],
23
- ["anotherAction", "button"],
24
- ["actionWithComment", "sender"],
25
- ["actionWithBrackets", "sender"],
26
- ["actionWithoutArgs", nil]
22
+ ["someAction", "sender", nil],
23
+ ["segueAction", "sender", "UIStoryboardSegue"],
24
+ ["anotherAction", "button", nil],
25
+ ["actionWithComment", "sender", nil],
26
+ ["actionWithBrackets", "sender", nil],
27
+ ["actionWithoutArgs", nil, nil],
28
+ ["actionWithDefaultedArgs", "sender", nil]
27
29
  ]
28
30
  end
29
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Korolev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
12
+ date: 2013-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcodeproj
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.0.0.rc.2
110
+ rubygems_version: 2.0.0
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Small portion of love to interface builder with rubymotion