opal-promise-patch 0.0.1.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4739929603f4fa6c7265be95278a7fb3b82ece08
4
+ data.tar.gz: c97f202c417dfdbaa0375e40aad1d1dc3b70d798
5
+ SHA512:
6
+ metadata.gz: 533618e28dceeb648672e870bd2623657772390df9ce2b9fd1b462c80cdab03d173c2acf7d198e01530239600cde38061b27fc0027b6c3592f203fce68decdfc
7
+ data.tar.gz: 006a6c57c5e1d742ae1bc5f89a3556ff52f768c733a4474bbf2cd1437abb140fd8c6f96969be78de6e2951e69fee8d91efe494c7e2c7c8893bd1d2d3bc73a7ab
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/dummy/.sass-cache
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Change Log
2
+
3
+ ## 0.0.2
4
+ - to_promise on Object to wrap any object in a promise
5
+
6
+ ## 0.0.1
7
+ - Able to chain methods on a promise instead of writing boiler code chaining then. e.g. Promise.new.resolve([1, 2, 3]).length <= returns a promise that resolves into the length of the array
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in opal-promise-patch.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ opal-promise-patch (0.0.1)
5
+ opal (~> 0.7.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ hike (1.2.3)
11
+ multi_json (1.11.0)
12
+ opal (0.7.2)
13
+ hike (~> 1.2)
14
+ sourcemap (~> 0.1.0)
15
+ sprockets (>= 2.2.3, < 3.0.0)
16
+ tilt (~> 1.4)
17
+ rack (1.6.0)
18
+ sourcemap (0.1.1)
19
+ sprockets (2.12.3)
20
+ hike (~> 1.2)
21
+ multi_json (~> 1.0)
22
+ rack (~> 1.0)
23
+ tilt (~> 1.1, != 1.3.0)
24
+ tilt (1.4.1)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ opal-promise-patch!
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 Penn Su
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Opal Promise Patch
2
+
3
+ This project rocks and uses MIT-LICENSE.
4
+
5
+ ## Usage
6
+
7
+ Add `gem opal-promise-patch` to your Gemfile
8
+ Run `bundle install`
9
+ Include `require 'utils/promise/promise_patch'` at the start of your main controller
10
+ Done!
11
+
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Promise'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'test'
27
+ t.pattern = 'test/**/*_test.rb'
28
+ t.verbose = false
29
+ end
30
+
31
+
32
+ task default: :test
data/TODOS ADDED
@@ -0,0 +1,21 @@
1
+ * Fixing arguments passed in as Promises
2
+ Example:
3
+ ```
4
+ begin
5
+ a = store._items.fetch_first
6
+ a._first_name + " " + a._last_name
7
+ rescue => e
8
+ ..
9
+ end
10
+ ```
11
+
12
+ Example:
13
+ ```
14
+ begin
15
+ a = store._items.fetch_first
16
+ " " + a._last_name
17
+ rescue => e
18
+ ..
19
+ end
20
+ ```
21
+ * Exceptions are swallowed
@@ -0,0 +1 @@
1
+ require 'opals/promise_patch/promise_patch'
@@ -0,0 +1,26 @@
1
+ if RUBY_PLATFORM == 'opal'
2
+ require 'promise'
3
+ else
4
+ # Opal doesn't expose its promise library directly
5
+ # gem_dir = Gem::Specification.find_by_name('opal').gem_dir
6
+ require 'opal'
7
+
8
+ gem_dir = File.join(Opal.gem_dir, '..')
9
+ require(gem_dir + '/stdlib/promise')
10
+ end
11
+
12
+ class Promise
13
+ def method_missing(method_name, *args, &block)
14
+ self.then do |result|
15
+ result.send(method_name.to_sym, *args, &block)
16
+ end.fail do |error|
17
+ raise error
18
+ end
19
+ end
20
+ end
21
+
22
+ class Object
23
+ def to_promise
24
+ Promise.new.resolve(self)
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ class Promise
2
+ VERSION = "0.0.1.pre1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/opals/promise_patch/version', __FILE__)
3
+
4
+ # Describe your gem and declare its dependencies:
5
+ Gem::Specification.new do |s|
6
+ s.name = "opal-promise-patch"
7
+ s.version = Promise::VERSION
8
+ s.authors = ["Penn Su"]
9
+ s.email = ["pennsu@gmail.com"]
10
+ s.homepage = "https://github.com/pencilcheck/opal-promise-patch"
11
+ s.summary = "A new way to write synchronize code with opal promises"
12
+ s.description = ""
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = Dir["test/**/*"]
17
+ s.require_paths = ['lib']
18
+
19
+ s.add_runtime_dependency 'opal', '>= 0.7.0', '< 0.9.0'
20
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opal-promise-patch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre1
5
+ platform: ruby
6
+ authors:
7
+ - Penn Su
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: opal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.9.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.7.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.9.0
33
+ description: ''
34
+ email:
35
+ - pennsu@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".gitignore"
41
+ - CHANGELOG.md
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - MIT-LICENSE
45
+ - README.md
46
+ - Rakefile
47
+ - TODOS
48
+ - lib/opal-promise-patch.rb
49
+ - lib/opals/promise_patch/promise_patch.rb
50
+ - lib/opals/promise_patch/version.rb
51
+ - opal-promise-patch.gemspec
52
+ homepage: https://github.com/pencilcheck/opal-promise-patch
53
+ licenses:
54
+ - MIT
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">"
68
+ - !ruby/object:Gem::Version
69
+ version: 1.3.1
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.4.5
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: A new way to write synchronize code with opal promises
76
+ test_files: []
77
+ has_rdoc: