rtlsdr 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.yardconfig +42 -0
- data/.yardopts +17 -0
- data/CHANGELOG.md +14 -0
- data/Rakefile +226 -1
- data/doc_config.rb +25 -0
- data/lib/rtlsdr/device.rb +207 -2
- data/lib/rtlsdr/dsp.rb +87 -6
- data/lib/rtlsdr/errors.rb +60 -0
- data/lib/rtlsdr/ffi.rb +38 -3
- data/lib/rtlsdr/scanner.rb +114 -6
- data/lib/rtlsdr/version.rb +12 -1
- data/lib/rtlsdr.rb +53 -2
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de238a7cd49e550a69286832b36841c553650c097a31fd791337c48c8b1f9cc3
|
4
|
+
data.tar.gz: 5466c2e13efb99c9c39ea4a448aed2f4e9a827e10149116fc02f45ab39f9536c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a48c2e10ced3a1ef70e3981e2673c1a5a8b9ad0a3254a9ca23128b75ec32ce448282b606ca02e1ce09432a08302aba9e8c6ab68fb82ef25661599c486696d75
|
7
|
+
data.tar.gz: dc4006cfbdb52e5043d38e0b9815a7feb4b32aee7c34940bae1690e0551dc940f265050ea69f9a641d6b143046349a32d6c21ee42509a46f4b8bcb14b94e77ed
|
data/.yardconfig
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Lint/UselessAssignment
|
4
|
+
|
5
|
+
# YARD Configuration file
|
6
|
+
# This file contains advanced configuration for YARD documentation generation
|
7
|
+
|
8
|
+
# Custom tags for RTL-SDR specific documentation
|
9
|
+
define_tag :frequency, :text, "Frequency Range"
|
10
|
+
define_tag :sample_rate, :text, "Sample Rate"
|
11
|
+
define_tag :gain, :text, "Gain Range"
|
12
|
+
define_tag :tuner, :text, "Tuner Support"
|
13
|
+
define_tag :thread_safety, :text, "Thread Safety"
|
14
|
+
|
15
|
+
# Plugin settings
|
16
|
+
plugins = []
|
17
|
+
|
18
|
+
# Custom CSS and templates
|
19
|
+
template_paths = ["templates"]
|
20
|
+
|
21
|
+
# Markup settings
|
22
|
+
markup = "markdown"
|
23
|
+
markup_provider = "redcarpet"
|
24
|
+
|
25
|
+
# Output settings
|
26
|
+
output_dir = "doc"
|
27
|
+
list_undoc = true
|
28
|
+
protected = true
|
29
|
+
private = false
|
30
|
+
|
31
|
+
# Source exclusions
|
32
|
+
exclude = [
|
33
|
+
"spec/**/*",
|
34
|
+
"examples/**/*",
|
35
|
+
"bin/**/*",
|
36
|
+
"exe/**/*",
|
37
|
+
"vendor/**/*",
|
38
|
+
"tmp/**/*",
|
39
|
+
".git/**/*"
|
40
|
+
]
|
41
|
+
|
42
|
+
# rubocop:enable Lint/UselessAssignment
|
data/.yardopts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
--markup markdown
|
2
|
+
--markup-provider redcarpet
|
3
|
+
--title "RTL-SDR Ruby Gem Documentation"
|
4
|
+
--readme README.md
|
5
|
+
--files CHANGELOG.md,LICENSE.txt
|
6
|
+
--output-dir doc
|
7
|
+
--protected
|
8
|
+
--no-private
|
9
|
+
--embed-mixins
|
10
|
+
--verbose
|
11
|
+
--exclude spec/
|
12
|
+
--exclude examples/
|
13
|
+
--exclude bin/
|
14
|
+
--exclude exe/
|
15
|
+
--exclude vendor/
|
16
|
+
--exclude tmp/
|
17
|
+
--exclude .git/
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -4,6 +4,8 @@ require "bundler/gem_tasks"
|
|
4
4
|
require "rspec/core/rake_task"
|
5
5
|
require "rake/extensiontask"
|
6
6
|
require "rubocop/rake_task"
|
7
|
+
require "rdoc/task"
|
8
|
+
require "yard"
|
7
9
|
|
8
10
|
RSpec::Core::RakeTask.new(:spec)
|
9
11
|
|
@@ -13,7 +15,142 @@ Rake::ExtensionTask.new("rtlsdr") do |ext|
|
|
13
15
|
ext.lib_dir = "lib/rtlsdr"
|
14
16
|
end
|
15
17
|
|
16
|
-
|
18
|
+
# RDoc documentation generation
|
19
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
20
|
+
rdoc.rdoc_dir = "doc"
|
21
|
+
rdoc.title = "RTL-SDR Ruby Gem Documentation"
|
22
|
+
rdoc.main = "README.md"
|
23
|
+
rdoc.rdoc_files.include("README.md", "CHANGELOG.md", "LICENSE.txt", "lib/**/*.rb")
|
24
|
+
|
25
|
+
# RDoc options for better output
|
26
|
+
rdoc.options << "--line-numbers"
|
27
|
+
rdoc.options << "--all"
|
28
|
+
rdoc.options << "--charset=UTF-8"
|
29
|
+
rdoc.options << "--exclude=spec/"
|
30
|
+
rdoc.options << "--exclude=examples/"
|
31
|
+
rdoc.options << "--exclude=bin/"
|
32
|
+
rdoc.options << "--exclude=exe/"
|
33
|
+
rdoc.options << "--template=hanna" if system("gem list hanna -i > /dev/null 2>&1")
|
34
|
+
end
|
35
|
+
|
36
|
+
# Clean documentation
|
37
|
+
desc "Remove generated documentation"
|
38
|
+
task :clean_doc do
|
39
|
+
rm_rf "doc"
|
40
|
+
end
|
41
|
+
|
42
|
+
YARD::Rake::YardocTask.new(:yard) do |yard|
|
43
|
+
yard.files = ["lib/**/*.rb", "-", "README.md", "CHANGELOG.md", "LICENSE.txt"]
|
44
|
+
yard.options = [
|
45
|
+
"--output-dir", "doc",
|
46
|
+
"--readme", "README.md",
|
47
|
+
"--title", "RTL-SDR Ruby Gem Documentation",
|
48
|
+
"--markup", "markdown",
|
49
|
+
"--markup-provider", "redcarpet",
|
50
|
+
"--protected",
|
51
|
+
"--no-private",
|
52
|
+
"--embed-mixins"
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# YARD server for live documentation browsing
|
57
|
+
desc "Start YARD documentation server"
|
58
|
+
task :yard_server do
|
59
|
+
system("yard server --reload")
|
60
|
+
end
|
61
|
+
|
62
|
+
# YARD statistics
|
63
|
+
desc "Show YARD documentation statistics"
|
64
|
+
task :yard_stats do
|
65
|
+
system("yard stats")
|
66
|
+
end
|
67
|
+
|
68
|
+
# Generate YARD documentation with coverage report
|
69
|
+
desc "Generate YARD docs with coverage report"
|
70
|
+
task :yard_coverage do
|
71
|
+
puts "Generating YARD documentation with coverage report..."
|
72
|
+
system("yard doc")
|
73
|
+
|
74
|
+
# Parse YARD output for coverage
|
75
|
+
if system("yard stats > /tmp/yard_stats.txt 2>&1")
|
76
|
+
stats = File.read("/tmp/yard_stats.txt")
|
77
|
+
if stats =~ /(\d+\.\d+)% documented/
|
78
|
+
coverage = Regexp.last_match(1).to_f
|
79
|
+
puts "\nYARD Documentation coverage: #{coverage}%"
|
80
|
+
|
81
|
+
if coverage < 90.0
|
82
|
+
puts "WARNING: YARD documentation coverage is below 90%"
|
83
|
+
exit 1 if ENV["REQUIRE_DOC_COVERAGE"]
|
84
|
+
else
|
85
|
+
puts "✓ YARD documentation coverage is good!"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Comprehensive documentation check
|
92
|
+
desc "Check documentation coverage and quality"
|
93
|
+
task :doc_check do
|
94
|
+
puts "Running RDoc to check documentation coverage..."
|
95
|
+
system("rdoc --verbose lib/ > /tmp/rdoc_output.txt 2>&1")
|
96
|
+
|
97
|
+
# Parse output for coverage info
|
98
|
+
if File.exist?("/tmp/rdoc_output.txt")
|
99
|
+
output = File.read("/tmp/rdoc_output.txt")
|
100
|
+
if output =~ /(\d+\.\d+)% documented/
|
101
|
+
coverage = Regexp.last_match(1).to_f
|
102
|
+
puts "Documentation coverage: #{coverage}%"
|
103
|
+
|
104
|
+
if coverage < 90.0
|
105
|
+
puts "WARNING: Documentation coverage is below 90%"
|
106
|
+
exit 1 if ENV["REQUIRE_DOC_COVERAGE"]
|
107
|
+
else
|
108
|
+
puts "✓ Documentation coverage is good!"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Check for undocumented items
|
113
|
+
if output.include?("undocumented")
|
114
|
+
puts "\nUndocumented items found:"
|
115
|
+
output.scan(/(\S+) \(undocumented\)/).each { |match| puts " - #{match[0]}" }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Documentation tasks
|
121
|
+
desc "Generate all documentation (RDoc and YARD)"
|
122
|
+
task docs: %i[rdoc yard]
|
123
|
+
|
124
|
+
desc "Check all documentation coverage"
|
125
|
+
task doc_coverage: %i[doc_check yard_coverage]
|
126
|
+
|
127
|
+
desc "Clean all generated documentation"
|
128
|
+
task clean_docs: [:clean_doc] do
|
129
|
+
rm_rf "doc"
|
130
|
+
rm_rf ".yardoc"
|
131
|
+
end
|
132
|
+
|
133
|
+
desc "Serve documentation locally"
|
134
|
+
task :serve_docs do
|
135
|
+
puts "Choose documentation format:"
|
136
|
+
puts "1. RDoc (file://#{Dir.pwd}/doc/index.html)"
|
137
|
+
puts "2. YARD server (http://localhost:8808)"
|
138
|
+
print "Enter choice (1-2): "
|
139
|
+
|
140
|
+
choice = $stdin.gets.chomp
|
141
|
+
case choice
|
142
|
+
when "1"
|
143
|
+
Rake::Task[:rdoc].invoke unless File.exist?("doc/index.html")
|
144
|
+
system("open doc/index.html") if RUBY_PLATFORM =~ /darwin/
|
145
|
+
puts "RDoc documentation: file://#{Dir.pwd}/doc/index.html"
|
146
|
+
when "2"
|
147
|
+
Rake::Task[:yard_server].invoke
|
148
|
+
else
|
149
|
+
puts "Invalid choice"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
task default: %i[spec rubocop doc_check]
|
17
154
|
|
18
155
|
# Custom task to build librtlsdr if needed
|
19
156
|
desc "Build librtlsdr from source (clones, configures, and compiles)"
|
@@ -31,3 +168,91 @@ end
|
|
31
168
|
|
32
169
|
desc "Compile native extensions (depends on librtlsdr)"
|
33
170
|
task compile: :build_librtlsdr
|
171
|
+
|
172
|
+
# Version management tasks
|
173
|
+
namespace :version do
|
174
|
+
desc "Bump patch version (x.y.z -> x.y.z+1)"
|
175
|
+
task :patch do
|
176
|
+
bump_version(:patch)
|
177
|
+
end
|
178
|
+
|
179
|
+
desc "Bump minor version (x.y.z -> x.y+1.0)"
|
180
|
+
task :minor do
|
181
|
+
bump_version(:minor)
|
182
|
+
end
|
183
|
+
|
184
|
+
desc "Bump major version (x.y.z -> x+1.0.0)"
|
185
|
+
task :major do
|
186
|
+
bump_version(:major)
|
187
|
+
end
|
188
|
+
|
189
|
+
desc "Show current version"
|
190
|
+
task :show do
|
191
|
+
require_relative "lib/rtlsdr/version"
|
192
|
+
puts "Current version: #{RTLSDR::VERSION}"
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
desc "Bump patch version (shortcut for version:patch)"
|
197
|
+
task :bump do
|
198
|
+
Rake::Task["version:patch"].invoke
|
199
|
+
end
|
200
|
+
|
201
|
+
def bump_version(type) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
202
|
+
version_file = "lib/rtlsdr/version.rb"
|
203
|
+
content = File.read(version_file)
|
204
|
+
|
205
|
+
# Extract current version
|
206
|
+
current_version = content.match(/VERSION = "([^"]+)"/)[1]
|
207
|
+
major, minor, patch = current_version.split(".").map(&:to_i)
|
208
|
+
|
209
|
+
# Calculate new version based on type
|
210
|
+
case type
|
211
|
+
when :patch
|
212
|
+
patch += 1
|
213
|
+
when :minor
|
214
|
+
minor += 1
|
215
|
+
patch = 0
|
216
|
+
when :major
|
217
|
+
major += 1
|
218
|
+
minor = 0
|
219
|
+
patch = 0
|
220
|
+
end
|
221
|
+
|
222
|
+
new_version = "#{major}.#{minor}.#{patch}"
|
223
|
+
|
224
|
+
# Update version file
|
225
|
+
new_content = content.gsub(/VERSION = "#{Regexp.escape(current_version)}"/, %(VERSION = "#{new_version}"))
|
226
|
+
File.write(version_file, new_content)
|
227
|
+
|
228
|
+
puts "Version bumped from #{current_version} to #{new_version}"
|
229
|
+
|
230
|
+
# Update CHANGELOG if it exists
|
231
|
+
if File.exist?("CHANGELOG.md")
|
232
|
+
changelog = File.read("CHANGELOG.md")
|
233
|
+
date = Time.now.strftime("%Y-%m-%d")
|
234
|
+
|
235
|
+
# Add new version entry at the top after the header
|
236
|
+
new_entry = "\n## [#{new_version}] - #{date}\n\n### Added\n\n### Changed\n\n### Fixed\n\n"
|
237
|
+
|
238
|
+
updated_changelog = if changelog.include?("## [Unreleased]")
|
239
|
+
# Insert after Unreleased section
|
240
|
+
changelog.sub(/(## \[Unreleased\].*?\n)/, "\\1#{new_entry}")
|
241
|
+
elsif changelog.include?("# Changelog")
|
242
|
+
# Insert after main header
|
243
|
+
changelog.sub(/(# Changelog\s*\n)/, "\\1#{new_entry}")
|
244
|
+
else
|
245
|
+
# Prepend to file if no standard structure
|
246
|
+
"# Changelog#{new_entry}#{changelog}"
|
247
|
+
end
|
248
|
+
|
249
|
+
File.write("CHANGELOG.md", updated_changelog)
|
250
|
+
puts "Updated CHANGELOG.md with new version entry"
|
251
|
+
end
|
252
|
+
|
253
|
+
puts "Don't forget to:"
|
254
|
+
puts "1. Update CHANGELOG.md with your changes"
|
255
|
+
puts "2. Commit your changes: git add -A && git commit -m 'Bump version to #{new_version}'"
|
256
|
+
puts "3. Create a git tag: git tag v#{new_version}"
|
257
|
+
puts "4. Push changes: git push && git push --tags"
|
258
|
+
end
|
data/doc_config.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Documentation configuration for RTL-SDR Ruby gem
|
4
|
+
# This file contains documentation configuration notes
|
5
|
+
|
6
|
+
# RDoc Configuration
|
7
|
+
# The RDoc configuration is handled in the Rakefile RDoc::Task.
|
8
|
+
# Key settings:
|
9
|
+
# - Title: "RTL-SDR Ruby Gem Documentation"
|
10
|
+
# - Main page: README.md
|
11
|
+
# - Output directory: doc/
|
12
|
+
# - Includes: README.md, CHANGELOG.md, LICENSE.txt, lib/**/*.rb
|
13
|
+
# - Excludes: spec/, examples/, bin/, exe/
|
14
|
+
|
15
|
+
# YARD Configuration
|
16
|
+
# YARD configuration is handled via:
|
17
|
+
# - .yardopts file for command line options
|
18
|
+
# - .yardconfig file for advanced settings
|
19
|
+
# - Rakefile YARD::Rake::YardocTask for task configuration
|
20
|
+
|
21
|
+
# Documentation Standards
|
22
|
+
# - 100% documentation coverage required
|
23
|
+
# - All public methods must have @param and @return tags
|
24
|
+
# - Examples should be provided using @example
|
25
|
+
# - Version tracking with @since tags
|