primord-tools 1.0.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.
Files changed (7) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +1 -0
  3. data/README.md +4 -0
  4. data/Rakefile +23 -0
  5. data/TODO +2 -0
  6. data/bin/primord-metadata +101 -0
  7. metadata +52 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTdiZjAzZGNjOGYxNDJiNTY1OWFjNWFmOTdmMDhlNDk1NmQ5ZTQwZg==
5
+ data.tar.gz: !binary |-
6
+ OTdjYjY1YzNlZjg5YjM4ZmM1YjYzOTI0NGNkYmIyYmUyNzMzYWU2Nw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MjM4NWJmMGE3N2M1ODQ2MmExMmIwY2E1YjVjODdiYzZiN2E0NTg4Y2ZjZTA5
10
+ ZjQ2NjNhNzU0NGU1OWQ3NmM2ZTY5ZTU5YjAzZWY0OTNhZWI1ZjdiOGY0ZDY5
11
+ ODI2YTU2MzEyNjQ0NWMzMDc1NzBlMDkyMzk0NjZlMDAyMTA2NjY=
12
+ data.tar.gz: !binary |-
13
+ YzNkZjI4YWIyOTk2MTMxY2I0NzdlYTk2NzVjZGRiZjhhNzBmNjU1YWVlOTNj
14
+ MmE1MzRlYjBlOWIwYTc0MTA4OTdlN2E3NWE2OWU1ZGM2M2M5ZDA3YzBlNDNh
15
+ ZGZiOGEzOTY0YTA3NGNlYzEyZjBhYjUzYzZhZTdjZWUwODI4ZTY=
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /pkg
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ primord-tools
2
+ =============
3
+
4
+ Tools used to create metadata of primord rf data
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ # Created by GitVers - Fill the commented stuff out yourself
2
+
3
+ require 'rubygems'
4
+ require 'rubygems/package_task'
5
+
6
+ spec = Gem::Specification.new do |gem|
7
+ gem.name = File.basename(`git rev-parse --show-toplevel`).chop
8
+ gem.version = `gitver version`
9
+
10
+ gem.author = `git config --get user.name`
11
+ gem.email = `git config --get user.email`
12
+ gem.homepage = "https://github.com/floomby/gitver"
13
+ gem.summary = "Creates metadata for primord rf data"
14
+ gem.description = "Process the logs from gnuradio and generates metadata"
15
+
16
+ gem.files = `git ls-files`.split($\)
17
+
18
+ gem.executables = ["primord-metadata"]
19
+ end
20
+
21
+ Gem::PackageTask.new(spec) do |pkg|
22
+ pkg.gem_spec = spec
23
+ end
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ 1) a good README
2
+ 2) a better help message
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # TODO write to output file
4
+ # TODO tabs vs space consistency
5
+ # TODO other useful things
6
+
7
+ module Utils
8
+ def self.print_usage
9
+ puts "./metadaer.rb <pyerr|pylog|bgdist> <param,param,...> <files>"
10
+ end
11
+ def self.count_lines file
12
+ lines = 0
13
+ file.each_line { |l| lines += 1 }
14
+ file.rewind
15
+ lines
16
+ end
17
+ def self.extract_date str
18
+ a = str.match /.*([0-9]{4})([0-9]{2})([0-9]{2})/
19
+ "#{a[2]}-#{a[3]}-#{a[1]}"
20
+ end
21
+ end # class Stuff
22
+
23
+ # classes for each type of file we want to
24
+ # work with
25
+ class DataFile
26
+ @@params
27
+ def initialize filename
28
+ @data = {}
29
+ @data['file'] = filename
30
+ @file = File.open filename, 'r'
31
+
32
+ def self.write
33
+ str = ""
34
+ @@params.each do |param|
35
+ str += "#{@data[param]},"
36
+ end
37
+ puts str[0..-2]
38
+ end
39
+ end
40
+ def self.format= params
41
+ @@params = params
42
+ str = ""
43
+ @@params.each do |param|
44
+ str += "#{param},"
45
+ end
46
+ puts str[0..-2]
47
+ end
48
+ end
49
+
50
+ class Pyerr < DataFile
51
+ def initialize filename
52
+ super
53
+ # count the lines
54
+ @data['lines'] = Utils::count_lines @file
55
+ # get the date
56
+ @data['date'] = Utils::extract_date filename
57
+ end
58
+ end # class DataFile
59
+
60
+ class Pylog < DataFile
61
+ def initialize filename
62
+ super
63
+ # count the lines
64
+ @data['lines'] = Utils::count_lines @file
65
+ # get the date
66
+ @data['date'] = Utils::extract_date filename
67
+ end
68
+ end # class Pylog
69
+
70
+ class Bgdist < DataFile
71
+ def initialize filename
72
+ super
73
+ # count the lines
74
+ @data['lines'] = Utils::count_lines @file
75
+ # get the date
76
+ @data['date'] = Utils::extract_date filename
77
+ end
78
+ end # class BGdist
79
+
80
+ # main
81
+
82
+ directive = ARGV.shift
83
+ case directive
84
+ when 'help'
85
+ Utils::print_usage
86
+ exit 0
87
+ else
88
+ params = []
89
+ ARGV.shift.gsub(/([^,]+)/){ |p| params << p }
90
+ DataFile::format = params
91
+ clas = Object.const_get directive.capitalize
92
+ end
93
+
94
+ objs = []
95
+ ARGV.each do |filename|
96
+ objs << (clas.new filename)
97
+ end
98
+
99
+ objs.each do |obj|
100
+ obj.write
101
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: primord-tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ! 'floomby
8
+
9
+ '
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2014-06-18 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: Process the logs from gnuradio and generates metadata
16
+ email: ! 'floomby@nmt.edu
17
+
18
+ '
19
+ executables:
20
+ - primord-metadata
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - .gitignore
25
+ - README.md
26
+ - Rakefile
27
+ - TODO
28
+ - bin/primord-metadata
29
+ homepage: https://github.com/floomby/gitver
30
+ licenses: []
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 2.2.2
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Creates metadata for primord rf data
52
+ test_files: []