hexy 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG +4 -0
- data/Gemfile +5 -0
- data/{README → README.md} +5 -6
- data/Rakefile +23 -15
- data/lib/hexy.rb +6 -4
- metadata +55 -44
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MjVhMjNlODkwNDk0ZDA2NTcyZjAyNzJiMmVlYmNlODIzNzU0MzExNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGZiMjg3NTJjNWM0ZjM4OTA0NTU5MmRjMzhkZmFiNGQ1NmZiYjJjMA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NTdlZjcyZjdlMDRkNjI0MzBmMGNkMzY2NjE2MjMxOTM5YWY2ZTE0Zjk5NWUx
|
10
|
+
MzliOTU2MDcxOWY3YzBmMTMyNjhiZDY0MWE2YjNlMDU4MTFjNWMwNDg4NDcx
|
11
|
+
MTUyMDVhNzRmNzY2MmJiMTRjM2FiYWYxNDk3YjI2ZjlmNTc4MmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGNiNjg4YjIyY2I3MWYxMzI3MDQ2MDE2MDg0ODY1OTlhODFmMGY5ZWY1YjEz
|
14
|
+
ZjViNDViMWVkNmIxZWY2YzkxNTFlOGZlMmVjNGZiYzU0Yzg5YjUwMGZiNTI3
|
15
|
+
MTI1MjQ4ZTFlZWVjYTdiMTc5NjNlMjlhYjk0YTU4MWMzZWIyMGQ=
|
data/CHANGELOG
CHANGED
data/Gemfile
ADDED
data/{README → README.md}
RENAMED
@@ -1,5 +1,6 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/a2800276/hexy.svg?branch=master)](https://travis-ci.org/a2800276/hexy)
|
1
2
|
|
2
|
-
|
3
|
+
# hexy -- utility to create hex dumps
|
3
4
|
|
4
5
|
`hexy` is a ruby library that's easy to use to create hex dumps from
|
5
6
|
within your ruby scripts. It contains a number of options to configure
|
@@ -42,7 +43,7 @@ or even:
|
|
42
43
|
with hexy!
|
43
44
|
|
44
45
|
|
45
|
-
|
46
|
+
## Installing
|
46
47
|
|
47
48
|
Having a "Installing" section is a bit of a chicken or egg question.
|
48
49
|
Someone reading this README has, in all likelyhood already installed the
|
@@ -50,13 +51,11 @@ package.
|
|
50
51
|
|
51
52
|
You can install the +hexy+ package by executing:
|
52
53
|
|
53
|
-
gem install hexy
|
54
|
+
gem install hexy
|
54
55
|
|
55
|
-
alternatively, you can download +.tar.gz+ or +.zip+ archives from
|
56
|
-
Rubyforge[http://rubyforge.org/frs/?group_id=2203].
|
57
56
|
|
58
57
|
|
59
|
-
|
58
|
+
## Mail
|
60
59
|
|
61
60
|
In case you discover bugs, spelling errors, offer suggestions for
|
62
61
|
improvements or would like to help out with the project, you can contact
|
data/Rakefile
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
-
require "
|
2
|
-
require "
|
1
|
+
require "rdoc/task"
|
2
|
+
require "rubygems/package_task"
|
3
3
|
require "rake/testtask"
|
4
4
|
require "rake/clean"
|
5
5
|
require "rubygems"
|
6
6
|
|
7
|
+
|
8
|
+
lib = File.expand_path('../lib/', __FILE__)
|
9
|
+
$:.unshift lib unless $:.include?(lib)
|
10
|
+
require "hexy"
|
11
|
+
|
12
|
+
|
7
13
|
# Some definitions that you'll need to edit in case you reuse this
|
8
14
|
# Rakefile for your own project.
|
9
15
|
|
10
16
|
SHORTNAME ='hexy' # this should be the rubyforge project name
|
11
17
|
DESC ='Utility for hexdumps'
|
12
|
-
PKG_VERSION =
|
18
|
+
PKG_VERSION = Hexy::VERSION
|
13
19
|
LONG_DESC = <<END_DESC
|
14
20
|
This is a short project description.
|
15
21
|
END_DESC
|
@@ -18,7 +24,7 @@ RUBYFORGE_USER ='a2800276'
|
|
18
24
|
# Specifies the default task to execute. This is often the "test" task
|
19
25
|
# and we'll change things around as soon as we have some tests.
|
20
26
|
|
21
|
-
task :default => [:
|
27
|
+
task :default => [:test]
|
22
28
|
|
23
29
|
# The directory to generate +rdoc+ in.
|
24
30
|
RDOC_DIR="doc/html"
|
@@ -82,11 +88,13 @@ spec = Gem::Specification.new do |s|
|
|
82
88
|
s.requirements << "none"
|
83
89
|
s.require_path = 'lib'
|
84
90
|
s.description = LONG_DESC
|
91
|
+
s.add_development_dependency("rake")
|
92
|
+
s.add_development_dependency("test-unit")
|
85
93
|
end
|
86
94
|
|
87
95
|
# Adding a new GemPackageTask adds a task named `package`, which generates
|
88
96
|
# packages as gems, tarball and zip archives.
|
89
|
-
|
97
|
+
Gem::PackageTask.new(spec) do |pkg|
|
90
98
|
pkg.need_zip = true
|
91
99
|
pkg.need_tar_gz = true
|
92
100
|
end
|
@@ -102,16 +110,16 @@ end
|
|
102
110
|
# Windows. I'm currently not aware of any pure ruby way to do scp
|
103
111
|
# transfers.
|
104
112
|
|
105
|
-
RubyForgeProject=SHORTNAME
|
106
|
-
|
107
|
-
desc "Upload the web pages to the web."
|
108
|
-
task :upload_pages => ["rdoc"] do
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
113
|
+
# RubyForgeProject=SHORTNAME
|
114
|
+
#
|
115
|
+
# desc "Upload the web pages to the web."
|
116
|
+
# task :upload_pages => ["rdoc"] do
|
117
|
+
# if RubyForgeProject then
|
118
|
+
# path = "/var/www/gforge-projects/#{RubyForgeProject}"
|
119
|
+
# sh "scp -r doc/html/* #{RUBYFORGE_USER}@rubyforge.org:#{path}"
|
120
|
+
# sh "scp doc/images/*.png #{RUBYFORGE_USER}@rubyforge.org:#{path}/images"
|
121
|
+
# end
|
122
|
+
# end
|
115
123
|
|
116
124
|
# This task will run the unit tests provided in files called
|
117
125
|
# `test/test*.rb`. The task itself can be run with a call to `rake test`
|
data/lib/hexy.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
class Hexy
|
4
4
|
|
5
|
+
VERSION = '0.2.0'
|
6
|
+
|
5
7
|
def self.dump bytes, config={}
|
6
8
|
Hexy.new(bytes, config).to_s
|
7
9
|
end
|
@@ -44,7 +46,7 @@ class Hexy
|
|
44
46
|
# puts p.to_s
|
45
47
|
#
|
46
48
|
def initialize bytes, config = {}
|
47
|
-
@bytes = bytes
|
49
|
+
@bytes = bytes.force_encoding(Encoding::ASCII_8BIT)
|
48
50
|
@width = config[:width] || 16
|
49
51
|
@numbering = config[:numbering] == :none ? :none : :hex_bytes
|
50
52
|
@format = case config[:format]
|
@@ -63,8 +65,7 @@ class Hexy
|
|
63
65
|
def to_s
|
64
66
|
str = ""
|
65
67
|
0.step(@bytes.length, @width) {|i|
|
66
|
-
string = @bytes
|
67
|
-
|
68
|
+
string = @bytes.byteslice(i,@width).force_encoding(Encoding::ASCII_8BIT)
|
68
69
|
hex = string.unpack("H*")[0]
|
69
70
|
hex.upcase! if @case == :upper
|
70
71
|
|
@@ -82,7 +83,8 @@ class Hexy
|
|
82
83
|
}
|
83
84
|
end
|
84
85
|
|
85
|
-
string.gsub!(/[\000-\040\177-\377]/, ".")
|
86
|
+
#string.gsub!(/[\000-\040\177-\377]/, ".")
|
87
|
+
string.gsub!(/[^\041-\176]/, ".")
|
86
88
|
string.gsub!(/(.{#{@width/2}})/) { |m|
|
87
89
|
m+" "
|
88
90
|
}
|
metadata
CHANGED
@@ -1,71 +1,82 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
version: 0.1.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Tim Becker
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: test-unit
|
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'
|
41
|
+
description: ! "\tThis is a short project description.\n"
|
22
42
|
email: tim@kuriositaet.de
|
23
43
|
executables: []
|
24
|
-
|
25
44
|
extensions: []
|
26
|
-
|
27
45
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
30
|
-
- lib/hexy.rb
|
46
|
+
files:
|
31
47
|
- AUTHORS
|
32
48
|
- CHANGELOG
|
33
49
|
- COPYING
|
50
|
+
- Gemfile
|
34
51
|
- LICENSE
|
35
|
-
- README
|
52
|
+
- README.md
|
36
53
|
- Rakefile
|
37
54
|
- THANKS
|
38
55
|
- TODO
|
56
|
+
- lib/hexy.rb
|
39
57
|
- test/hexy_text.rb
|
40
|
-
has_rdoc: true
|
41
58
|
homepage: https://github.com/a2800276/hexy
|
42
59
|
licenses: []
|
43
|
-
|
60
|
+
metadata: {}
|
44
61
|
post_install_message:
|
45
62
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
63
|
+
require_paths:
|
48
64
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
requirements:
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements:
|
64
76
|
- none
|
65
77
|
rubyforge_project:
|
66
|
-
rubygems_version:
|
78
|
+
rubygems_version: 2.4.8
|
67
79
|
signing_key:
|
68
|
-
specification_version:
|
69
|
-
summary:
|
80
|
+
specification_version: 4
|
81
|
+
summary: ! 'hexy: Utility for hexdumps'
|
70
82
|
test_files: []
|
71
|
-
|