astromapper 1.0.2 → 1.0.3

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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c5aaf4e1532ef249019d08e361488ec3d571e24a
4
+ data.tar.gz: b382186975e1121b42cb16c926504036d2eb8937
5
+ SHA512:
6
+ metadata.gz: 9259495ed1978ae2edc7edcbdc4abb8b4f633db1cf36613e576ac0290c16bbd7bd23e2fe0f01392605992e0a3dfd5b50be9d79fc049451879e59d26d0c640a3a
7
+ data.tar.gz: 70985d9ba80b12267800f65b53348e69f046ac7078d1c53b908c61fa5f29b3a06852517d5e176d840f2080b80e5d274ffae1c15866666e69f324553cb99eb501
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  Puzzle
19
+ .DS_Store
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Traveller Astromapper
2
2
  ==========================
3
3
 
4
- The **Traveller Astromapper** creates random Traveller star maps intended for YOTS.
4
+ The **Traveller Astromapper** creates random Traveller star maps intended for YOTU (Your Own Traveller Universe).
5
5
 
6
6
  The maps are generated using an inspired amalgam of [Mongoose](http://www.mongoosepublishing.com/rpgs/traveller/core-rulebooks-accessories.html) and [Classic Traveller](http://www.farfuture.net/) rules, with some [Gurps Space](http://www.sjgames.com/gurps/books/space/) 4e and 3e.
7
7
 
@@ -26,13 +26,13 @@ How to Use Traveller Astromapper
26
26
  To create a new Traveller Astromapper project, execute the following on the command line:
27
27
 
28
28
  ```
29
- astromapper new yots_sector
29
+ astromapper new yotu_sector
30
30
  ```
31
31
 
32
32
  The command creates the following directory structure:
33
33
 
34
34
  ```
35
- yots_sector
35
+ yotu_sector
36
36
  ├── _astromapper.yml
37
37
  ├── output
38
38
  └── templates
@@ -12,16 +12,19 @@ module Astromapper
12
12
  require 'astromapper/extensions/integer'
13
13
  require 'astromapper/extensions/string'
14
14
 
15
+
16
+ autoload :Version, "astromapper/version"
17
+ autoload :About, "astromapper/about"
18
+ autoload :Astro, "astromapper/astro"
15
19
  autoload :Builder, "astromapper/builder"
16
- autoload :Cli, "astromapper/cli"
20
+ autoload :Cli, "astromapper/cli"
17
21
  # autoload :Dependency, "astromapper/dependency"
18
- autoload :Exporter, "astromapper/exporter"
19
- autoload :Generator, "astromapper/generator"
22
+ autoload :Exporter, "astromapper/exporter"
23
+ autoload :Generator, "astromapper/generator"
20
24
  # autoload :Stats, "astromapper/stats"
21
25
  # autoload :Stream, "astromapper/stream"
22
26
  # autoload :TOC, "astromapper/toc"
23
- autoload :Svg, "astromapper/svg"
24
- autoload :Version, "astromapper/version"
27
+ autoload :Svg, "astromapper/svg"
25
28
 
26
29
  Encoding.default_internal = "utf-8"
27
30
  Encoding.default_external = "utf-8"
@@ -33,7 +36,7 @@ module Astromapper
33
36
  content = File.read(path)
34
37
  erb = ERB.new(content).result
35
38
 
36
- YAML.load(erb)#.with_indifferent_access
39
+ YAML.load(erb).to_hash.with_indifferent_access
37
40
  end
38
41
  def self.output_file(ext="txt")
39
42
  "output/#{config['name'].to_permalink}.#{ext}"
@@ -46,7 +49,7 @@ module Astromapper
46
49
  content = File.read(path)
47
50
  erb = ERB.new(content).result
48
51
 
49
- @names = YAML.load(erb)#.with_indifferent_access
52
+ @names = YAML.load(erb).to_hash.with_indifferent_access
50
53
  end
51
54
  def self.logger
52
55
  @logger ||= Logger.new(File.open("/tmp/astromapper.log", "a"))
@@ -0,0 +1,24 @@
1
+ module Astromapper
2
+ class About
3
+ # def initialize(filename, volume_id=nil)
4
+ # @volumes = {}
5
+ # @volume_id = volume_id.to_s
6
+ # volume = []
7
+ # id = ""
8
+
9
+ # return @volumes[volume_id] unless volume_id.nil?
10
+ # end
11
+ # def volume(id=nil)
12
+ # id = @volume_id if id.nil?
13
+ # @volumes[id]
14
+ # end
15
+ # def ascii
16
+ # puts "```\n#{volume.join("")}```"
17
+ # end
18
+ # def world
19
+ # # summary = volume
20
+ # volume.each do |b|
21
+ # end
22
+ # end
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ module Astromapper
2
+ module Astro
3
+ autoload :Orbit, "astromapper/astro/orbit"
4
+ autoload :Star, "astromapper/astro/star"
5
+ autoload :Terrestrial, "astromapper/astro/terrestrial"
6
+ autoload :Volume, "astromapper/astro/volume"
7
+ autoload :World, "astromapper/astro/world"
8
+ autoload :Gas, "astromapper/astro/gas"
9
+ class Base
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ module Astromapper
2
+ module Astro
3
+ class GasGiant < Astromapper::Astro::Orbit
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Astromapper
2
+ module Astro
3
+ class Orbit < Astromapper::Astro::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module Astromapper
2
+ module Astro
3
+ class Star
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module Astromapper
2
+ module Astro
3
+ class Terrestrial < Astromapper::Astro::Orbit
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ module Astromapper
2
+ module Astro
3
+ class Volume
4
+ attr_accessor :ascii, :summary
5
+ def initialize(ascii)
6
+ @ascii = ascii.join("")
7
+ @summary = ascii[0]
8
+ bits = @summary.split("\t")
9
+ raise bits.inspect
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ module Astromapper
2
+ module Astro
3
+ class World < Astromapper::Astro::Terrestrial
4
+ end
5
+ end
6
+ end
@@ -2,9 +2,9 @@ require 'open3'
2
2
 
3
3
  module Astromapper
4
4
  module Builder
5
- autoload :Orbit, "astromapper/builder/orbit"
5
+ autoload :Orbit, "astromapper/builder/orbit"
6
6
  autoload :Sector, "astromapper/builder/sector"
7
- autoload :Star, "astromapper/builder/star"
7
+ autoload :Star, "astromapper/builder/star"
8
8
  autoload :Volume, "astromapper/builder/volume"
9
9
 
10
10
  class Base
@@ -40,4 +40,4 @@ module Astromapper
40
40
  end
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -25,6 +25,34 @@ module Astromapper
25
25
  generator.invoke_all
26
26
  end
27
27
 
28
+ desc "about", "Provide information on a sector"
29
+ map %w{-a} => :about
30
+ def about(volume_id)
31
+ say "Searching database on #{volume_id}"
32
+ source = Astromapper.output_file('sector')
33
+ if File.exists?(source)
34
+ # volume = Astromapper::Astro::Volume.new(source, volume_id)
35
+ # puts volume.inspect
36
+ @volumes = {}
37
+ volume = []
38
+ id = nil
39
+ File.open(source,'r').readlines.each do |line|
40
+ if /^\d{4}/.match(line)
41
+ @volumes[id.to_s] = volume unless volume.nil? or id.nil?
42
+ volume = []
43
+ id = line[0..3]
44
+ end
45
+ volume << line #unless volume.nil?
46
+ end
47
+ @volume = Astromapper::Astro::Volume.new(@volumes[volume_id])
48
+
49
+ puts @volume.summary
50
+ say @volume.ascii
51
+ else
52
+ say "Hey! You need to generate the sector first (try: astromapper build)."
53
+ end
54
+ end
55
+
28
56
  desc "build", "Generate a map of {sector / domain}"
29
57
  map %w{-b --build generate} => :build
30
58
  def build(type='sector')
@@ -18,7 +18,7 @@ module Astromapper
18
18
  @volumes = []
19
19
  @name = config['name']
20
20
  # puts "Height: #{@height}; Width: #{@width}"
21
-
21
+
22
22
  base03 = config['colors']['base03'] || '#002b36'
23
23
  base02 = config['colors']['base02'] || '#073642'
24
24
  base01 = config['colors']['base01'] || '#586e75'
@@ -37,7 +37,7 @@ module Astromapper
37
37
  green = config['colors']['green'] || '#859900'
38
38
  white = config['colors']['white'] || '#FFFFFF'
39
39
  black = config['colors']['black'] || '#222222'
40
-
40
+
41
41
  @theme = {
42
42
  'dark' => {
43
43
  :background => base03,
@@ -115,7 +115,7 @@ module Astromapper
115
115
  def header
116
116
  return<<-EOS
117
117
  <?xml version="1.0" standalone="no"?>
118
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
118
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
119
119
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
120
120
  <svg width="#{@width}px" height="#{@height}px" version="1.1" xmlns="http://www.w3.org/2000/svg" blackground-color='#{@color[:white]}'>
121
121
  <desc>Subsector Map Grid</desc>
@@ -125,7 +125,7 @@ module Astromapper
125
125
  def center_of(locx)
126
126
  column = locx[0..1].to_i
127
127
  row = locx[2..3].to_i
128
- x = @side + ((column - 1) * @side * 1.5)
128
+ x = @side + ((column - 1) * @side * 1.5) # 40 + ((COL - 1) * 60 )
129
129
  y = (row - 1) * @side * @factor + (@side * @factor / (1 + (column % 2)))
130
130
  return [x.tweak,y.tweak]
131
131
  end
@@ -151,22 +151,22 @@ module Astromapper
151
151
  # TAB 2 - Factions
152
152
  # TAB 3 - Name
153
153
  #1101 A505223-B ..G.. »·IC,Lo,Va »N,O,N »·G0V »Omivarium
154
- details, trades, factions, star, name = volume.split(/\t/)
155
-
154
+ details, trades, factions, star, name = volume.split(/\t/)
155
+
156
156
  locx, uwp, temp, nsg, zone = details.split(/\s+/)
157
157
 
158
158
  spaceport = uwp[0]
159
159
  size = uwp[1]
160
160
  c = center_of(locx) # get Location's x,y Coordinates
161
161
  curve = @side / 2
162
-
162
+
163
163
  output = "<!-- Volume: #{volume.strip.gsub(/\t/,' // ')} -->\n"
164
164
  output += (size == '0') ? draw_belt(c) : draw_planet(c,uwp)
165
- output += " <text #{@style[:Spaceport]} x='#{c[0]}' y='#{(c[1] + @side / 2).tweak}'>#{spaceport.strip}</text>\n"
165
+ output += " <text #{@style[:Spaceport]} x='#{c[0]}' y='#{(c[1] + @side / 2).tweak}'>#{spaceport.strip}</text>\n"
166
166
  output += " <text #{@style[:UWP]} x='#{c[0]}' y='#{(c[1]+(@side/1.3)).tweak}'>#{uwp.strip}</text>\n"
167
167
  output += " <text #{@style[:Name]} x='#{c[0]}' y='#{(c[1]-(@side/2.1)).tweak}'>#{name.strip}</text>\n"
168
168
  unless zone == '..'
169
- style = zone + '_zone'
169
+ style = zone + '_zone'
170
170
  output += " <path #{@style[style.to_sym]} d='M #{c[0] - curve/2;} #{c[1] - (curve/1.4)} a #{curve} #{curve} 0 1 0 20 0' />\n"
171
171
  end
172
172
  output += navy_base(c) if nsg.include?('N')
@@ -177,7 +177,7 @@ module Astromapper
177
177
  # output += " <text #{@style[:Name]} x='#{(c[0]+(@side/1.8)).tweak}' y='#{(c[1]-(@side/3)).tweak}'>#{star[0..1].strip}</text>\n"
178
178
  output += stars(c,star)
179
179
  output
180
-
180
+
181
181
  end
182
182
  def stars(c,stars)
183
183
  output = ''
@@ -196,7 +196,7 @@ module Astromapper
196
196
  end
197
197
  def draw_belt(c)
198
198
  output = " <g stroke='none' fill='none'>\n"
199
- 7.times do
199
+ 7.times do
200
200
  x = c[0] + Random.rand(@side/3) - @side/6
201
201
  y = c[1] + Random.rand(@side/3) - @side/6
202
202
  output += " <circle #{@style[:Belt]} cx='#{x.tweak}' cy='#{y.tweak}' r='#{(@side/15).tweak}' />\n"
@@ -209,10 +209,10 @@ module Astromapper
209
209
  " <polyline #{@style[style]} points='#{z},#{z} #{w},#{z} #{w},#{h} #{z},#{h} #{z},#{z}' />"
210
210
  end
211
211
  def tract_marks
212
- height = (@height / 4).floor
212
+ height = (@height / 4).floor
213
213
  width = (@width / 4).ceil
214
214
  # width -= 2
215
-
215
+
216
216
  output = ''
217
217
  letters = ('A'..'P').to_a
218
218
  5.times do |r|
@@ -262,11 +262,11 @@ module Astromapper
262
262
  return "<!-- Scout Base --><text #{@style[:symbol]} x='#{c[0]-(@side/1.8)}' y='#{c[1]+(@side/2.4)}'>\u269C</text>\n"
263
263
  '<!-- SB -->' + polygon(c[0]-(@side/1.8),c[1]+(@side/3.7), @side/(@mark/2), @side/@mark, 3);
264
264
  end
265
- def navy_base(c);
265
+ def navy_base(c);
266
266
  return "<!-- Navy Base --><text #{@style[:symbol]} x='#{c[0]-(@side/1.8)}' y='#{c[1]-(@side/6)}'>\u2693</text>\n"
267
- '<!-- NB -->' +polygon(c[0]-(@side/1.8), c[1]-(@side/3.7), @side/(@mark/2), @side/@mark, 5);
267
+ '<!-- NB -->' +polygon(c[0]-(@side/1.8), c[1]-(@side/3.7), @side/(@mark/2), @side/@mark, 5);
268
268
  end
269
- def hex_grid; (@rows * 3 + 2).times.map { |j| hex_row((j/2).floor, (j % 2 != 0)) };
269
+ def hex_grid; (@rows * 3 + 2).times.map { |j| hex_row((j/2).floor, (j % 2 != 0)) };
270
270
  end
271
271
  def namestamp
272
272
  return "<text text-anchor='left' font-size='30px' fill='#8A9DD1' font-family='Verdana' x='30' y='2800'>#{@name}</text>"
@@ -279,18 +279,18 @@ module Astromapper
279
279
  x = j * @side * 3
280
280
  y = ly
281
281
  points << "#{x.tweak},#{y.tweak}"
282
-
282
+
283
283
  x += @hex[:side_w]
284
284
  y = (top) ? y - @hex[:side_h] : y + @hex[:side_h]
285
285
  points << "#{x.tweak},#{y.tweak}"
286
-
286
+
287
287
  x += @hex[:width]
288
288
  points << "#{x.tweak},#{y.tweak}"
289
-
289
+
290
290
  x += @hex[:side_w]
291
291
  y = (top) ? y + @hex[:side_h] : y - @hex[:side_h]
292
292
  points << "#{x.tweak},#{y.tweak}"
293
-
293
+
294
294
  x += @hex[:width]
295
295
  points << "#{x.tweak},#{y.tweak}"
296
296
  end
@@ -1,3 +1,3 @@
1
1
  module Astromapper
2
- VERSION = "1.0.2"
3
- end
2
+ VERSION = "1.0.3"
3
+ end
metadata CHANGED
@@ -1,126 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astromapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
5
- prerelease:
4
+ version: 1.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Merovex
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-07 00:00:00.000000000 Z
11
+ date: 2019-11-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '2.6'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '2.6'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: cucumber
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: aruba
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: activesupport
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: thor
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  description: Astromapper generates Traveller RPG Star Charts (from Sector to Domain).
@@ -131,7 +116,7 @@ executables:
131
116
  extensions: []
132
117
  extra_rdoc_files: []
133
118
  files:
134
- - .gitignore
119
+ - ".gitignore"
135
120
  - Gemfile
136
121
  - LICENSE.txt
137
122
  - README.md
@@ -139,6 +124,14 @@ files:
139
124
  - astromapper.gemspec
140
125
  - bin/astromapper
141
126
  - lib/astromapper.rb
127
+ - lib/astromapper/about.rb
128
+ - lib/astromapper/astro.rb
129
+ - lib/astromapper/astro/gas.rb
130
+ - lib/astromapper/astro/orbit.rb
131
+ - lib/astromapper/astro/star.rb
132
+ - lib/astromapper/astro/terrestrial.rb
133
+ - lib/astromapper/astro/volume.rb
134
+ - lib/astromapper/astro/world.rb
142
135
  - lib/astromapper/builder.rb
143
136
  - lib/astromapper/builder/orbit.rb
144
137
  - lib/astromapper/builder/sector.rb
@@ -158,26 +151,25 @@ files:
158
151
  homepage: ''
159
152
  licenses:
160
153
  - MIT
154
+ metadata: {}
161
155
  post_install_message:
162
156
  rdoc_options: []
163
157
  require_paths:
164
158
  - lib
165
159
  required_ruby_version: !ruby/object:Gem::Requirement
166
- none: false
167
160
  requirements:
168
- - - ! '>='
161
+ - - ">="
169
162
  - !ruby/object:Gem::Version
170
163
  version: '0'
171
164
  required_rubygems_version: !ruby/object:Gem::Requirement
172
- none: false
173
165
  requirements:
174
- - - ! '>='
166
+ - - ">="
175
167
  - !ruby/object:Gem::Version
176
168
  version: '0'
177
169
  requirements: []
178
170
  rubyforge_project:
179
- rubygems_version: 1.8.25
171
+ rubygems_version: 2.6.14
180
172
  signing_key:
181
- specification_version: 3
173
+ specification_version: 4
182
174
  summary: Generating Traveller RPG Star Charts for YOTS
183
175
  test_files: []