bindef 0.0.1 → 0.0.6

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
  SHA256:
3
- metadata.gz: 1b724be52120b58e47c96e9f4b07571290196299c8a2a3c8b09dceee182516ee
4
- data.tar.gz: 5d3953bb96c9622dddbd31590931b181fac46c20e942a8b51e23ac34db41d4b5
3
+ metadata.gz: 05652fe2741d34eb181ce1511ed815b6fae22bec659cc232973cbeca32b642aa
4
+ data.tar.gz: 2ac64883af476f0d7ad2371ebb1bdde116c737f7b93b304f6cbf67e6f275ab22
5
5
  SHA512:
6
- metadata.gz: d1d74f2d7167ec0eac702b3a57daae8e36da2f46b3877578abd5a33e9c7d1779a593ac2f812a704869356b55003c290d5e1592e2d1b1ac32e70a9a56ddce4689
7
- data.tar.gz: c19b67e1c2908207e2cd447e38d7943225b804acfb0698c28cf4d31f55f0e197583435964be4c13b737994ab8768fc4e9f3d8430af8e1cbc5fdf656804922462
6
+ metadata.gz: 1ec1c23f12c5b579e2dcd4f7a3f6f7f62f4c36f4c006b8e5c56ece06e2c36ba602b524b8c3f2844ed24798903c6f9afad335c95b80a2690ec86007269704f15f
7
+ data.tar.gz: 543f80a5e086a9ef85ec34a820cc1163e05c1a36837c2e5d914b45772273a8cea22da751bc1827794fb7b3a73675497208e0292ea4564fa5e89baca93dc96fd7
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ The MIT License (MIT) with restrictions
2
2
 
3
- Copyright (c) 2018 William Woodruff <william @ yossarian.net>
3
+ Copyright (c) 2020 William Woodruff <william @ yossarian.net>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
22
+
23
+ The following terms additionally apply and override any above terms for
24
+ applicable parties:
25
+
26
+ You may not use, copy, modify, merge, publish, distribute, sublicense,
27
+ and/or sell copies of the Software in a military or law enforcement context,
28
+ defined as follows:
29
+
30
+ 1. A military context is a professional context where the intended application
31
+ of the Software is integration or use with or by military software, tools
32
+ (software or hardware), or personnel. This includes contractors and
33
+ subcontractors as well as research affiliates of any military organization.
34
+
35
+ 2. A law enforcement context is a professional context where the intended
36
+ application of the Software is integration or use with or by law enforcement
37
+ software, tools (software or hardware), or personnel. This includes
38
+ contractors and subcontractors as well as research affiliates of any law
39
+ enforcement organization.
40
+
41
+ Entities that sell or license to military or law enforcement organizations
42
+ may use the Software under the original terms, but only in contexts that do
43
+ not assist or supplement the sold or licensed product.
44
+
45
+ Students and academics who are affiliated with research institutions may use
46
+ the Software under the original terms, but only in contexts that do not assist
47
+ or supplement collaboration or affiliation with any military or law
48
+ enforcement organization.
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  bindef
2
2
  ========
3
3
 
4
+ ![license](https://raster.shields.io/badge/license-MIT%20with%20restrictions-green.png)
5
+ [![Gem Version](https://badge.fury.io/rb/bindef.svg)](https://badge.fury.io/rb/bindef)
6
+ [![Build Status](https://img.shields.io/github/workflow/status/woodruffw/bindef/CI/master)](https://github.com/woodruffw/bindef/actions?query=workflow%3ACI)
7
+ [![Coverage Status](https://codecov.io/gh/woodruffw/bindef/branch/master/graph/badge.svg)](https://codecov.io/gh/woodruffw/bindef)
8
+ [![Maintainability](https://api.codeclimate.com/v1/badges/bc780f5233688a8e5951/maintainability)](https://codeclimate.com/github/woodruffw/bindef/maintainability)
9
+
4
10
  `bindef` is a DSL and command-line tool for building binary files.
5
11
 
6
12
  It's inspired by [t2b](https://github.com/thosakwe/t2b), but with a few crucial differences:
@@ -31,7 +37,7 @@ pragma endian: :big
31
37
  u32 0xFF000000
32
38
  ```
33
39
 
34
- The [examples directory](examples/) has more. Read the [SYNTAX](SYNTAX.md) file for a
40
+ The [example directory](example/) has more. Read the [SYNTAX](SYNTAX.md) file for a
35
41
  complete listing of commands and pragmas.
36
42
 
37
43
  ## Installation
data/bin/bd CHANGED
@@ -25,7 +25,7 @@ OptionParser.new do |parser|
25
25
  options[:input] = File.open(input, "r")
26
26
  end
27
27
 
28
- parser.on "-o", "--output FILE", String, "Write output to FILE (default: stderr)" do |output|
28
+ parser.on "-o", "--output FILE", String, "Write output to FILE (default: stdout)" do |output|
29
29
  abort("Error: #{output} exists, not overwriting") if File.file?(output)
30
30
  options[:output] = File.open(output, "wb")
31
31
  end
@@ -41,6 +41,11 @@ OptionParser.new do |parser|
41
41
  parser.on "-e", "--extra ext1,ext2,ext3", Array, "Extra command set(s) to load" do |extras|
42
42
  extras.each { |e| require "bindef/extras/#{e}" }
43
43
  end
44
+
45
+ parser.on "-V", "--version" do
46
+ puts "bd (bindef) version #{Bindef::VERSION}"
47
+ exit
48
+ end
44
49
  end.parse!
45
50
 
46
51
  bindef = Bindef.new(options[:output],
@@ -48,7 +53,7 @@ bindef = Bindef.new(options[:output],
48
53
  verbose: options[:verbose],
49
54
  warnings: options[:warnings])
50
55
 
51
- options[:error].puts "W: output looks like a tty" if options[:output].tty? && options[:verbose]
56
+ options[:error].puts "W: output looks like a tty" if options[:output].tty? && options[:warnings]
52
57
 
53
58
  begin
54
59
  bindef.instance_eval options[:input].read, "input", 1
@@ -48,6 +48,7 @@ class Bindef
48
48
  # Builds a string containing the given value packed into the given format.
49
49
  # @param value [Object] the value to emit
50
50
  # @param fmt [String] the `Array#pack` format to emit it in
51
+ # @api private
51
52
  def blobify(value, fmt)
52
53
  [value].pack(fmt)
53
54
  end
@@ -66,6 +67,11 @@ class Bindef
66
67
  raise CommandError, "unknown command: #{args.join(" ")}"
67
68
  end
68
69
 
70
+ # @api private
71
+ def respond_to_missing?(*_args)
72
+ true
73
+ end
74
+
69
75
  # Changes the values of the given pragma keys.
70
76
  # @see PRAGMA_SCHEMA
71
77
  # @param hsh [Hash] the keys and values to update the pragma state with
@@ -84,10 +90,10 @@ class Bindef
84
90
  pragmas[key] = value
85
91
  end
86
92
 
87
- if block_given?
88
- yield
89
- pragmas.replace old_pragmas
90
- end
93
+ return unless block_given?
94
+
95
+ yield
96
+ pragmas.replace old_pragmas
91
97
  end
92
98
 
93
99
  # Emits a string.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Bindef
3
+ class Bindef # rubocop:disable Style/Documentation
4
4
  module Extras
5
5
  # Helpers for {Extras::Ctrl}.
6
6
  module CtrlHelper
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Bindef
3
+ class Bindef # rubocop:disable Style/Documentation
4
4
  module Extras
5
5
  # Potentially useful 128-bit integer emission commands.
6
6
  module Int128
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Bindef
3
+ class Bindef # rubocop:disable Style/Documentation
4
4
  module Extras
5
5
  # Potentially useful extra string emission commands.
6
6
  module String
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Bindef
3
+ class Bindef # rubocop:disable Style/Documentation
4
4
  module Extras
5
5
  # Potentially useful TLV (tag-length-value) commands.
6
6
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  class Bindef
4
4
  # The current {Bindef} version.
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.6"
6
6
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-25 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: yard
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -45,9 +73,9 @@ files:
45
73
  - lib/bindef/extras/tlv.rb
46
74
  - lib/bindef/schemas.rb
47
75
  - lib/bindef/version.rb
48
- homepage:
76
+ homepage: https://github.com/woodruffw/bindef
49
77
  licenses:
50
- - MIT
78
+ - Nonstandard
51
79
  metadata: {}
52
80
  post_install_message:
53
81
  rdoc_options: []
@@ -64,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
92
  - !ruby/object:Gem::Version
65
93
  version: '0'
66
94
  requirements: []
67
- rubyforge_project:
68
- rubygems_version: 2.7.6
95
+ rubygems_version: 3.1.2
69
96
  signing_key:
70
97
  specification_version: 4
71
98
  summary: bindef - A DSL and command-line tool for generating binary files