motion-bundler 0.1.5 → 0.1.6

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: f5db7eef27452db03cec3069345404b2782c6e9d
4
- data.tar.gz: f7e198110cf2ed95529df59957a5dc662e4bb8dc
3
+ metadata.gz: c3b46ddc7bfbf054507b9cc9faa9ccbdf66cc1c7
4
+ data.tar.gz: 5d5c20b2234f96d586022c5631472228b9332f02
5
5
  SHA512:
6
- metadata.gz: 14a40f729b2ec900abb0f4f1e244617fb5a438f5b9b792baa63e9dab486cff3aa4d79547af3b74cdce96f287461182378a41eeaa8223b7655221cba2ac7356af
7
- data.tar.gz: c5ddd7429a457a06d7ba1dd6296e13a83163b0b05226f44e321c79a0f4cc6cff882aaedb8f0512d029ede239d4957f864ad5117c1ecebfe2824712a104550066
6
+ metadata.gz: 0ffa0e8ed9ed71638d5fdbeea0a710b882483efdf7a2d086c99919e2f4c11eca84a2e194b9d27964f8290d2cc26740de6b4ae2a5a6efd983d8ef8ab7dbc50d5b
7
+ data.tar.gz: 28901834c38dd26658f5175fe589764cf9bd6de6dea8bcf5ec8b3e275ff5f5a7bfd71b1780b40fc81cbb53df4aef6d636db234750e30132f790f60378c5a6cc3
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.0.0
3
4
  - 1.9.3
4
5
  - 1.9.2
@@ -1,5 +1,10 @@
1
1
  = MotionBundler CHANGELOG
2
2
 
3
+ == Version 0.1.6 (June 14, 2013)
4
+
5
+ * Removed optional `strict` argument within Require.resolve
6
+ * Also mocking within `MotionBundler.tracer_require` (thanks Li Jie for issuing, see https://github.com/archan937/motion-bundler/issues/7)
7
+
3
8
  == Version 0.1.5 (May 30, 2013)
4
9
 
5
10
  * Being able to require multiple files (e.g. `require "./config/**/*.rb"` within `app/app_delegate.rb`)
data/README.md CHANGED
@@ -30,7 +30,7 @@ Add `MotionBundler.setup` at the end of your `Rakefile`:
30
30
 
31
31
  # -*- coding: utf-8 -*-
32
32
  $:.unshift "/Library/RubyMotion/lib"
33
- require "motion/project"
33
+ require "motion/project/template/ios"
34
34
 
35
35
  # Require and prepare Bundler
36
36
  require "bundler"
@@ -73,4 +73,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
73
73
 
74
74
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
75
75
 
76
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
76
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -74,7 +74,7 @@ private
74
74
  end
75
75
 
76
76
  def tracer_require(files, files_dependencies, required)
77
- Require.trace do
77
+ Require.mock_and_trace do
78
78
  require MOTION_BUNDLER_FILE
79
79
  require boot_file
80
80
  Bundler.require :motion
@@ -8,6 +8,14 @@ module MotionBundler
8
8
  include Resolve
9
9
  extend self
10
10
 
11
+ def mock_and_trace
12
+ mock do
13
+ trace do
14
+ yield
15
+ end
16
+ end
17
+ end
18
+
11
19
  def trace
12
20
  Tracer.yield do
13
21
  yield
@@ -2,7 +2,7 @@ module MotionBundler
2
2
  module Require
3
3
  module Resolve
4
4
 
5
- def resolve(path, strict = false)
5
+ def resolve(path)
6
6
  base_path = path.gsub(/\.rb$/, "")
7
7
 
8
8
  load_paths.each do |load_path|
@@ -11,7 +11,7 @@ module MotionBundler
11
11
  end
12
12
  end
13
13
 
14
- path unless strict
14
+ path
15
15
  end
16
16
 
17
17
  private
@@ -36,7 +36,7 @@ module MotionBundler
36
36
  false
37
37
  end
38
38
  unless result
39
- {:required => MotionBundler::Require.resolve(path, false)}
39
+ {:required => MotionBundler::Require.resolve(path)}
40
40
  end
41
41
  end
42
42
  result
@@ -1,7 +1,7 @@
1
1
  module MotionBundler #:nodoc:
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 5
4
+ TINY = 6
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
@@ -8,7 +8,7 @@ Bundler.require
8
8
 
9
9
  Motion::Project::App.setup do |app|
10
10
  # Use `rake config' to see complete project settings.
11
- app.name = "SampleApp"
11
+ app.name = "MBundler"
12
12
  end
13
13
 
14
14
  # Track and specify files and their mutual dependencies within the :motion Bundler group
@@ -2,6 +2,7 @@ require "stringio"
2
2
  require "strscan"
3
3
  require "zlib"
4
4
  require "httparty"
5
+ require "net/pop"
5
6
  require_relative "../../lib/foo"
6
7
 
7
8
  class AppController < UIViewController
@@ -36,6 +37,10 @@ class AppController < UIViewController
36
37
 
37
38
  p HTTParty.hi!
38
39
 
40
+ # Testing (mocked) Net::Protocol
41
+
42
+ p Net::Protocol.hi!
43
+
39
44
  # Testing Foo and Foo::Bar
40
45
 
41
46
  p Foo.foo!
@@ -49,5 +54,15 @@ class AppController < UIViewController
49
54
  p enc
50
55
  p Base64.decode64(enc)
51
56
 
57
+ # Say thanks
58
+
59
+ alert = UIAlertView.new
60
+ alert.title = "Thanks!"
61
+ alert.message = "Hi, thanks for giving MotionBundler a try! Any form of collaboration is very welcome.\n\nGreets,\nPaul Engel\n@archan937"
62
+ alert.show
63
+
64
+ count = alert.message.split("\n").collect(&:size).max + 2
65
+ puts ["", "=" * count, "", alert.title, "", alert.message, "", "=" * count]
66
+
52
67
  end
53
68
  end
@@ -1,5 +1,4 @@
1
1
  require_relative "foo/bar"
2
- require_relative './../app/controllers/app_controller'
3
2
  require "cgi"
4
3
 
5
4
  module Foo
File without changes
@@ -1,5 +1,5 @@
1
1
  module HTTParty
2
2
  def self.hi!
3
- "Hi!"
3
+ "Hi, I'm #{name}"
4
4
  end
5
5
  end
@@ -0,0 +1,9 @@
1
+ module Net
2
+ class ProtocolError < StandardError; end
3
+ class ProtoAuthError < ProtocolError; end
4
+ class Protocol
5
+ def self.hi!
6
+ "Hi, I'm #{name}"
7
+ end
8
+ end
9
+ end
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ module Timeout
2
+ class Error < RuntimeError
3
+ end
4
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/paulengel/Sources/motion-bundler
3
3
  specs:
4
- motion-bundler (0.1.5)
4
+ motion-bundler (0.1.6)
5
5
 
6
6
  PATH
7
7
  remote: /Users/paulengel/Sources/motion-bundler/test/gems/slot_machine
@@ -15,7 +15,6 @@ module Unit
15
15
  MotionBundler::Require::Mocker.expects(:dirs).at_least_once.returns [
16
16
  MotionBundler::Require::Mocker::APP_MOCKS, mocks_dir, MotionBundler::Require::Mocker::GEM_MOCKS
17
17
  ]
18
- assert_equal nil, Require.resolve("foo", true)
19
18
  assert_equal "foo", Require.resolve("foo")
20
19
  assert_equal "#{mocks_dir}/yaml.rb", Require.resolve("yaml")
21
20
  assert_equal "#{mocks_dir}/net/http.rb", Require.resolve("net/http")
@@ -33,10 +33,6 @@ module Unit
33
33
  bar_builder.expects(:requires).returns []
34
34
  MotionBundler::Require::Ripper::Builder.expects(:new).with(File.expand_path("./app/controllers/bar.rb")).returns bar_builder
35
35
 
36
- stringio_builder = mock "object"
37
- stringio_builder.expects(:requires).returns []
38
- MotionBundler::Require::Ripper::Builder.expects(:new).with("stdlib/stringio.rb").returns stringio_builder
39
-
40
36
  strscan_builder = mock "object"
41
37
  strscan_builder.expects(:requires).returns []
42
38
  MotionBundler::Require::Ripper::Builder.expects(:new).with("mocks/strscan.rb").returns strscan_builder
@@ -45,10 +41,12 @@ module Unit
45
41
  lib_baz_builder.expects(:requires).returns []
46
42
  MotionBundler::Require::Ripper::Builder.expects(:new).with("lib/baz.rb").returns lib_baz_builder
47
43
 
48
- MotionBundler::Require.expects(:resolve).with("stringio").returns("stdlib/stringio.rb")
44
+ MotionBundler::Require.expects(:resolve).with("stringio").returns("/stdlib/stringio.rb")
49
45
  MotionBundler::Require.expects(:resolve).with("strscan").returns("mocks/strscan.rb")
50
46
  MotionBundler::Require.expects(:resolve).with("baz").returns("lib/baz.rb")
51
47
 
48
+ MotionBundler.expects(:app_require).with("/stdlib/stringio.rb")
49
+
52
50
  ripper = MotionBundler::Require::Ripper.new(
53
51
  "./app/controllers/app_controller.rb",
54
52
  "./app/controllers/foo_controller.rb",
@@ -58,7 +56,7 @@ module Unit
58
56
 
59
57
  assert_equal([
60
58
  "./app/controllers/app_controller.rb",
61
- "stdlib/stringio.rb",
59
+ "/stdlib/stringio.rb",
62
60
  "mocks/strscan.rb",
63
61
  "./app/controllers/foo_controller.rb",
64
62
  "lib/baz.rb",
@@ -67,7 +65,7 @@ module Unit
67
65
  ], ripper.files)
68
66
  assert_equal({
69
67
  "./app/controllers/app_controller.rb" => [
70
- "stdlib/stringio.rb",
68
+ "/stdlib/stringio.rb",
71
69
  "mocks/strscan.rb"
72
70
  ],
73
71
  "./app/controllers/foo_controller.rb" => [
@@ -65,7 +65,7 @@ module Unit
65
65
  end
66
66
 
67
67
  describe "calling `setup`" do
68
- it "should require the :motion Bundler group and trace requires" do
68
+ it "should require the :motion Bundler group and mock and trace requires" do
69
69
  object = mock "object"
70
70
  object.expects :do_something
71
71
 
@@ -75,6 +75,9 @@ module Unit
75
75
  object.do_something
76
76
  end
77
77
 
78
+ MotionBundler::Require.expects(:mock_and_trace)
79
+ MotionBundler.setup
80
+
78
81
  MotionBundler.expects(:touch_motion_bundler)
79
82
  MotionBundler.expects(:ripper_require)
80
83
  MotionBundler.expects(:tracer_require)
@@ -4,6 +4,23 @@ module Unit
4
4
  class TestRequire < MiniTest::Unit::TestCase
5
5
 
6
6
  describe MotionBundler::Require do
7
+ it "should be able to mock and trace requirements within a block" do
8
+ object = mock "object"
9
+ object.expects :do_something
10
+
11
+ MotionBundler::Require.mock_and_trace do
12
+ object.do_something
13
+ end
14
+
15
+ MotionBundler::Require::Tracer.expects :yield
16
+ MotionBundler::Require.mock_and_trace do
17
+ end
18
+
19
+ MotionBundler::Require::Mocker.expects :yield
20
+ MotionBundler::Require.mock_and_trace do
21
+ end
22
+ end
23
+
7
24
  it "should be able to trace requirements within a block" do
8
25
  object = mock "object"
9
26
  object.expects :do_something
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Engel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-30 00:00:00.000000000 Z
11
+ date: 2013-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -99,8 +99,16 @@ files:
99
99
  - sample_app/app/controllers/app_controller.rb
100
100
  - sample_app/lib/foo.rb
101
101
  - sample_app/lib/foo/bar.rb
102
+ - sample_app/mocks/digest/md5.rb
102
103
  - sample_app/mocks/httparty.rb
103
- - sample_app/resources/Default-568h@2x.png
104
+ - sample_app/mocks/net/protocol.rb
105
+ - sample_app/mocks/openssl.rb
106
+ - sample_app/mocks/socket.rb
107
+ - sample_app/mocks/timeout.rb
108
+ - sample_app/resources/Icon.png
109
+ - sample_app/resources/Icon.pxm
110
+ - sample_app/resources/Icon@2x.png
111
+ - sample_app/resources/Icon@2x.pxm
104
112
  - sample_app/spec/main_spec.rb
105
113
  - script/console
106
114
  - test/.gemfiles/simulator/test_setup