bubble-wrap 1.0.0.pre → 1.0.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,109 @@
1
+ # Getting Started with BubbleWrap
2
+
3
+ A short guide to starting a RubyMotion application using the bubble wrappers.
4
+
5
+ ## A quick note about RubyMotion
6
+
7
+ [RubyMotion](http://www.rubymotion.com/) is a commercial product available from
8
+ [HipByte SPRL](http://www.hipbyte.com/). RubyMotion needs a recent (10.6 or newer)
9
+ version of Mac OS X and Apple's Xcode tools installed. If you don't have a working
10
+ RubyMotion install take a look at the [getting started guide](http://www.rubymotion.com/developer-center/guides/getting-started/).
11
+
12
+ ## Create a new RubyMotion project
13
+
14
+ RubyMotion ships with the `motion` command-line tool to handle creating projects,
15
+ updating and creatint support tickets.
16
+
17
+ ```
18
+ $ motion create bw-demo
19
+ Create bw-demo
20
+ Create bw-demo/.gitignore
21
+ Create bw-demo/Rakefile
22
+ Create bw-demo/app
23
+ Create bw-demo/app/app_delegate.rb
24
+ Create bw-demo/resources
25
+ Create bw-demo/spec
26
+ Create bw-demo/spec/main_spec.rb
27
+ ```
28
+
29
+ This gives us an empty project (and one failing spec). That's fine for now.
30
+
31
+ ## Set up Bundler
32
+
33
+ [Bundler](http://www.gembundler.com/) is a project to manage your project's
34
+ RubyGem dependencies. You can get by without it if you want to, but it will
35
+ save time and hassle as the number of BubbleWrap gems grows over time.
36
+
37
+ ```
38
+ $ gem install bundler
39
+ ```
40
+
41
+ Create a new file called `Gemfile` in your project directory and add the
42
+ following:
43
+
44
+ ```ruby
45
+ source :rubygems
46
+ gem 'bubble-wrap', '~> 1.0.0'
47
+ gem 'rake'
48
+ ```
49
+
50
+ Then run `bundle` from the command-line in the same directory and Bundler
51
+ should install BubbleWrap and Rake for you.
52
+
53
+
54
+ ## Adding BubbleWrap
55
+
56
+ Now that we have BubbleWrap installed we need to configure the project to use
57
+ it - the easiest way is to add Bundler to our build-environment and tell it
58
+ to take care of everything for us.
59
+
60
+ Edit your project's `Rakefile` and add the following just under `require 'motion/project'`:
61
+
62
+ ```ruby
63
+ require 'bundler'
64
+ Bundler.setup
65
+ Bundler.require
66
+ ```
67
+
68
+ Now when you build your project by running `rake` you will see the BubbleWrap files
69
+ being compiled into your project.
70
+
71
+ ## Customising BubbleWrap requires
72
+
73
+ By default BubbleWrap will include all the bubble wrappers into your project, but often
74
+ you won't need them all - perhaps you only want to use BubbleWrap's `http` wrappers?
75
+ You can change your bubble-wrap line in your `Gemfile` as follows:
76
+
77
+ ```ruby
78
+ gem 'bubble-wrap', '~> 1.0.0', :require => 'bubble-wrap/http'
79
+ ```
80
+
81
+ If you just want core, the change is similarly easy:
82
+
83
+ ```ruby
84
+ gem 'bubble-wrap', '~> 1.0.0', :require => 'bubble-wrap/core'
85
+ ```
86
+
87
+ Also, if you don't want any of BubbleWrap loaded by default, and you just want to use
88
+ it's ability to add projects to your build system you can change it to:
89
+
90
+ ```ruby
91
+ gem 'bubble-wrap', '~> 1.0.0', :require => 'bubble-wrap/loader'
92
+ ```
93
+
94
+ And modify your `Rakefile` to include one or more `BW.require` lines:
95
+
96
+ ```ruby
97
+ BW.require '/path/to/some/files/**/*.rb'
98
+ ```
99
+
100
+ For more information in using `BW.require` take a look at
101
+ [the bubblewrap hacking guide](http://bubblewrap.io/hacking.html).
102
+
103
+ ## Go forth and conquer!
104
+
105
+ The developers wish to thank you for using BubbleWrap.
106
+ Please feel free to open issues or pull requests on
107
+ [GitHub](https://www.github.com/mattetti/BubbleWrap), join our
108
+ [mailing list](https://groups.google.com/forum/#!forum/bubblewrap)
109
+ or join us on `#bubblewrap` on `irc.freenode.net`.
data/Rakefile CHANGED
@@ -6,13 +6,19 @@ Bundler.require
6
6
 
7
7
  require 'bubble-wrap/test'
8
8
 
9
- task :lib_spec do
10
- sh "bacon #{Dir.glob("lib_spec/**/*_spec.rb").join(' ')}"
11
- end
12
-
13
- task :test => [ :lib_spec, :spec ]
14
-
15
9
  Motion::Project::App.setup do |app|
16
10
  app.name = 'testSuite'
17
11
  app.identifier = 'io.bubblewrap.testSuite'
12
+ app.specs_dir = './spec/motion'
13
+ end
14
+
15
+ namespace :spec do
16
+ task :lib do
17
+ sh "bacon #{Dir.glob("spec/lib/**/*_spec.rb").join(' ')}"
18
+ end
19
+
20
+ task :motion => 'spec'
21
+
22
+ task :all => [:lib, :motion]
18
23
  end
24
+
@@ -1,14 +1,23 @@
1
- module Motion
2
- module Project
3
- class Config
1
+ module BubbleWrap
2
+ module Ext
3
+ module ConfigTask
4
4
 
5
- # HACK NEEDED since RubyMotion doesn't support full path
6
- # dependencies.
7
- def files_dependencies(deps_hash)
5
+ def self.included(base)
6
+ base.class_eval do
7
+ alias_method :files_dependencies_without_bubblewrap, :files_dependencies
8
+ alias_method :files_dependencies, :files_dependencies_with_bubblewrap
9
+ end
10
+ end
11
+
12
+ def path_matching_expression
13
+ /^\.?\//
14
+ end
15
+
16
+ def files_dependencies_with_bubblewrap(deps_hash)
8
17
  res_path = lambda do |x|
9
- path = /^\.?\//.match(x) ? x : File.join('.', x)
18
+ path = path_matching_expression.match(x) ? x : File.join('.', x)
10
19
  unless @files.include?(path)
11
- App.fail "Can't resolve dependency `#{x}' because #{path} is not in #{@files.inspect}"
20
+ Motion::Project::App.send(:fail, "Can't resolve dependency `#{x}' because #{path} is not in #{@files.inspect}")
12
21
  end
13
22
  path
14
23
  end
@@ -17,6 +26,9 @@ module Motion
17
26
  @dependencies[res_path.call(path)] = deps.map(&res_path)
18
27
  end
19
28
  end
29
+
20
30
  end
21
31
  end
22
32
  end
33
+
34
+ Motion::Project::Config.send(:include, BubbleWrap::Ext::ConfigTask)
@@ -10,7 +10,10 @@ module BubbleWrap
10
10
 
11
11
  def convert_caller_to_path(string)
12
12
  chunks = string.split(':')
13
- return chunks[0..-3].join(':') if chunks.size >= 3
13
+ if chunks.size >= 3
14
+ string = chunks[0..-3].join(':')
15
+ string = File.dirname(string)
16
+ end
14
17
  string
15
18
  end
16
19
 
@@ -1,3 +1,3 @@
1
1
  module BubbleWrap
2
- VERSION = '1.0.0.pre'
2
+ VERSION = '1.0.0.pre.2'
3
3
  end
@@ -0,0 +1,44 @@
1
+ require 'mocha-on-bacon'
2
+ require File.expand_path('../../../motion_stub', __FILE__)
3
+ require 'bubble-wrap'
4
+
5
+ describe BubbleWrap::Ext::ConfigTask do
6
+
7
+ before do
8
+ klass = Class.new do
9
+ def initialize
10
+ @files = [ '/fake/a', '/fake/b' ]
11
+ @dependencies = {}
12
+ end
13
+
14
+ def files_dependencies
15
+ end
16
+ end
17
+ klass.send(:include, BubbleWrap::Ext::ConfigTask)
18
+ @subject = klass.new
19
+ end
20
+
21
+ describe '.included' do
22
+ it 'aliases :files_dependencies to :files_dependencies_without_bubblewrap' do
23
+ @subject.respond_to?(:files_dependencies_without_bubblewrap).should == true
24
+ end
25
+
26
+ it 'aliass :files_dependencies_with_bubblewrap to :files_dependencies' do
27
+ @subject.method(:files_dependencies).should == @subject.method(:files_dependencies_with_bubblewrap)
28
+ end
29
+ end
30
+
31
+ describe '#path_matching_expression' do
32
+ it 'returns a regular expression' do
33
+ @subject.path_matching_expression.is_a?(Regexp).should == true
34
+ end
35
+ end
36
+
37
+ describe '#files_dependencies_with_bubblewrap' do
38
+ it 'should call #path_matching_expression' do
39
+ @subject.expects(:path_matching_expression).twice().returns(/^\.?\//)
40
+ @subject.files_dependencies_with_bubblewrap '/fake/a' => '/fake/b'
41
+ end
42
+ end
43
+
44
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../../lib/bubble-wrap/requirement/path_manipulation', __FILE__)
1
+ require File.expand_path('../../../../../lib/bubble-wrap/requirement/path_manipulation', __FILE__)
2
2
 
3
3
  describe BubbleWrap::Requirement::PathManipulation do
4
4
 
@@ -9,7 +9,7 @@ describe BubbleWrap::Requirement::PathManipulation do
9
9
 
10
10
  describe '#convert_caller_to_path' do
11
11
  it 'strips off from the second-to-last colon' do
12
- @subject.convert_caller_to_path("/fake/:path:91:in `fake_method'").
12
+ @subject.convert_caller_to_path("/fake/:path/foo:91:in `fake_method'").
13
13
  should == '/fake/:path'
14
14
  end
15
15
 
@@ -10,7 +10,7 @@ describe BubbleWrap::Requirement do
10
10
  describe '.scan' do
11
11
  before do
12
12
  @subject.paths = {}
13
- @root_path = File.expand_path('../../../', __FILE__)
13
+ @root_path = File.expand_path('../../../../', __FILE__)
14
14
  end
15
15
 
16
16
  it 'asking for a not-yet-found file raises an exception' do
@@ -0,0 +1,30 @@
1
+ require 'mocha-on-bacon'
2
+ require File.expand_path('../motion_stub.rb', __FILE__)
3
+ require 'bubble-wrap'
4
+
5
+ describe BubbleWrap do
6
+ describe '.root' do
7
+ it 'returns an absolute path' do
8
+ BubbleWrap.root[0].should == '/'
9
+ end
10
+ end
11
+
12
+ describe '.require' do
13
+ it 'delegates to Requirement.scan' do
14
+ BW::Requirement.expects(:scan)
15
+ BW.require('foo')
16
+ end
17
+
18
+ it 'finds files with relative paths' do
19
+ BW::Requirement.paths = {}
20
+ BW.require '../motion/core.rb'
21
+ BW::Requirement.files.member?(File.expand_path('../../../motion/core.rb', __FILE__)).should == true
22
+ end
23
+
24
+ it 'finds files with absolute paths' do
25
+ BW::Requirement.paths = {}
26
+ BW.require File.expand_path('../../../motion/core.rb', __FILE__)
27
+ BW::Requirement.files.member?(File.expand_path('../../../motion/core.rb', __FILE__)).should == true
28
+ end
29
+ end
30
+ end
@@ -7,6 +7,8 @@ module Motion
7
7
  end
8
8
 
9
9
  class Config
10
+ def files_dependencies
11
+ end
10
12
  end
11
13
  end
12
14
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,82 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bubble-wrap
3
- version: !ruby/object:Gem::Version
4
- hash: 1390682719
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre.2
5
5
  prerelease: 6
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- - pre
11
- version: 1.0.0.pre
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - Matt Aimonetti
15
9
  - Francis Chong
16
10
  - James Harton
17
11
  autorequire:
18
12
  bindir: bin
19
13
  cert_chain: []
20
-
21
- date: 2012-06-08 00:00:00 +02:00
22
- default_executable:
23
- dependencies:
24
- - !ruby/object:Gem::Dependency
14
+ date: 2012-06-11 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
25
17
  name: bacon
26
- type: :development
27
- version_requirements: &id001 !ruby/object:Gem::Requirement
18
+ requirement: &70345019044780 !ruby/object:Gem::Requirement
28
19
  none: false
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- hash: 3
33
- segments:
34
- - 0
35
- version: "0"
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :development
36
25
  prerelease: false
37
- requirement: *id001
38
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *70345019044780
27
+ - !ruby/object:Gem::Dependency
39
28
  name: mocha-on-bacon
40
- type: :development
41
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
+ requirement: &70345019044360 !ruby/object:Gem::Requirement
42
30
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
50
36
  prerelease: false
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *70345019044360
38
+ - !ruby/object:Gem::Dependency
53
39
  name: rake
54
- type: :development
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
40
+ requirement: &70345019043940 !ruby/object:Gem::Requirement
56
41
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ type: :development
64
47
  prerelease: false
65
- requirement: *id003
66
- description: RubyMotion wrappers and helpers (Ruby for iOS) - Making Cocoa APIs more Ruby like, one API at a time. Fork away and send your pull request.
67
- email:
48
+ version_requirements: *70345019043940
49
+ description: RubyMotion wrappers and helpers (Ruby for iOS) - Making Cocoa APIs more
50
+ Ruby like, one API at a time. Fork away and send your pull request.
51
+ email:
68
52
  - mattaimonetti@gmail.com
69
53
  - francis@ignition.hk
70
54
  - james@sociable.co.nz
71
55
  executables: []
72
-
73
56
  extensions: []
74
-
75
- extra_rdoc_files:
57
+ extra_rdoc_files:
76
58
  - lib/bubble-wrap/ext/motion_project_app.rb
77
59
  - lib/bubble-wrap/ext/motion_project_config.rb
78
- - lib_spec/bubble-wrap/ext/motion_project_app_spec.rb
79
- - lib_spec/motion_stub.rb
80
60
  - motion/core.rb
81
61
  - motion/core/app.rb
82
62
  - motion/core/device.rb
@@ -95,10 +75,28 @@ extra_rdoc_files:
95
75
  - motion/core/ui_view_controller.rb
96
76
  - motion/http.rb
97
77
  - motion/test_suite_delegate.rb
98
- files:
78
+ - spec/lib/bubble-wrap/ext/motion_project_app_spec.rb
79
+ - spec/lib/bubble-wrap/ext/motion_project_config_spec.rb
80
+ - spec/lib/motion_stub.rb
81
+ - spec/motion/core/app_spec.rb
82
+ - spec/motion/core/device/screen_spec.rb
83
+ - spec/motion/core/device_spec.rb
84
+ - spec/motion/core/gestures_spec.rb
85
+ - spec/motion/core/json_spec.rb
86
+ - spec/motion/core/kvo_spec.rb
87
+ - spec/motion/core/ns_index_path_spec.rb
88
+ - spec/motion/core/ns_notification_center_spec.rb
89
+ - spec/motion/core/persistence_spec.rb
90
+ - spec/motion/core/string_spec.rb
91
+ - spec/motion/core/time_spec.rb
92
+ - spec/motion/core/ui_control_spec.rb
93
+ - spec/motion/core_spec.rb
94
+ - spec/motion/http_spec.rb
95
+ files:
99
96
  - .gitignore
100
97
  - CHANGELOG.md
101
98
  - GEM.md
99
+ - GETTING_STARTED.md
102
100
  - Gemfile
103
101
  - HACKING.md
104
102
  - LICENSE
@@ -116,11 +114,6 @@ files:
116
114
  - lib/bubble-wrap/requirement/path_manipulation.rb
117
115
  - lib/bubble-wrap/test.rb
118
116
  - lib/bubble-wrap/version.rb
119
- - lib_spec/bubble-wrap/ext/motion_project_app_spec.rb
120
- - lib_spec/bubble-wrap/requirement/path_manipulation_spec.rb
121
- - lib_spec/bubble-wrap/requirement_spec.rb
122
- - lib_spec/bubble-wrap_spec.rb
123
- - lib_spec/motion_stub.rb
124
117
  - motion/core.rb
125
118
  - motion/core/app.rb
126
119
  - motion/core/device.rb
@@ -139,73 +132,72 @@ files:
139
132
  - motion/core/ui_view_controller.rb
140
133
  - motion/http.rb
141
134
  - motion/test_suite_delegate.rb
142
- - spec/core/app_spec.rb
143
- - spec/core/device/screen_spec.rb
144
- - spec/core/device_spec.rb
145
- - spec/core/gestures_spec.rb
146
- - spec/core/json_spec.rb
147
- - spec/core/kvo_spec.rb
148
- - spec/core/ns_index_path_spec.rb
149
- - spec/core/ns_notification_center_spec.rb
150
- - spec/core/persistence_spec.rb
151
- - spec/core/string_spec.rb
152
- - spec/core/time_spec.rb
153
- - spec/core/ui_control_spec.rb
154
- - spec/core_spec.rb
155
- - spec/http_spec.rb
156
- has_rdoc: true
135
+ - spec/lib/bubble-wrap/ext/motion_project_app_spec.rb
136
+ - spec/lib/bubble-wrap/ext/motion_project_config_spec.rb
137
+ - spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
138
+ - spec/lib/bubble-wrap/requirement_spec.rb
139
+ - spec/lib/bubble-wrap_spec.rb
140
+ - spec/lib/motion_stub.rb
141
+ - spec/motion/core/app_spec.rb
142
+ - spec/motion/core/device/screen_spec.rb
143
+ - spec/motion/core/device_spec.rb
144
+ - spec/motion/core/gestures_spec.rb
145
+ - spec/motion/core/json_spec.rb
146
+ - spec/motion/core/kvo_spec.rb
147
+ - spec/motion/core/ns_index_path_spec.rb
148
+ - spec/motion/core/ns_notification_center_spec.rb
149
+ - spec/motion/core/persistence_spec.rb
150
+ - spec/motion/core/string_spec.rb
151
+ - spec/motion/core/time_spec.rb
152
+ - spec/motion/core/ui_control_spec.rb
153
+ - spec/motion/core_spec.rb
154
+ - spec/motion/http_spec.rb
157
155
  homepage: http://bubblewrap.io/
158
156
  licenses: []
159
-
160
157
  post_install_message:
161
158
  rdoc_options: []
162
-
163
- require_paths:
159
+ require_paths:
164
160
  - lib
165
- required_ruby_version: !ruby/object:Gem::Requirement
161
+ required_ruby_version: !ruby/object:Gem::Requirement
166
162
  none: false
167
- requirements:
168
- - - ">="
169
- - !ruby/object:Gem::Version
170
- hash: 3
171
- segments:
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ segments:
172
168
  - 0
173
- version: "0"
174
- required_rubygems_version: !ruby/object:Gem::Requirement
169
+ hash: 1063659465596723229
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
171
  none: false
176
- requirements:
177
- - - ">"
178
- - !ruby/object:Gem::Version
179
- hash: 25
180
- segments:
181
- - 1
182
- - 3
183
- - 1
172
+ requirements:
173
+ - - ! '>'
174
+ - !ruby/object:Gem::Version
184
175
  version: 1.3.1
185
176
  requirements: []
186
-
187
177
  rubyforge_project:
188
- rubygems_version: 1.5.3
178
+ rubygems_version: 1.8.16
189
179
  signing_key:
190
180
  specification_version: 3
191
- summary: RubyMotion wrappers and helpers (Ruby for iOS) - Making Cocoa APIs more Ruby like, one API at a time. Fork away and send your pull request.
192
- test_files:
193
- - lib_spec/bubble-wrap/ext/motion_project_app_spec.rb
194
- - lib_spec/bubble-wrap/requirement/path_manipulation_spec.rb
195
- - lib_spec/bubble-wrap/requirement_spec.rb
196
- - lib_spec/bubble-wrap_spec.rb
197
- - lib_spec/motion_stub.rb
198
- - spec/core/app_spec.rb
199
- - spec/core/device/screen_spec.rb
200
- - spec/core/device_spec.rb
201
- - spec/core/gestures_spec.rb
202
- - spec/core/json_spec.rb
203
- - spec/core/kvo_spec.rb
204
- - spec/core/ns_index_path_spec.rb
205
- - spec/core/ns_notification_center_spec.rb
206
- - spec/core/persistence_spec.rb
207
- - spec/core/string_spec.rb
208
- - spec/core/time_spec.rb
209
- - spec/core/ui_control_spec.rb
210
- - spec/core_spec.rb
211
- - spec/http_spec.rb
181
+ summary: RubyMotion wrappers and helpers (Ruby for iOS) - Making Cocoa APIs more Ruby
182
+ like, one API at a time. Fork away and send your pull request.
183
+ test_files:
184
+ - spec/lib/bubble-wrap/ext/motion_project_app_spec.rb
185
+ - spec/lib/bubble-wrap/ext/motion_project_config_spec.rb
186
+ - spec/lib/bubble-wrap/requirement/path_manipulation_spec.rb
187
+ - spec/lib/bubble-wrap/requirement_spec.rb
188
+ - spec/lib/bubble-wrap_spec.rb
189
+ - spec/lib/motion_stub.rb
190
+ - spec/motion/core/app_spec.rb
191
+ - spec/motion/core/device/screen_spec.rb
192
+ - spec/motion/core/device_spec.rb
193
+ - spec/motion/core/gestures_spec.rb
194
+ - spec/motion/core/json_spec.rb
195
+ - spec/motion/core/kvo_spec.rb
196
+ - spec/motion/core/ns_index_path_spec.rb
197
+ - spec/motion/core/ns_notification_center_spec.rb
198
+ - spec/motion/core/persistence_spec.rb
199
+ - spec/motion/core/string_spec.rb
200
+ - spec/motion/core/time_spec.rb
201
+ - spec/motion/core/ui_control_spec.rb
202
+ - spec/motion/core_spec.rb
203
+ - spec/motion/http_spec.rb
@@ -1,18 +0,0 @@
1
- require 'mocha-on-bacon'
2
- require File.expand_path('../motion_stub.rb', __FILE__)
3
- require 'bubble-wrap'
4
-
5
- describe BubbleWrap do
6
- describe '.root' do
7
- it 'returns an absolute path' do
8
- BubbleWrap.root[0].should == '/'
9
- end
10
- end
11
-
12
- describe '.require' do
13
- it 'delegates to Requirement.scan' do
14
- BW::Requirement.expects(:scan)
15
- BW.require('foo')
16
- end
17
- end
18
- end