motion_flux 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -5
- data/bin/console +7 -0
- data/bin/setup +7 -0
- data/lib/motion_flux.rb +10 -13
- data/lib/motion_flux/version.rb +1 -1
- data/motion_flux.gemspec +7 -4
- metadata +37 -17
- data/spec/motion_flux/action_spec.rb +0 -26
- data/spec/motion_flux/dispatcher_spec.rb +0 -55
- data/spec/motion_flux/store_spec.rb +0 -45
- data/spec/motion_flux_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d9511e7f5144c24d67746439ca81e028226abe1
|
4
|
+
data.tar.gz: ab309158b5fc77c74910cff5c73a938c23734767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57192a8a003fb9aa3614a23a8c9d8231faa4710bb008d0a4d7661753d0867345b632548c38bc079998a0205fc31c743cc69b6a81d40475d990e289f2a9c0b3be
|
7
|
+
data.tar.gz: c2c39d3abc3a7ae976839773e6f8c7629ea3857d852e969631af7295e2f15ec59d9881d2a5e7355708f3080387800e286d8d95e24021e6bb2464ef3a2365a09b
|
data/README.md
CHANGED
@@ -24,10 +24,18 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
TODO: Write usage instructions here
|
26
26
|
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
27
33
|
## Contributing
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kayhide/motion_flux. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/motion_flux.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require 'motion_flux/dispatcher'
|
12
|
-
require 'motion_flux/store'
|
13
|
-
end
|
1
|
+
require 'motion_blender'
|
2
|
+
MotionBlender.add __FILE__
|
3
|
+
|
4
|
+
require 'motion-support/concern'
|
5
|
+
require 'motion-support/core_ext'
|
6
|
+
|
7
|
+
require 'motion_flux/version'
|
8
|
+
require 'motion_flux/action'
|
9
|
+
require 'motion_flux/dispatcher'
|
10
|
+
require 'motion_flux/store'
|
data/lib/motion_flux/version.rb
CHANGED
data/motion_flux.gemspec
CHANGED
@@ -8,17 +8,20 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = MotionFlux::VERSION
|
9
9
|
spec.authors = ['kayhide']
|
10
10
|
spec.email = ['kayhide@gmail.com']
|
11
|
+
|
11
12
|
spec.summary = 'MotionFlux supports to build Flux-based RubyMotion apps.'
|
12
13
|
spec.description = 'MotionFlux supports to build Flux-based RubyMotion apps.'
|
13
14
|
spec.homepage = 'https://github.com/kayhide/motion_flux'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.
|
18
|
-
spec.
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
20
|
spec.require_paths = ['lib']
|
20
21
|
|
21
|
-
spec.
|
22
|
+
spec.add_runtime_dependency 'motion_blender'
|
23
|
+
spec.add_runtime_dependency 'motion_blender-support'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
26
|
spec.add_development_dependency 'rspec'
|
24
27
|
spec.add_development_dependency 'fuubar'
|
metadata
CHANGED
@@ -1,29 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion_flux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kayhide
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: motion_blender
|
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
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: motion_blender-support
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
45
|
- - "~>"
|
18
46
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
47
|
+
version: '1.10'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
52
|
- - "~>"
|
25
53
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
54
|
+
version: '1.10'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,17 +208,14 @@ files:
|
|
180
208
|
- LICENSE.txt
|
181
209
|
- README.md
|
182
210
|
- Rakefile
|
211
|
+
- bin/console
|
212
|
+
- bin/setup
|
183
213
|
- lib/motion_flux.rb
|
184
214
|
- lib/motion_flux/action.rb
|
185
215
|
- lib/motion_flux/dispatcher.rb
|
186
216
|
- lib/motion_flux/store.rb
|
187
217
|
- lib/motion_flux/version.rb
|
188
218
|
- motion_flux.gemspec
|
189
|
-
- spec/motion_flux/action_spec.rb
|
190
|
-
- spec/motion_flux/dispatcher_spec.rb
|
191
|
-
- spec/motion_flux/store_spec.rb
|
192
|
-
- spec/motion_flux_spec.rb
|
193
|
-
- spec/spec_helper.rb
|
194
219
|
homepage: https://github.com/kayhide/motion_flux
|
195
220
|
licenses:
|
196
221
|
- MIT
|
@@ -211,14 +236,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
236
|
version: '0'
|
212
237
|
requirements: []
|
213
238
|
rubyforge_project:
|
214
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.4.5.1
|
215
240
|
signing_key:
|
216
241
|
specification_version: 4
|
217
242
|
summary: MotionFlux supports to build Flux-based RubyMotion apps.
|
218
|
-
test_files:
|
219
|
-
- spec/motion_flux/action_spec.rb
|
220
|
-
- spec/motion_flux/dispatcher_spec.rb
|
221
|
-
- spec/motion_flux/store_spec.rb
|
222
|
-
- spec/motion_flux_spec.rb
|
223
|
-
- spec/spec_helper.rb
|
243
|
+
test_files: []
|
224
244
|
has_rdoc:
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MotionFlux::Action do
|
4
|
-
class SomeAction < MotionFlux::Action; end
|
5
|
-
|
6
|
-
describe '#to_s' do
|
7
|
-
before do
|
8
|
-
@action = SomeAction.new(:sometiong, 'arg')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'returns string' do
|
12
|
-
expect(@action.to_s).to eq 'SomeAction:sometiong'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '#dispatch' do
|
17
|
-
before do
|
18
|
-
@action = SomeAction.new(:sometiong, 'arg')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'calls MotionFlex::Dispatcher.dispatch' do
|
22
|
-
expect(MotionFlux::Dispatcher).to receive(:dispatch).with(@action)
|
23
|
-
@action.dispatch
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MotionFlux::Dispatcher do
|
4
|
-
class SomeAction < MotionFlux::Action; end
|
5
|
-
class AnotherAction < MotionFlux::Action; end
|
6
|
-
|
7
|
-
describe '.dispatch' do
|
8
|
-
before do
|
9
|
-
@store = double
|
10
|
-
MotionFlux::Dispatcher.register @store, SomeAction
|
11
|
-
end
|
12
|
-
|
13
|
-
after do
|
14
|
-
MotionFlux::Dispatcher.clear
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'calls store method' do
|
18
|
-
expect(@store).to receive(:something)
|
19
|
-
MotionFlux::Dispatcher.dispatch SomeAction.new(:something)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'skips if store does not respond' do
|
23
|
-
expect {
|
24
|
-
MotionFlux::Dispatcher.dispatch SomeAction.new(:something)
|
25
|
-
}.not_to raise_error
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'skips if action is not registered' do
|
29
|
-
expect(@store).not_to receive(:something)
|
30
|
-
MotionFlux::Dispatcher.dispatch AnotherAction.new(:something)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '.exclusive_run' do
|
35
|
-
it 'calls given block' do
|
36
|
-
obj = double
|
37
|
-
expect(obj).to receive(:something)
|
38
|
-
MotionFlux::Dispatcher.exclusive_run 'first' do
|
39
|
-
obj.something
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'skips second block' do
|
44
|
-
obj = double
|
45
|
-
expect(obj).to receive(:something)
|
46
|
-
expect(obj).not_to receive(:other_thing)
|
47
|
-
MotionFlux::Dispatcher.exclusive_run 'first' do
|
48
|
-
obj.something
|
49
|
-
MotionFlux::Dispatcher.exclusive_run 'second' do
|
50
|
-
obj.other_thing
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MotionFlux::Store do
|
4
|
-
class SomeAction < MotionFlux::Action; end
|
5
|
-
|
6
|
-
class SomeStore < MotionFlux::Store; end
|
7
|
-
|
8
|
-
describe '.subscribe' do
|
9
|
-
it 'calls MotionFlex::Dispatcher.register' do
|
10
|
-
expect(MotionFlux::Dispatcher)
|
11
|
-
.to receive(:register).with(SomeStore.instance, SomeAction)
|
12
|
-
SomeStore.subscribe SomeAction
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '.on' do
|
17
|
-
it 'appends handler' do
|
18
|
-
expect {
|
19
|
-
SomeStore.on :event do
|
20
|
-
true
|
21
|
-
end
|
22
|
-
}.to change(SomeStore.handlers, :count).by(1)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '.emit' do
|
27
|
-
it 'calls handler' do
|
28
|
-
handler = double
|
29
|
-
expect(handler).to receive(:call)
|
30
|
-
SomeStore.handlers[:event] << handler
|
31
|
-
SomeStore.emit :event
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#emit' do
|
36
|
-
before do
|
37
|
-
@store = SomeStore.instance
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'calls MotionFlex::Store.emit' do
|
41
|
-
expect(SomeStore).to receive(:emit).with(:event)
|
42
|
-
@store.emit :event
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/spec/motion_flux_spec.rb
DELETED