motion-assert 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmM4MzAyMDI4YWJlMmI1Nzc1Yjg4NWU3ZDc5ZWIyNDYyMjI5Y2NjOA==
5
+ data.tar.gz: !binary |-
6
+ NDUwY2U1OTVkN2VmMmQ0NjJiODcwZjFlOWY1ZWIzOTQzMjkyNjRlOQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YjA5ZmVlYWNlMzc4NjhhYmJhNmVjYTI4NzkxNWM2ZDQ5Y2FiOWY3MjIzYzYz
10
+ MDdjMGFlMTQ1Y2M3YzM0ZGNmNTVlMDE5MTg0NzVlNmVkZGRhZmJhZDhiZjNm
11
+ ODE3Zjg2YmVmNTQ3NzhmZTUxMzljYWM5NjllMGM2NGIzZjcyNTE=
12
+ data.tar.gz: !binary |-
13
+ Mjg1N2M3MDQzYjBiOTEzYjcwNjRhNTEzNmE2MmI2ODNmOWNlN2RkNTBkYzE4
14
+ NWE1N2U2MzMzYjBlYmQ5NjVlYjhjMjNlNTRkMWMzNTIwNzFmM2E2NTUxOGVi
15
+ MTdhMmM4OTZiMDZkNDZiZTM5NThhYTM0NjM0Yjc4NjA0NzNhMDU=
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+
20
+ .DS_Store
21
+ build
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in motion-assert.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,12 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ bubble-wrap (1.4.0)
5
+ rake (10.1.0)
6
+
7
+ PLATFORMS
8
+ ruby
9
+
10
+ DEPENDENCIES
11
+ bubble-wrap
12
+ rake
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 maethee
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # MotionAssert
2
+
3
+ Asserting in RubyMotion is a tricky task. NSAssert is not yet supported and displaying stacktrace or disabling asserts in release build are far from straight forward. The goal of this gem is to provide the best thing we can currently do for asserting within RubyMotion.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion-assert', :git => 'git://github.com/codiumco/motion-assert.git'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion-assert
18
+
19
+ ## Usage
20
+
21
+ Inlcude MotionAssert module in your app_delegate.rb:
22
+
23
+ include MotionAssert
24
+
25
+ Once MotionAssert module is included, you can assert by calling:
26
+
27
+ Debug.assert(someValue == otherValue, 'someValue is not equal to otherValue!')
28
+
29
+ Currently, displaying a stacktrace when an assert is raised is not yet supported. So when an assert is raised, the best way to identify where it come from is to supply a descriptive message. You can use ruby's \_\_FILE\_\_ and \_\_LINE\_\_ to help you identify the location of the assert as well.
30
+
31
+ ## WARNING!
32
+
33
+ Currently, automatically remove assert in release build is not yet support. Make sure you remember to perform a find-replace for 'Debug.assert' with '#Debug.assert' before you release your application
34
+
35
+
36
+ ## Contributing
37
+
38
+ 1. Fork it
39
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
40
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
41
+ 4. Push to the branch (`git push origin my-new-feature`)
42
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # -*- coding: utf-8 -*-
2
+ $:.unshift("/Library/RubyMotion/lib")
3
+ require 'motion/project/template/ios'
4
+ require 'bundler'
5
+ require 'bubble-wrap'
6
+
7
+ $:.unshift("./lib/")
8
+ require './lib/motion-assert'
9
+
10
+ Motion::Project::App.setup do |app|
11
+ end
@@ -0,0 +1,7 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
3
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
4
+ MotionAssert::Debug.assert(false, 'test assert')
5
+ true
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ unless defined?(Motion::Project::Config)
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ Motion::Project::App.setup do |app|
6
+ Dir.glob(File.join(File.dirname(__FILE__), 'motion-assert/*.rb')).each do |file|
7
+ app.files.unshift(file)
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module MotionAssert
2
+ class Debug
3
+ def self.assert(cond, msg='')
4
+ return if cond
5
+ NSLog('Assertion Failed: %@', msg)
6
+ App.alert(msg)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Motion
2
+ module Assert
3
+ VERSION = "0.0.5"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/motion-assert/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["CODIUM"]
6
+ gem.email = ["maethee.c@codium.co"]
7
+ gem.description = "Write assert in rubymotion"
8
+ gem.summary = "Add ability to write assert in rubymotion (work in progress)."
9
+ gem.homepage = "https://github.com/codiumco/motion-assert"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ #gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "motion-assert"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Motion::Assert::VERSION
17
+ gem.add_dependency "bubble-wrap"
18
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-assert
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - CODIUM
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bubble-wrap
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Write assert in rubymotion
28
+ email:
29
+ - maethee.c@codium.co
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE.txt
38
+ - README.md
39
+ - Rakefile
40
+ - app/app_delegate.rb
41
+ - lib/motion-assert.rb
42
+ - lib/motion-assert/assert.rb
43
+ - lib/motion-assert/version.rb
44
+ - motion-assert.gemspec
45
+ homepage: https://github.com/codiumco/motion-assert
46
+ licenses: []
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.1.11
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Add ability to write assert in rubymotion (work in progress).
68
+ test_files: []