columbus3 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8480197278059d6cc6346ceff12dcbf7720be198
4
- data.tar.gz: 41474b1b7e3e516254abe182c21c5fee53007665
3
+ metadata.gz: 8c78ff706093b6276c11eef2ef6ab9d86e4af6ff
4
+ data.tar.gz: 4390c9537d75ed606438cae99d9c3aaa27c11eda
5
5
  SHA512:
6
- metadata.gz: 39cc383a83ce20a3ea6f6a686ef98d659a6023298e1314cba7eff049a9b6392577c7a190b83b180e23190d90aa5bbdaaa6161d66ad5ac1546314c82c0a25f42c
7
- data.tar.gz: 7c28ac6ff25291aa57d78fc6855d99807aab7bbf1b2cb04929f6da98d99c8af20d7528a821d892ae515b59ad3c2ef42a4f8070363765cb6eb01e349ab356e67e
6
+ metadata.gz: 0173ba8ca1fee18886d2761545ca835934a8fb8a8df95b8361a37cbf0737af2954de754c475c43878d3eaf10e4c82875e331402220adfa4ede1eecd839798b18
7
+ data.tar.gz: 1f2613d70f1e94c452385512601f17a8e0d17145fdc718c0ef5012a37a6a1d99c8eab2f46ea2ba338a33cf0576e2808f33e3536827df7459ce84f7b1a7185f48
data/exe/columbus3 CHANGED
@@ -47,30 +47,35 @@ EOS
47
47
  #
48
48
  # Main App Starts Here!
49
49
  #
50
+ cmd = nil
50
51
  opts = Slop.parse :help => true do
51
52
  banner usage
52
53
 
53
54
  ##############################################################################
54
55
  on "-v", "--version", 'Print version information' do
56
+ cmd ="version"
55
57
  puts "#{appname} version #{version}"
56
58
  end
57
59
 
58
60
  ##############################################################################
59
- command :help do
60
- banner "#{appname} help"
61
+ command :man do
62
+ banner "#{appname} man"
61
63
  description "Print man page for #{appname}"
62
64
 
63
65
  run do |_, _|
66
+ cmd ="man"
64
67
  puts man
65
68
  end
66
69
  end
67
70
 
68
71
  ##############################################################################
69
72
  command :process do
70
- banner "#{appname} process track [... track]"
71
- description "Generate a sidecar file for the track"
73
+ banner "#{appname} process [--help] [track ...]"
74
+ description "Generate a sidecar file for the specified tracks"
72
75
 
73
76
  run do |opts, args|
77
+ cmd ="process"
78
+
74
79
  args.each do |arg|
75
80
  track = V900Track.new arg
76
81
  sidecar = Columbus3::Sidecar.new arg
@@ -82,19 +87,19 @@ opts = Slop.parse :help => true do
82
87
 
83
88
  ##############################################################################
84
89
  command :search do
85
- banner "#{appname} search --dir directory term"
86
- description "Search dir for tracks matching criteria in dir"
90
+ banner "#{appname} search [--help] [--dir directory] query"
91
+ description "Search dir for tracks matching query"
87
92
 
88
93
  on "--debug", "Show how the query is processed"
89
94
  on "-d", "--dir=", "Directory with sidecar files"
90
95
 
91
96
  run do |opts, args|
97
+ cmd ="search"
98
+
92
99
  debug = opts.to_hash[:debug]
93
100
  directory = opts.to_hash[:dir] || "."
94
101
 
95
102
  files = Dir.glob(directory + "/" + "*.yaml")
96
- puts args
97
- puts args.join(" ")
98
103
  query = QueryParser.new.parse(args.join(" "))
99
104
 
100
105
  if debug then
@@ -115,30 +120,37 @@ opts = Slop.parse :help => true do
115
120
 
116
121
  ##############################################################################
117
122
  command :show do
118
- banner "#{appname} show [--force] track [... track]"
123
+ banner "#{appname} show [--help] [--filename filename] [--force] [track ...]"
119
124
  description "View tracks"
120
125
 
126
+ on "-f", "--filename=", "Output filename (default is _show.html)"
121
127
  on "--force", "Force rewriting of the js file, even if it already exists"
122
128
 
123
129
  run do |opts, args|
130
+ cmd ="show"
131
+
132
+ filename = opts.to_hash[:filename] || "_show.html"
124
133
  force = opts.to_hash[:force]
125
134
 
126
135
  args.each do |arg|
127
136
  Columbus3::LeafletRenderer::to_leaflet arg, force
128
137
  end
129
- Columbus3::LeafletRenderer::show args
138
+ (Columbus3::LeafletRenderer::show filename, args) if args != []
130
139
  end
131
140
  end
132
141
 
133
142
  ##############################################################################
134
143
  command :export do
135
- banner "#{appname} export track [... track]"
144
+ banner "#{appname} export [--help] [track ...]"
136
145
  description "Export track to GPX"
137
146
 
138
147
  run do |opts, args|
139
-
148
+ cmd ="export"
149
+ puts "Not implemented yet. Use GPSBabel in the meantime."
140
150
  end
141
151
  end
142
-
143
152
  end
144
153
 
154
+ if not cmd then
155
+ puts opts
156
+ end
@@ -7,7 +7,7 @@ module Columbus3
7
7
  module LeafletRenderer
8
8
  # apply the ERB in html/show.html.erb (which includes all the tracks to display)
9
9
  # and save it in the current directory, under _show.html
10
- def self.show files
10
+ def self.show filename, files
11
11
  template = File.join(File.dirname(__FILE__), "/../../html/show.html.erb")
12
12
  renderer = ERB.new(File.read(template))
13
13
 
@@ -22,7 +22,7 @@ module Columbus3
22
22
  html = renderer.result(binding)
23
23
 
24
24
  # save it to file
25
- File.open("_show.html", "w") do |file|
25
+ File.open(filename, "w") do |file|
26
26
  file << html
27
27
  end
28
28
  end
@@ -18,7 +18,8 @@ class V900Waypoint
18
18
  date = @row["DATE"]
19
19
  time = @row["TIME"]
20
20
  # make sure it is understood as ZULU time (UTC) and pad time to six numbers 75858 -> 075858
21
- Time.parse("#{date}T" + ("%06d" % time) + "Z")
21
+ # http://stackoverflow.com/questions/1543171/how-can-i-output-leading-zeros-in-ruby
22
+ Time.parse("#{date}T" + time.to_s.rjust(6, "0") + "Z")
22
23
  end
23
24
 
24
25
  def lon
@@ -1,3 +1,3 @@
1
1
  module Columbus3
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: columbus3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-19 00:00:00.000000000 Z
11
+ date: 2015-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler