bubble-wrap 1.5.0.rc1 → 1.5.0

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: 6fe8341489f7d867922c2a8c271efa986f434521
4
- data.tar.gz: eb3ed530d9b58a39525049fe03286e83f4add2cf
3
+ metadata.gz: 4070f3da9b1e9a37c918c5da7aead8bff4fd4b4e
4
+ data.tar.gz: e654090e81f9ab2b0d2618b95ac3e33935a3bb46
5
5
  SHA512:
6
- metadata.gz: fadcc0db6e1ca10ba457ff651cac9b66315834dce161d33e026ebadafc78748da0fd481f59c78007754bd9c7f0cb45463b784160ec49bb354d202b7cab7f8d0a
7
- data.tar.gz: 3ff86b7387349720e3aec8b48dba3efca6e7d1a2c988023634cfa693569a158124a1e1f41d50abe90068211b86971c0467c98cb207120077d10455d72dffa858
6
+ metadata.gz: d51233858de91c048f290b62989d1a5dce864044ec28465e33582fb65c46baf8008b2209eb77086a870b399b8537468b46d2a1618c697a3f744806a99ea2a778
7
+ data.tar.gz: bdd4ea650406adfc467181c9a38ea069ad886b0f14e6a91bfc703923104f61013dc40d577f15aafd54fa3dfc635e6eb29ffda2b1b30e2ce5c7fb162fa7f5fea8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bubble-wrap (1.5.0.rc1)
4
+ bubble-wrap (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,4 @@
1
+ require 'bubble-wrap/version' unless defined?(BubbleWrap::VERSION)
1
2
  require 'bubble-wrap/loader'
2
3
 
3
4
  BubbleWrap.require('motion/core.rb')
@@ -1,3 +1,4 @@
1
+ require 'bubble-wrap/version' unless defined?(BubbleWrap::VERSION)
1
2
  require 'bubble-wrap/loader'
2
3
  BubbleWrap.require('motion/core/ns_url_request.rb')
3
4
  BubbleWrap.require('motion/core.rb')
@@ -44,5 +44,7 @@ unless defined?(BubbleWrap::LOADER_PRESENT)
44
44
  BW = BubbleWrap unless defined?(BW)
45
45
 
46
46
  BW.require 'motion/shortcut.rb'
47
+ BW.require 'lib/bubble-wrap/version.rb'
48
+ BW.require 'motion/util/deprecated.rb'
47
49
 
48
50
  end
@@ -1,4 +1,4 @@
1
1
  module BubbleWrap
2
- VERSION = '1.5.0.rc1' unless defined?(BubbleWrap::VERSION)
2
+ VERSION = '1.5.0' unless defined?(BubbleWrap::VERSION)
3
3
  MIN_MOTION_VERSION = '2.17'
4
4
  end
@@ -2,6 +2,8 @@
2
2
  #
3
3
  module BubbleWrap
4
4
  module App
5
+ include BubbleWrap::Deprecated
6
+
5
7
  module_function
6
8
 
7
9
  # Returns the application's document directory path where users might be able to upload content.
@@ -25,6 +27,7 @@ module BubbleWrap
25
27
  def user_cache
26
28
  NSUserDefaults.standardUserDefaults
27
29
  end
30
+ deprecated :user_cache, "2.0.0"
28
31
 
29
32
  # Executes a block after a certain delay
30
33
  # Usage example:
@@ -21,6 +21,9 @@ module BubbleWrap
21
21
  BubbleWrap::SETTINGS[:use_weak_callbacks]
22
22
  end
23
23
 
24
+ def version
25
+ BubbleWrap::VERSION
26
+ end
24
27
  end
25
28
 
26
29
  BW = BubbleWrap unless defined?(BW)
@@ -0,0 +1,42 @@
1
+ module BubbleWrap
2
+ module Deprecated
3
+
4
+ class DeprecatedError < StandardError; end
5
+
6
+ def deprecated(method_sym, version)
7
+ unless method_sym.kind_of?(Symbol)
8
+ raise ArgumentError, "deprecated() requires symbols for its first argument."
9
+ end
10
+
11
+ scope = nil
12
+ alias_scope = nil
13
+ if self.methods.include?(method_sym)
14
+ scope = :define_singleton_method
15
+ alias_scope = (class << self; self end)
16
+ elsif self.instance_methods.include?(method_sym)
17
+ scope = :define_method
18
+ alias_scope = self
19
+ else
20
+ raise ArgumentError, "Method not found for deprecated() - #{method_sym}"
21
+ end
22
+
23
+
24
+ send(scope, "#{method_sym}_with_deprecation", ->(*args, &block) {
25
+ fail = BubbleWrap.version.to_s >= version.to_s
26
+ if fail
27
+ raise DeprecatedError, "#{method_sym} was deprecated and removed in BubbleWrap #{version}"
28
+ else
29
+ NSLog "#{method_sym} is deprecated -- it will be removed in BubbleWrap #{version}"
30
+ send("#{method_sym}_without_deprecation", *args, &block)
31
+ end
32
+ })
33
+
34
+ alias_scope.send(:alias_method, "#{method_sym}_without_deprecation", method_sym)
35
+ alias_scope.send(:alias_method, method_sym, "#{method_sym}_with_deprecation")
36
+ end
37
+
38
+ def self.included(base)
39
+ base.extend(self)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,84 @@
1
+ module ModuleExample
2
+ include BubbleWrap::Deprecated
3
+
4
+ module_function
5
+
6
+ def a_method
7
+ @called = true
8
+ end
9
+
10
+ deprecated :a_method, "100.0.0"
11
+ end
12
+
13
+ class ClassExample
14
+ include BubbleWrap::Deprecated
15
+
16
+ def a_method
17
+ @called = true
18
+ end
19
+ deprecated :a_method, "100.0.0"
20
+ end
21
+
22
+ module BubbleWrap
23
+ def self.set_version(version)
24
+ define_singleton_method("version") do
25
+ version
26
+ end
27
+ end
28
+ end
29
+
30
+ describe BubbleWrap::Deprecated do
31
+ describe ".deprecated" do
32
+ describe "on a module method" do
33
+ describe "with valid version" do
34
+ it "should not raise an exception" do
35
+ should.not.raise(BubbleWrap::Deprecated::DeprecatedError) {
36
+ ModuleExample.a_method
37
+ }
38
+ end
39
+ end
40
+
41
+ describe "with invalid version" do
42
+ before do
43
+ @old_version = BubbleWrap.version
44
+ BubbleWrap.set_version("100.0.0")
45
+ end
46
+ after do
47
+ BubbleWrap.set_version(@old_version)
48
+ end
49
+
50
+ it "should raise an exception" do
51
+ should.raise(BubbleWrap::Deprecated::DeprecatedError) {
52
+ ModuleExample.a_method
53
+ }
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "on an instance method" do
59
+ describe "with valid version" do
60
+ it "should not raise an exception" do
61
+ should.not.raise(BubbleWrap::Deprecated::DeprecatedError) {
62
+ ClassExample.new.a_method
63
+ }
64
+ end
65
+ end
66
+
67
+ describe "with invalid version" do
68
+ before do
69
+ @old_version = BubbleWrap.version
70
+ BubbleWrap.set_version("100.0.0")
71
+ end
72
+ after do
73
+ BubbleWrap.set_version(@old_version)
74
+ end
75
+
76
+ it "should raise an exception" do
77
+ should.raise(BubbleWrap::Deprecated::DeprecatedError) {
78
+ ClassExample.new.a_method
79
+ }
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bubble-wrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.rc1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Aimonetti
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2014-02-17 00:00:00.000000000 Z
17
+ date: 2014-03-04 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: mocha
@@ -138,6 +138,7 @@ extra_rdoc_files:
138
138
  - motion/ui/ui_view_controller_wrapper.rb
139
139
  - motion/ui/ui_view_wrapper.rb
140
140
  - motion/util/constants.rb
141
+ - motion/util/deprecated.rb
141
142
  - spec/lib/bubble-wrap/ext/motion_project_app_spec.rb
142
143
  - spec/lib/bubble-wrap/ext/motion_project_config_spec.rb
143
144
  - spec/lib/motion_stub.rb
@@ -178,6 +179,7 @@ extra_rdoc_files:
178
179
  - spec/motion/ui/ui_view_controller_wrapper_spec.rb
179
180
  - spec/motion/ui/ui_view_wrapper_spec.rb
180
181
  - spec/motion/util/constants_spec.rb
182
+ - spec/motion/util/deprecated_spec.rb
181
183
  files:
182
184
  - .gitignore
183
185
  - .travis.yml
@@ -264,6 +266,7 @@ files:
264
266
  - motion/ui/ui_view_controller_wrapper.rb
265
267
  - motion/ui/ui_view_wrapper.rb
266
268
  - motion/util/constants.rb
269
+ - motion/util/deprecated.rb
267
270
  - resources/Localizable.strings
268
271
  - resources/atom.xml
269
272
  - resources/test.mp3
@@ -356,6 +359,7 @@ files:
356
359
  - spec/motion/ui/ui_view_controller_wrapper_spec.rb
357
360
  - spec/motion/ui/ui_view_wrapper_spec.rb
358
361
  - spec/motion/util/constants_spec.rb
362
+ - spec/motion/util/deprecated_spec.rb
359
363
  - travis.sh
360
364
  homepage: http://bubblewrap.io/
361
365
  licenses: []
@@ -371,9 +375,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
375
  version: '0'
372
376
  required_rubygems_version: !ruby/object:Gem::Requirement
373
377
  requirements:
374
- - - '>'
378
+ - - '>='
375
379
  - !ruby/object:Gem::Version
376
- version: 1.3.1
380
+ version: '0'
377
381
  requirements: []
378
382
  rubyforge_project:
379
383
  rubygems_version: 2.0.3
@@ -425,3 +429,4 @@ test_files:
425
429
  - spec/motion/ui/ui_view_controller_wrapper_spec.rb
426
430
  - spec/motion/ui/ui_view_wrapper_spec.rb
427
431
  - spec/motion/util/constants_spec.rb
432
+ - spec/motion/util/deprecated_spec.rb