cosmos 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CONTRIBUTING.txt +50 -0
- data/Gemfile +1 -0
- data/Manifest.txt +2 -0
- data/README.md +66 -1
- data/cosmos.gemspec +2 -3
- data/data/crc.txt +2 -2
- data/demo/Gemfile +1 -0
- data/ext/cosmos/ext/platform/platform.c +1 -2
- data/ext/mkrf_conf.rb +40 -0
- data/install/Gemfile +1 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +1 -0
- data/lib/cosmos/version.rb +4 -4
- data/spec/core_ext/io_spec.rb +1 -1
- data/spec/core_ext/math_spec.rb +2 -2
- data/spec/interfaces/interface_spec.rb +3 -0
- data/spec/interfaces/udp_interface_spec.rb +2 -0
- data/spec/io/json_drb_object_spec.rb +6 -0
- data/spec/io/json_drb_spec.rb +18 -0
- data/spec/io/tcpip_server_spec.rb +28 -12
- data/spec/packet_logs/packet_log_writer_spec.rb +25 -11
- data/spec/script/script_spec.rb +8 -4
- data/spec/spec_helper.rb +11 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +33 -10
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +9 -10
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +5 -0
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +16 -19
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +38 -49
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +17 -7
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +9 -12
- data/spec/tools/cmd_tlm_server/routers_spec.rb +17 -5
- data/spec/top_level/top_level_spec.rb +4 -3
- metadata +7 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb270bd80553e0a9a6e5d1b5807cbe4765c827f1
|
4
|
+
data.tar.gz: 1683b970065a1f6374ead85720a77271fd276dd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6e6861a3697374c0c87818330c6cfa51daf13604f4a6851ac77665bacf51b3fd41c449c0a427a76166dccfef3262764828e98418f25bae5e4f9c9fd16dbf16b
|
7
|
+
data.tar.gz: f7c5643ded6fb316c9e352ff2c5a4522e5be4ba76578bbcf1279749e33e77cc397e5977649e6c44b90f73eac1fdba52328f4614a4023f5020fa7b330d5e9eb7c
|
data/.travis.yml
CHANGED
data/CONTRIBUTING.txt
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
In order to contribute to Ball Aerospace COSMOS you must agree to the following Contributor License Agreement. This agreement should be completed online at:
|
2
|
+
https://docs.google.com/forms/d/1ppnHUSXtY1GRTNPIyUaB1OYHbW5Ca67GFMgMRPBG8u0/viewform
|
3
|
+
|
4
|
+
INTRODUCTION
|
5
|
+
|
6
|
+
In order to establish the intellectual property license granted with Contributions from any person or entity, Ball Aerospace & Technologies Corp. ("Ball Aerospace") must have a signed Ball Aerospace COSMOS Software� Contributor License Agreement ("Ball CLA") on file for each Contributor, indicating agreement to the license terms set forth below. The Ball CLA is intended for your protection as a Contributor as well as for the protection of Ball Aerospace and the user community of Ball Aerospace COSMOS Software� distributed by Ball Aerospace ("COSMOS Software"). Be advised that this Ball CLA does not change your rights to use your own Contributions for any other purpose.
|
7
|
+
|
8
|
+
LICENSE AGREEMENT
|
9
|
+
|
10
|
+
The Contributor accepts and agrees to the following terms and conditions for all present and future Contributions submitted to Ball Aerospace for inclusion in the COSMOS Software. Except for the license granted herein to Ball Aerospace and the users of the COSMOS Software, you reserve all rights, title, and interest in and to your Contributions.
|
11
|
+
|
12
|
+
1. Definitions.
|
13
|
+
|
14
|
+
"Contribution" shall mean any original work of authorship, including any modification or addition to an existing work, that has been submitted for inclusion in, or documentation of, the COSMOS Software, where such work originates from a Contributor or from some entity acting on behalf of a Contributor. For the purposes of this definition, a Contribution shall be considered to have been "submitted" when any form of electronic, verbal, or written communication is sent to Ball Aerospace, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by or on behalf of Ball Aerospace for the purpose of discussing or improving the COSMOS Software or its documentation, but excluding communications that are conspicuously marked or otherwise designated in writing as "Not a Contribution." Any Contribution submitted to Ball Aerospace for the COSMOS Software shall be subject to the terms and conditions of this license, without any additional terms or conditions, unless you explicitly state otherwise in your submission.
|
15
|
+
|
16
|
+
"Contributor" (also referred to herein as "you" and "your") shall mean any individual or legal entity who is the copyright holder, or a legal entity authorized by the copyright holder, who has entered into this Agreement with Ball Aerospace and voluntarily submitted a Contribution to the COSMOS Software. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" shall mean: (i) the power, direct or indirect, to cause the direction and management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares of such entity, or (iii) beneficial ownership of such entity.
|
17
|
+
|
18
|
+
2. Grant of Copyright License.
|
19
|
+
|
20
|
+
Subject to the terms and conditions of this Agreement, the Contributor hereby grants to Ball Aerospace and to the users of the COSMOS Software a perpetual, non-exclusive, worldwide, royalty-free, fully paid up, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the Contribution and any derivative works based thereon.
|
21
|
+
|
22
|
+
3. Grant of Patent License.
|
23
|
+
|
24
|
+
Subject to the terms and conditions of this Agreement, the Contributor hereby grants to Ball Aerospace and to the users of the COSMOS Software a perpetual, non-exclusive, worldwide, royalty-free, fully paid up, irrevocable (except as stated otherwise in this paragraph) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the COSMOS Software, where such license applies only to those patent claims licensable by you that are necessarily infringed by your Contribution(s) alone or by combination of your Contribution(s) with the work to which such Contribution(s) was submitted. If any person or entity institutes patent litigation against you or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the COSMOS Software to which you have contributed, constitutes direct or contributory patent infringement, in that event any patent license granted to that person or entity under this Agreement for that Contribution or the COSMOS Software shall terminate as of the date such litigation is filed.
|
25
|
+
|
26
|
+
4. Representation Regarding Legal Capacity to Grant License.
|
27
|
+
|
28
|
+
You hereby represent that you are legally entitled to grant the above-described licenses in each Contribution you make hereunder. If you are employed and your employer has rights in any intellectual property you create that includes your Contribution, you represent that: (i) you have received permission to make such Contribution on behalf of your employer; (ii) your employer has waived its rights for your Contribution to the COSMOS Software; or (iii) your employer has executed a separate Ball CLA.
|
29
|
+
|
30
|
+
5. Representation Regarding Originality of Contributions.
|
31
|
+
|
32
|
+
You hereby represent that each Contribution you submit is your original creation. You further represent that each Contribution you submit includes complete details regarding any third-party licenses or other legal restrictions (including, but not limited to, patents, copyrights, trademarks, and license agreements) of which you are personally aware and which are associated with any part of your Contribution.
|
33
|
+
|
34
|
+
6. Submissions on Behalf of Third Parties.
|
35
|
+
|
36
|
+
Should you wish to submit work that is not your original creation, you may submit it to Ball Aerospace for inclusion in the COSMOS Software separately from any Contribution. The process for submitting such material is as follows: (i) completely identify the details regarding the source of the material being submitted; (ii) fully describe any legal restrictions (including, but not limited to, patents, copyrights, trademarks, and license agreements) to which material being submitted is subject as far as you are personally aware; and (iii) conspicuously mark the material being submitted as: "Submitted on behalf of a third party: [named here]."
|
37
|
+
|
38
|
+
7. Provision of Support for Contributions.
|
39
|
+
|
40
|
+
You are not expected to provide support for your Contributions, except to the extent you desire to provide support. You may provide support gratuitously, for a fee, or not at all. Your Contributions are provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
41
|
+
|
42
|
+
8. Obligation to Maintain Accuracy of Representations.
|
43
|
+
|
44
|
+
You agree to notify Ball Aerospace of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
|
45
|
+
|
46
|
+
9. Acknowledgement of Discretionary Use of Contributions.
|
47
|
+
|
48
|
+
You acknowledge and agree that Ball Aerospace is under no obligation to accept or include any Contribution to the COSMOS Software.
|
49
|
+
|
50
|
+
AGREED TO AND ACCEPTED BY:
|
data/Gemfile
CHANGED
data/Manifest.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
.gitignore
|
2
2
|
.travis.yml
|
3
|
+
CONTRIBUTING.txt
|
3
4
|
Gemfile
|
4
5
|
Guardfile
|
5
6
|
LICENSE.txt
|
@@ -515,6 +516,7 @@ ext/cosmos/ext/tabbed_plots_config/extconf.rb
|
|
515
516
|
ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c
|
516
517
|
ext/cosmos/ext/telemetry/extconf.rb
|
517
518
|
ext/cosmos/ext/telemetry/telemetry.c
|
519
|
+
ext/mkrf_conf.rb
|
518
520
|
install/Gemfile
|
519
521
|
install/Launcher
|
520
522
|
install/Launcher.bat
|
data/README.md
CHANGED
@@ -1,7 +1,60 @@
|
|
1
1
|
## Welcome to Ball Aerospace COSMOS
|
2
2
|
|
3
|
+
> "The User Interface for Embedded Systems"
|
4
|
+
|
5
|
+
[Documentation](https://github.com/BallAerospace/COSMOS/wiki)
|
6
|
+
|
3
7
|
Ball Aerospace COSMOS provides all the functionality needed to send commands to and receive data from one or more embedded systems referred to as "targets". Out of the box functionality includes: Telemetry Display, Telemetry Graphing, Operational and Test Scripting, Command Sending, Logging, Log File Playback, Table Management, and more.
|
4
8
|
|
9
|
+
So what can you use this for? We use it to test about everything we create and COSMOS is great for automating any system of embedded systems. It can provide a fully featured user interface to any piece of hardware that provides an electronic way of communicating with it (TCP/IP, UDP, Serial, etc). Potential uses range from testing embedded systems, to home automation, to verifying cell phones, to helping you make that next great thing that changes the world! The sky is the limit...
|
10
|
+
|
11
|
+
After configuring COSMOS to talk to your hardware, you immediately can use the following 15 tools:
|
12
|
+
|
13
|
+
1. **Command and Telemetry Server**
|
14
|
+
* This is the heart of the realtime functionality within the Ball Aerospace COSMOS system. It maintains realtime connections to each target in your system and is the single point for all outgoing commands and incoming telemetry packets. By default, it logs all commands and telemetry sent/received for later review and analysis. The Command and Telemetry Server also monitors limits on all telemetry packets received.
|
15
|
+
|
16
|
+
1. **Replay**
|
17
|
+
* Replay masquerades as the Command and Telemetry Server but it sources telemetry packets from telemetry log files instead of realtime streams. VCR style controls are provided to move backwards and forwards through telemetry logs and play them back into the other COSMOS realtime tools. Especially useful with Telemetry Viewer. Cannot be used at the same time as the Command and Telemetry Server (at least on the same computer).
|
18
|
+
|
19
|
+
1. **Limits Monitor**
|
20
|
+
* The Limits Monitor tool provides an overview of all telemetry points in the system that are currently out of limits. It also maintains a log of limits changes and continues to display items that have gone out of limits even after they have been restored to green status.
|
21
|
+
|
22
|
+
1. **Command Sender**
|
23
|
+
* Command Sender allows you to manually send one-off commands with conventient drop downs and descriptions of each command and command parameter.
|
24
|
+
|
25
|
+
1. **Script Runner**
|
26
|
+
* Script Runner allows for running COSMOS test procedures or any other Ruby code from a graphical environment that highlights each line as it executes. At anytime during execution, the script can be paused or stopped. If a telemetry check fails or any other exception occurs, the script is immediately stopped and the user notified. Built-in code completion makes writing COSMOS scripts easy.
|
27
|
+
|
28
|
+
1. **Test Runner**
|
29
|
+
* Operations and formal testing meet the unit test framework paradigm. Test Runner allows you to break your operational or test procedures down into discreet test cases that each complete with either SUCCESS or FAILURE. After running, a test report is automatically created for you. Convenient features such as the ability to loop testing help get the kinks out of your system before formal runs.
|
30
|
+
|
31
|
+
1. **Packet Viewer**
|
32
|
+
* Packet Viewer provide a simple key value list of each telemetry item in the system giving you full view of the most recent realtime value of any telemetry point.
|
33
|
+
|
34
|
+
1. **Telemetry Viewer**
|
35
|
+
* Create custom organized telemetry screens using a wide variety of available telemetry widgets for display. Provide exactly the views that your users need to see for each subsystem in you system.
|
36
|
+
|
37
|
+
1. **Telemetry Grapher**
|
38
|
+
* Realtime and offline line graphing and x-y plotting of telemetry points. Multiple telemetry points per plot, multiple plots per tab, and multiple tabs allow you to efficiently organize your data. Great for graphing temperatures and voltages both in realtime and post-test.
|
39
|
+
|
40
|
+
1. **Data Viewer**
|
41
|
+
* Sometimes data cannot be displayed effectively in telemety widgets or is not as useful without being able to scroll back through a history of values. Data Viewer is used to provide a textual display of telemetry items and packets with scrollable history. It provides a great display for log messages, events, memory dumps, and other forms of data that don't fit well into the other display options.
|
42
|
+
|
43
|
+
1. **Telemetry Extractor**
|
44
|
+
* Used for offline analysis of telemetry log files. Telemetry Extracts extracts a given list of telemetry items from a telemetry log file into a CSV file for further analysis in other tools such as Excel or Matlab.
|
45
|
+
|
46
|
+
1. **Command Extractor**
|
47
|
+
* Used for offline analysis of command log files. Takes binary command log files and converts them into human readable text.
|
48
|
+
|
49
|
+
1. **Handbook Creator**
|
50
|
+
* Creates Command and Telemetry Handbooks using the information in the COSMOS configuration files in both HTML and PDF formats. This provides a more human readable reference document to give to people who want to use a COSMOS system.
|
51
|
+
|
52
|
+
1. **Table Manager**
|
53
|
+
* Table Manager provides a graphical binary file editor that provides a convenient method for creating and modifying binary configuration files/tables.
|
54
|
+
|
55
|
+
1. **OpenGL Builder**
|
56
|
+
* OpenGL Builder helps in building 3d scenes of objects made of STL (stereolithography) files that can then be used within custom written COSMOS applications where they can be animated or change color based on telemetry.
|
57
|
+
|
5
58
|
COSMOS is built and maintained by Ryan Melton (ryanatball/ryanmelt) and Jason Thomas (jmthomas) at Ball Aerospace & Technologies Corp.
|
6
59
|
|
7
60
|
## Getting Started
|
@@ -10,7 +63,7 @@ COSMOS is built and maintained by Ryan Melton (ryanatball/ryanmelt) and Jason Th
|
|
10
63
|
|
11
64
|
gem install cosmos
|
12
65
|
|
13
|
-
Note on non-windows systems you will need to have all necessary prerequisites installed (primarily cmake and qt 4.8.x). See the [Installation Guide](https://github.com/BallAerospace/COSMOS/wiki/Installation-Guide)
|
66
|
+
Note on non-windows systems you will need to have all necessary prerequisites installed (primarily cmake and qt 4.8.x). See the [Installation Guide](https://github.com/BallAerospace/COSMOS/wiki/Installation-Guide) for detailed instructions.
|
14
67
|
|
15
68
|
2. At the command prompt, create a new COSMOS project:
|
16
69
|
|
@@ -33,6 +86,18 @@ COSMOS is built and maintained by Ryan Melton (ryanatball/ryanmelt) and Jason Th
|
|
33
86
|
|
34
87
|
We encourage you to contribute to COSMOS!
|
35
88
|
|
89
|
+
Contributing is easy.
|
90
|
+
|
91
|
+
1. Fork the project
|
92
|
+
2. Create a feature branch
|
93
|
+
3. Make your changes
|
94
|
+
4. Submit a pull request
|
95
|
+
|
96
|
+
Before any contributions can be incorporated we do require all contributors to sign a Contributor License Agreement here:
|
97
|
+
[Contributor License Agreement](https://docs.google.com/forms/d/1ppnHUSXtY1GRTNPIyUaB1OYHbW5Ca67GFMgMRPBG8u0/viewform)
|
98
|
+
|
99
|
+
This protects both you and us and you retain full rights to any code you write.
|
100
|
+
|
36
101
|
## Code Status
|
37
102
|
|
38
103
|
* [![Build Status](https://travis-ci.org/BallAerospace/COSMOS.svg?branch=master)](https://travis-ci.org/BallAerospace/COSMOS)
|
data/cosmos.gemspec
CHANGED
@@ -52,6 +52,7 @@ spec = Gem::Specification.new do |s|
|
|
52
52
|
s.extensions << 'ext/cosmos/ext/string/extconf.rb'
|
53
53
|
s.extensions << 'ext/cosmos/ext/tabbed_plots_config/extconf.rb'
|
54
54
|
s.extensions << 'ext/cosmos/ext/telemetry/extconf.rb'
|
55
|
+
s.extensions << 'ext/mkrf_conf.rb'
|
55
56
|
|
56
57
|
# Files are defined in Manifest.txt
|
57
58
|
s.files =
|
@@ -78,7 +79,6 @@ spec = Gem::Specification.new do |s|
|
|
78
79
|
s.add_runtime_dependency 'snmp', '~> 1'
|
79
80
|
s.add_runtime_dependency 'rubyzip', '~> 1.1'
|
80
81
|
s.add_runtime_dependency 'qtbindings', '~> 4.8', '>= 4.8.5.2'
|
81
|
-
s.add_runtime_dependency('ruby-termios', '~> 0.9') if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cygwin/i
|
82
82
|
|
83
83
|
# Development Dependencies
|
84
84
|
s.add_development_dependency 'rspec', '~> 3'
|
@@ -87,8 +87,7 @@ spec = Gem::Specification.new do |s|
|
|
87
87
|
s.add_development_dependency 'reek', '~> 1'
|
88
88
|
s.add_development_dependency 'roodi', '~> 4'
|
89
89
|
s.add_development_dependency 'guard', '~> 2'
|
90
|
-
s.add_development_dependency 'listen', '~> 2
|
91
|
-
s.add_development_dependency('wdm', '~> 0.1') if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
|
90
|
+
s.add_development_dependency 'listen', '~> 2'
|
92
91
|
s.add_development_dependency 'guard-bundler', '~> 2'
|
93
92
|
s.add_development_dependency 'guard-rspec', '~> 4'
|
94
93
|
s.add_development_dependency 'simplecov', '~> 0.9'
|
data/data/crc.txt
CHANGED
@@ -157,7 +157,7 @@
|
|
157
157
|
"lib/cosmos/tools/cmd_tlm_server/api.rb" 0xFA8BF170
|
158
158
|
"lib/cosmos/tools/cmd_tlm_server/background_task.rb" 0x448A2191
|
159
159
|
"lib/cosmos/tools/cmd_tlm_server/background_tasks.rb" 0x1C174385
|
160
|
-
"lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb"
|
160
|
+
"lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb" 0xA13DF9A4
|
161
161
|
"lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb" 0xDB9B6253
|
162
162
|
"lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb" 0xE4B94041
|
163
163
|
"lib/cosmos/tools/cmd_tlm_server/commanding.rb" 0xC7C76CD8
|
@@ -298,7 +298,7 @@
|
|
298
298
|
"lib/cosmos/utilities/ruby_lex_utils.rb" 0x5FC7DF77
|
299
299
|
"lib/cosmos/utilities/simulated_target.rb" 0x7EE7A3FF
|
300
300
|
"lib/cosmos/utilities.rb" 0x19FDBD80
|
301
|
-
"lib/cosmos/version.rb"
|
301
|
+
"lib/cosmos/version.rb" 0x3BD600BC
|
302
302
|
"lib/cosmos/win32/excel.rb" 0xB4D4195E
|
303
303
|
"lib/cosmos/win32/win32.rb" 0xEF748B06
|
304
304
|
"lib/cosmos/win32/win32_main.rb" 0x75FB669C
|
data/demo/Gemfile
CHANGED
@@ -62,9 +62,8 @@ static VALUE segfault(VALUE self) {
|
|
62
62
|
* Initialize methods for Platform specific C code
|
63
63
|
*/
|
64
64
|
void Init_platform (void) {
|
65
|
-
VALUE ruby_version = rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"));
|
66
|
-
|
67
65
|
#ifdef _WIN32
|
66
|
+
VALUE ruby_version = rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"));
|
68
67
|
char* rversion = RSTRING_PTR(ruby_version);
|
69
68
|
if ((rversion[0] == '2') && (rversion[2] == '0')) {
|
70
69
|
LoadLibraryA("exchndl20.dll");
|
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
|
11
|
+
# This file gems specific to platform
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'rubygems/command.rb'
|
15
|
+
require 'rubygems/dependency_installer.rb'
|
16
|
+
|
17
|
+
def gem_installed?(name, version = Gem::Requirement.default)
|
18
|
+
version = Gem::Requirement.create version unless version.is_a? Gem::Requirement
|
19
|
+
Gem::Specification.each.any? { |spec| name == spec.name and version.satisfied_by? spec.version }
|
20
|
+
end
|
21
|
+
|
22
|
+
begin
|
23
|
+
Gem::Command.build_args = ARGV
|
24
|
+
rescue NoMethodError
|
25
|
+
end
|
26
|
+
inst = Gem::DependencyInstaller.new
|
27
|
+
begin
|
28
|
+
if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cygwin/i
|
29
|
+
unless gem_installed?("ruby-termios", "~> 0.9")
|
30
|
+
STDOUT.puts "Attempting to install ruby-termios... If this fails please manually \"gem install ruby-termios\" and try again."
|
31
|
+
inst.install "ruby-termios", "~> 0.9"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
rescue
|
35
|
+
exit(1)
|
36
|
+
end
|
37
|
+
|
38
|
+
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success
|
39
|
+
f.write("task :default\n")
|
40
|
+
f.close
|
data/install/Gemfile
CHANGED
data/lib/cosmos/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
COSMOS_VERSION = '3.0.
|
3
|
+
COSMOS_VERSION = '3.0.1'
|
4
4
|
module Cosmos
|
5
5
|
module Version
|
6
6
|
MAJOR = '3'
|
7
7
|
MINOR = '0'
|
8
|
-
PATCH = '
|
9
|
-
BUILD = '
|
8
|
+
PATCH = '1'
|
9
|
+
BUILD = 'f19556ddbfdda1e439bfaec33e9f81f32a3e868e'
|
10
10
|
end
|
11
|
-
VERSION = '3.0.
|
11
|
+
VERSION = '3.0.1'
|
12
12
|
end
|
data/spec/core_ext/io_spec.rb
CHANGED
data/spec/core_ext/math_spec.rb
CHANGED
@@ -16,13 +16,13 @@ describe Math do
|
|
16
16
|
|
17
17
|
describe "sin_squared" do
|
18
18
|
it "should calculate sin squared" do
|
19
|
-
sin_squared(10).should
|
19
|
+
sin_squared(10).should be_within(0.00000001).of(sin(10)**2)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "cos_squared" do
|
24
24
|
it "should calculate cos squared" do
|
25
|
-
cos_squared(10).should
|
25
|
+
cos_squared(10).should be_within(0.00000001).of(cos(10)**2)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -109,6 +109,7 @@ module Cosmos
|
|
109
109
|
sleep 0.1
|
110
110
|
thread.stop?.should be_truthy
|
111
111
|
thread.kill
|
112
|
+
thread.join
|
112
113
|
end
|
113
114
|
|
114
115
|
it "should stop the read thread if there is an IOError" do
|
@@ -121,6 +122,7 @@ module Cosmos
|
|
121
122
|
sleep 0.1
|
122
123
|
thread.stop?.should be_truthy
|
123
124
|
thread.kill
|
125
|
+
thread.join
|
124
126
|
end
|
125
127
|
|
126
128
|
it "should count the packets received" do
|
@@ -34,6 +34,7 @@ module Cosmos
|
|
34
34
|
obj.my_method(10).should eql 20
|
35
35
|
obj.disconnect
|
36
36
|
json.stop_service
|
37
|
+
sleep(0.1)
|
37
38
|
end
|
38
39
|
|
39
40
|
it "should raise an exception if the remote connection can't be made" do
|
@@ -42,7 +43,9 @@ module Cosmos
|
|
42
43
|
allow(TCPSocket).to receive(:new) { raise "Error" }
|
43
44
|
obj = JsonDRbObject.new("localhost", 7777)
|
44
45
|
expect { obj.my_method(10) }.to raise_error(DRb::DRbConnError)
|
46
|
+
obj.disconnect
|
45
47
|
json.stop_service
|
48
|
+
sleep(0.1)
|
46
49
|
end
|
47
50
|
|
48
51
|
it "should retry the request and then raise an exception" do
|
@@ -59,6 +62,7 @@ module Cosmos
|
|
59
62
|
expect { obj.my_method(10) }.to raise_error(DRb::DRbConnError)
|
60
63
|
obj.disconnect
|
61
64
|
json.stop_service
|
65
|
+
sleep(0.1)
|
62
66
|
end
|
63
67
|
|
64
68
|
it "should raise an exception if the remote method returns an error" do
|
@@ -69,6 +73,7 @@ module Cosmos
|
|
69
73
|
expect { obj.method_missing(:send) }.to raise_error(/Cannot call unauthorized methods/)
|
70
74
|
obj.disconnect
|
71
75
|
json.stop_service
|
76
|
+
sleep(0.1)
|
72
77
|
end
|
73
78
|
|
74
79
|
it "should handle the remote not returning a response" do
|
@@ -85,6 +90,7 @@ module Cosmos
|
|
85
90
|
expect { obj.my_method(10) }.to raise_error(DRb::DRbConnError)
|
86
91
|
obj.disconnect
|
87
92
|
json.stop_service
|
93
|
+
sleep(0.1)
|
88
94
|
end
|
89
95
|
|
90
96
|
end
|
data/spec/io/json_drb_spec.rb
CHANGED
@@ -69,10 +69,13 @@ module Cosmos
|
|
69
69
|
@json.thread.should be_nil
|
70
70
|
system_exit_count = $system_exit_count
|
71
71
|
@json.start_service('blah', 7777, self)
|
72
|
+
thread = @json.thread
|
72
73
|
$system_exit_count.should eql(system_exit_count + 1)
|
73
74
|
sleep 0.1
|
74
75
|
|
75
76
|
stdout.string.should match /listen thread/
|
77
|
+
@json.stop_service
|
78
|
+
sleep(0.1)
|
76
79
|
end
|
77
80
|
|
78
81
|
Dir[File.join(Cosmos::USERPATH,"*_exception.txt")].each do |file|
|
@@ -86,6 +89,7 @@ module Cosmos
|
|
86
89
|
@json.thread.alive?.should be_truthy
|
87
90
|
expect { @json.start_service('127.0.0.1', 7777, self) }.to raise_error(/Error binding to port/)
|
88
91
|
@json.stop_service
|
92
|
+
sleep(0.1)
|
89
93
|
end
|
90
94
|
|
91
95
|
it "should rescue listen thread exceptions" do
|
@@ -95,6 +99,7 @@ module Cosmos
|
|
95
99
|
socket = TCPSocket.open('127.0.0.1',7777)
|
96
100
|
sleep 0.1
|
97
101
|
@json.stop_service
|
102
|
+
sleep(0.1)
|
98
103
|
|
99
104
|
stdout.string.should match /JsonDRb listen thread unexpectedly died/
|
100
105
|
end
|
@@ -110,7 +115,9 @@ module Cosmos
|
|
110
115
|
socket = TCPSocket.open('127.0.0.1',7777)
|
111
116
|
sleep 0.1
|
112
117
|
socket.eof?.should be_truthy
|
118
|
+
socket.close
|
113
119
|
@json.stop_service
|
120
|
+
sleep(0.1)
|
114
121
|
end
|
115
122
|
end
|
116
123
|
|
@@ -127,6 +134,7 @@ module Cosmos
|
|
127
134
|
socket.close
|
128
135
|
sleep 0.1
|
129
136
|
@json.stop_service
|
137
|
+
sleep(0.1)
|
130
138
|
end
|
131
139
|
|
132
140
|
it "should process success requests" do
|
@@ -146,6 +154,7 @@ module Cosmos
|
|
146
154
|
socket.close
|
147
155
|
sleep 0.1
|
148
156
|
@json.stop_service
|
157
|
+
sleep(0.1)
|
149
158
|
end
|
150
159
|
|
151
160
|
it "should process bad methods" do
|
@@ -165,6 +174,7 @@ module Cosmos
|
|
165
174
|
socket.close
|
166
175
|
sleep 0.1
|
167
176
|
@json.stop_service
|
177
|
+
sleep(0.1)
|
168
178
|
end
|
169
179
|
|
170
180
|
it "should process bad parameters" do
|
@@ -186,6 +196,7 @@ module Cosmos
|
|
186
196
|
socket.close
|
187
197
|
sleep 0.1
|
188
198
|
@json.stop_service
|
199
|
+
sleep(0.1)
|
189
200
|
end
|
190
201
|
|
191
202
|
it "should handle method exceptions" do
|
@@ -208,6 +219,7 @@ module Cosmos
|
|
208
219
|
socket.close
|
209
220
|
sleep 0.1
|
210
221
|
@json.stop_service
|
222
|
+
sleep(0.1)
|
211
223
|
end
|
212
224
|
|
213
225
|
it "should not allow dangerous methods" do
|
@@ -224,6 +236,7 @@ module Cosmos
|
|
224
236
|
socket.close
|
225
237
|
sleep 0.1
|
226
238
|
@json.stop_service
|
239
|
+
sleep(0.1)
|
227
240
|
end
|
228
241
|
|
229
242
|
it "should handle an invalid JsonDRB request" do
|
@@ -242,6 +255,7 @@ module Cosmos
|
|
242
255
|
socket.close
|
243
256
|
sleep 0.1
|
244
257
|
@json.stop_service
|
258
|
+
sleep(0.1)
|
245
259
|
end
|
246
260
|
end
|
247
261
|
|
@@ -262,7 +276,9 @@ module Cosmos
|
|
262
276
|
end
|
263
277
|
end
|
264
278
|
JsonDRb.send_data(socket, "\x00")
|
279
|
+
socket.close
|
265
280
|
@json.stop_service
|
281
|
+
sleep(0.1)
|
266
282
|
end
|
267
283
|
|
268
284
|
it "should eventually timeout if the socket blocks" do
|
@@ -275,7 +291,9 @@ module Cosmos
|
|
275
291
|
end
|
276
292
|
allow(IO).to receive(:select) { nil }
|
277
293
|
expect { JsonDRb.send_data(socket, "\x00", 2) }.to raise_error(Timeout::Error)
|
294
|
+
socket.close
|
278
295
|
@json.stop_service
|
296
|
+
sleep(0.1)
|
279
297
|
end
|
280
298
|
end
|
281
299
|
|