spaceship_mission_simulator 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spaceship_mission_simulator/version.rb +1 -1
- metadata +1 -13
- data/.gitignore +0 -7
- data/.rubocop.yml +0 -13
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -6
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -46
- data/LICENSE.txt +0 -21
- data/README.md +0 -77
- data/Rakefile +0 -27
- data/bin/setup +0 -6
- data/spaceship_mission_simulator.gemspec +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '059c44792a1c5b2bcbe80ead75e5d51d65c327a3882332562a7cbb3754528ad2'
|
4
|
+
data.tar.gz: 977155d7fa0134f0cc30679ed9f230febe8c432dc2f8b75a022fa121808b3e76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ad48b68ba1632bc219406cda33d2bb463f015b63ffcbe99c3c5a0fd90151c7a4564039f0f03b2a2f34b9b5633f0da1ab7bca1716e829008383a71a7b93eecd1
|
7
|
+
data.tar.gz: cf57dff6bed2f9e7c4adc5981118988c4d7f1669d58a478cf30d3e0d3d75eccdf75eda6c889c8c74dc5e27d7b0022e3032edf314dea6f32b3ccfd5a1354f8913
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaceship_mission_simulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- acidwizard
|
@@ -86,17 +86,6 @@ executables: []
|
|
86
86
|
extensions: []
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
|
-
- ".gitignore"
|
90
|
-
- ".rubocop.yml"
|
91
|
-
- ".ruby-gemset"
|
92
|
-
- ".ruby-version"
|
93
|
-
- ".travis.yml"
|
94
|
-
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
|
-
- LICENSE.txt
|
97
|
-
- README.md
|
98
|
-
- Rakefile
|
99
|
-
- bin/setup
|
100
89
|
- lib/spaceship_mission_simulator.rb
|
101
90
|
- lib/spaceship_mission_simulator/event.rb
|
102
91
|
- lib/spaceship_mission_simulator/interactors/identify_planet.rb
|
@@ -113,7 +102,6 @@ files:
|
|
113
102
|
- lib/spaceship_mission_simulator/planet.rb
|
114
103
|
- lib/spaceship_mission_simulator/simulation_result.rb
|
115
104
|
- lib/spaceship_mission_simulator/version.rb
|
116
|
-
- spaceship_mission_simulator.gemspec
|
117
105
|
homepage: https://github.com/acidwizard/spaceship_mission_simulator
|
118
106
|
licenses:
|
119
107
|
- MIT
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
spaceship_fuel_calc
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.7.0
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
spaceship_mission_simulator (0.1.0)
|
5
|
-
awesome_print (= 1.8.0)
|
6
|
-
interactor (= 3.1.2)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
ast (2.4.1)
|
12
|
-
awesome_print (1.8.0)
|
13
|
-
interactor (3.1.2)
|
14
|
-
minitest (5.14.2)
|
15
|
-
parallel (1.19.2)
|
16
|
-
parser (2.7.1.4)
|
17
|
-
ast (~> 2.4.1)
|
18
|
-
rainbow (3.0.0)
|
19
|
-
rake (12.3.3)
|
20
|
-
regexp_parser (1.7.1)
|
21
|
-
rexml (3.2.4)
|
22
|
-
rubocop (0.90.0)
|
23
|
-
parallel (~> 1.10)
|
24
|
-
parser (>= 2.7.1.1)
|
25
|
-
rainbow (>= 2.2.2, < 4.0)
|
26
|
-
regexp_parser (>= 1.7)
|
27
|
-
rexml
|
28
|
-
rubocop-ast (>= 0.3.0, < 1.0)
|
29
|
-
ruby-progressbar (~> 1.7)
|
30
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
31
|
-
rubocop-ast (0.3.0)
|
32
|
-
parser (>= 2.7.1.4)
|
33
|
-
ruby-progressbar (1.10.1)
|
34
|
-
unicode-display_width (1.7.0)
|
35
|
-
|
36
|
-
PLATFORMS
|
37
|
-
ruby
|
38
|
-
|
39
|
-
DEPENDENCIES
|
40
|
-
minitest (~> 5.0)
|
41
|
-
rake (~> 12.0)
|
42
|
-
rubocop (~> 0.8)
|
43
|
-
spaceship_mission_simulator!
|
44
|
-
|
45
|
-
BUNDLED WITH
|
46
|
-
2.1.2
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2020 acidwizard
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# SpaceshipFuelCalc
|
2
|
-
|
3
|
-
The goal of this gem is to calculate fuel to launch from one planet of the Solar System, and land to another planet of the Solar System, depending on the flight route.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'spaceship_mission_simulator'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle install
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install spaceship_mission_simulator
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
require 'spaceship_mission_simulator'
|
25
|
-
|
26
|
-
class SpaceshipCommandCenter
|
27
|
-
include SpaceshipMissionSimulator
|
28
|
-
|
29
|
-
# ...
|
30
|
-
end
|
31
|
-
|
32
|
-
scc = SpaceshipCommandCenter.new
|
33
|
-
|
34
|
-
raw_path = [[:launch, 9.807], [:land, 1.62], [:launch, 1.62], [:land, 9.807]]
|
35
|
-
scc.simulate_spaceship_mission! 28_801, raw_path
|
36
|
-
|
37
|
-
# => #<Interactor::Context result=#<struct SpaceshipMissionSimulator::SimulationResult initial_weight=28801, total_fuel_weight=51898, path=#<struct SpaceshipMissionSimulator::Path raw_data=[[:launch, 9.807], [:land, 1.62], [:launch, 1.62], [:land, 9.807]], events=[#<struct SpaceshipMissionSimulator::Event state=:launch, planet=#<struct SpaceshipMissionSimulator::Planet gravity=9.807, key=:earth, name="Earth">, reserved_fuel_weight=18910, fuel_weight=32988>, #<struct SpaceshipMissionSimulator::Event state=:land, planet=#<struct SpaceshipMissionSimulator::Planet gravity=1.62, key=:moon, name="Moon">, reserved_fuel_weight=16448, fuel_weight=2462>, #<struct SpaceshipMissionSimulator::Event state=:launch, planet=#<struct SpaceshipMissionSimulator::Planet gravity=1.62, key=:moon, name="Moon">, reserved_fuel_weight=13447, fuel_weight=3001>, #<struct SpaceshipMissionSimulator::Event state=:land, planet=#<struct SpaceshipMissionSimulator::Planet gravity=9.807, key=:earth, name="Earth">, reserved_fuel_weight=0, fuel_weight=13447>]>>>
|
38
|
-
|
39
|
-
scc.print_spaceship_mission_result 28_801, raw_path
|
40
|
-
|
41
|
-
# =>
|
42
|
-
|
43
|
-
[
|
44
|
-
[0] "path: launch Earth, land Moon, launch Moon, land Earth",
|
45
|
-
[1] "weight of equipment: 28801 kg",
|
46
|
-
[2] "weight of fuel: 51898 kg",
|
47
|
-
[3] "arguments: 28801, [[:launch, 9.807], [:land, 1.62], [:launch, 1.62], [:land, 9.807]]"
|
48
|
-
]
|
49
|
-
```
|
50
|
-
|
51
|
-
Or you can use rake task to print result:
|
52
|
-
|
53
|
-
$ rake spaceship_mission_simulator:print_result[28_801,'launch: 9.807; land: 1.62; launch: 1.62; land: 9.807']
|
54
|
-
|
55
|
-
```
|
56
|
-
# =>
|
57
|
-
|
58
|
-
[
|
59
|
-
[0] "path: launch Earth, land Moon, launch Moon, land Earth",
|
60
|
-
[1] "weight of equipment: 28801 kg",
|
61
|
-
[2] "weight of fuel: 51898 kg",
|
62
|
-
[3] "arguments: 28801, [[:launch, 9.807], [:land, 1.62], [:launch, 1.62], [:land, 9.807]]"
|
63
|
-
]
|
64
|
-
```
|
65
|
-
|
66
|
-
## Development
|
67
|
-
|
68
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
69
|
-
|
70
|
-
## Contributing
|
71
|
-
|
72
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/acidwizard/spaceship_mission_simulator.
|
73
|
-
|
74
|
-
|
75
|
-
## License
|
76
|
-
|
77
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
desc 'Run tests'
|
5
|
-
Rake::TestTask.new do |t|
|
6
|
-
t.libs << 'test'
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
8
|
-
t.warning = false
|
9
|
-
end
|
10
|
-
|
11
|
-
namespace :spaceship_mission_simulator do
|
12
|
-
require 'spaceship_mission_simulator'
|
13
|
-
|
14
|
-
include SpaceshipMissionSimulator
|
15
|
-
|
16
|
-
desc 'Print spaceship mission simulation result'
|
17
|
-
task :print_result, [:initial_weight, :raw_path] do |_t, args|
|
18
|
-
correct_raw_path = args.raw_path.split('; ').map do |ev_data|
|
19
|
-
ev_data.split(': ').tap do |ev_arr|
|
20
|
-
ev_arr[0] = ev_arr[0].to_sym
|
21
|
-
ev_arr[-1] = ev_arr[-1].to_f
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
print_spaceship_mission_result args.initial_weight.to_i, correct_raw_path
|
26
|
-
end
|
27
|
-
end
|
data/bin/setup
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative 'lib/spaceship_mission_simulator/version'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'spaceship_mission_simulator'
|
5
|
-
spec.version = SpaceshipMissionSimulator::VERSION
|
6
|
-
spec.authors = ['acidwizard']
|
7
|
-
|
8
|
-
spec.summary = 'The goal of this gem is to calculate fuel to launch from one planet of the Solar System, and land to another planet of the Solar System, depending on the flight route.'
|
9
|
-
spec.homepage = 'https://github.com/acidwizard/spaceship_mission_simulator'
|
10
|
-
spec.license = 'MIT'
|
11
|
-
|
12
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
13
|
-
spec.metadata['source_code_uri'] = 'https://github.com/acidwizard/spaceship_mission_simulator'
|
14
|
-
|
15
|
-
# Specify which files should be added to the gem when it is released.
|
16
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
19
|
-
end
|
20
|
-
|
21
|
-
spec.require_paths = ['lib']
|
22
|
-
|
23
|
-
spec.required_ruby_version = Gem::Requirement.new '>= 2.3.0'
|
24
|
-
|
25
|
-
spec.add_dependency 'awesome_print', '1.8.0'
|
26
|
-
spec.add_dependency 'interactor', '3.1.2'
|
27
|
-
|
28
|
-
spec.add_development_dependency 'minitest', '~> 5.0'
|
29
|
-
spec.add_development_dependency 'rake', '~> 12.0'
|
30
|
-
spec.add_development_dependency 'rubocop', '~> 0.8'
|
31
|
-
end
|