under-os-core 1.4.0

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.
@@ -0,0 +1,11 @@
1
+ describe UnderOs::Screen do
2
+
3
+ describe '#size' do
4
+ it "should return the size as a Point" do
5
+ size = UnderOs::Screen.size
6
+ size.class.should == UnderOs::Point
7
+ size.x.should == 320
8
+ size.y.should == 568
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,93 @@
1
+ describe UnderOs::Timer do
2
+ describe '#initialize' do
3
+ before do
4
+ @block = Proc.new {}
5
+ @timer = UnderOs::Timer.new(11, repeat: true, &@block)
6
+ end
7
+
8
+ it "saves the block" do
9
+ @timer.block.should == @block
10
+ end
11
+
12
+ it "sets the interval correctly" do
13
+ @timer.interval.should == 11
14
+ end
15
+
16
+ it "sets the repeating cycle correctly" do
17
+ @timer.repeats.should == true
18
+ end
19
+ end
20
+
21
+ describe UnderOs::Timer::Duration do
22
+ before do
23
+ @duration = UnderOs::Timer::Duration.new(10)
24
+ end
25
+
26
+ it "saves the value in seconds" do
27
+ @duration.seconds.should == 10.0
28
+ end
29
+
30
+ it "knows how to convert itself to floats" do
31
+ @duration.to_f.should == 10.0
32
+ end
33
+
34
+ it "knows how to convert itself into integers" do
35
+ @duration.to_i.should == 10
36
+ end
37
+
38
+ it "knows how to convert itself into strings" do
39
+ @duration.to_s.should == "10.0 seconds"
40
+ end
41
+
42
+ it "knows how to compare itself to other durations" do
43
+ @duration.should == UnderOs::Timer::Duration.new(10)
44
+ @duration.should.not == UnderOs::Timer::Duration.new(9)
45
+ end
46
+
47
+ describe '#later' do
48
+ before do
49
+ @block = Proc.new {}
50
+ @timer = 10.seconds.later &@block
51
+ end
52
+
53
+ it "spawns a timer" do
54
+ @timer.class.should == UnderOs::Timer
55
+ end
56
+
57
+ it "spawns one-time timer" do
58
+ @timer.repeats.should == false
59
+ end
60
+
61
+ it "spawns a timer with correct interval" do
62
+ @timer.interval.should == 10.0
63
+ end
64
+
65
+ it "spawns a timer with correct block to call" do
66
+ @timer.block.should == @block
67
+ end
68
+ end
69
+
70
+ describe '#repeat' do
71
+ before do
72
+ @block = Proc.new {}
73
+ @timer = 20.seconds.repeat &@block
74
+ end
75
+
76
+ it "spawns a timer" do
77
+ @timer.class.should == UnderOs::Timer
78
+ end
79
+
80
+ it "spawns a recursive timer" do
81
+ @timer.repeats.should == true
82
+ end
83
+
84
+ it "spawns a timer with correct interval" do
85
+ @timer.interval.should == 20.0
86
+ end
87
+
88
+ it "spawns a timer with correct block to call" do
89
+ @timer.block.should == @block
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.dirname(__FILE__) + "/lib/under_os"
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "under-os-core"
6
+ gem.version = UnderOs::VERSION
7
+ gem.homepage = "http://under-os.com"
8
+
9
+ gem.authors = ["Nikolay Nemshilov"]
10
+ gem.email = ['nemshilov@gmail.com']
11
+ gem.description = "The core part of the UnderOs project"
12
+ gem.summary = "The core part of the UnderOs project. Summaries FTW"
13
+ gem.license = 'MIT'
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+
19
+ gem.add_development_dependency 'rake'
20
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: under-os-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Nikolay Nemshilov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: The core part of the UnderOs project
28
+ email:
29
+ - nemshilov@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/core/json.rb
36
+ - lib/core/numeric.rb
37
+ - lib/core/object.rb
38
+ - lib/core/string.rb
39
+ - lib/under-os-core.rb
40
+ - lib/under_os.rb
41
+ - lib/under_os/app.rb
42
+ - lib/under_os/color.rb
43
+ - lib/under_os/config.rb
44
+ - lib/under_os/delegate.rb
45
+ - lib/under_os/events.rb
46
+ - lib/under_os/file.rb
47
+ - lib/under_os/point.rb
48
+ - lib/under_os/screen.rb
49
+ - lib/under_os/timer.rb
50
+ - spec/core/json_spec.rb
51
+ - spec/core/numeric_spec.rb
52
+ - spec/core/string_spec.rb
53
+ - spec/under_os/color_spec.rb
54
+ - spec/under_os/events_spec.rb
55
+ - spec/under_os/file_spec.rb
56
+ - spec/under_os/point_spec.rb
57
+ - spec/under_os/screen_spec.rb
58
+ - spec/under_os/timer_spec.rb
59
+ - under-os-core.gemspec
60
+ homepage: http://under-os.com
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.2.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: The core part of the UnderOs project. Summaries FTW
84
+ test_files:
85
+ - spec/core/json_spec.rb
86
+ - spec/core/numeric_spec.rb
87
+ - spec/core/string_spec.rb
88
+ - spec/under_os/color_spec.rb
89
+ - spec/under_os/events_spec.rb
90
+ - spec/under_os/file_spec.rb
91
+ - spec/under_os/point_spec.rb
92
+ - spec/under_os/screen_spec.rb
93
+ - spec/under_os/timer_spec.rb