mu 5.7.26 → 5.7.27
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.
- data/lib/mu/command/cmd_musl.rb +51 -8
- data/lib/mu/helper.rb +33 -0
- data/version.rb +1 -1
- metadata +84 -94
data/lib/mu/command/cmd_musl.rb
CHANGED
@@ -35,6 +35,8 @@ class Mu
|
|
35
35
|
cmds = [
|
36
36
|
"mu cmd_musl:help",
|
37
37
|
"mu cmd_musl:from_har <options> <har_file>",
|
38
|
+
"mu cmd_musl:escape <infile> [-o outfile]",
|
39
|
+
"mu cmd_musl:bin2hex <infile> [-o outfile]"
|
38
40
|
]
|
39
41
|
|
40
42
|
puts "#{@opts}"
|
@@ -47,8 +49,14 @@ class Mu
|
|
47
49
|
puts "NetExport Information: http://www.softwareishard.com/blog/netexport/"
|
48
50
|
puts "NetExport Extension: http://getfirebug.com/releases/netexport/"
|
49
51
|
puts
|
50
|
-
puts "Outputs:"
|
52
|
+
puts "from_har Outputs:"
|
51
53
|
puts "Scenario file: <harfilename>.msl by default or filename from -s"
|
54
|
+
puts
|
55
|
+
puts "escape Outputs:"
|
56
|
+
puts "html escaped output sent to stdout or file"
|
57
|
+
puts
|
58
|
+
puts "bin2hex Outputs:"
|
59
|
+
puts "hexadecimal output sent to stdout or file"
|
52
60
|
|
53
61
|
false
|
54
62
|
end
|
@@ -79,7 +87,38 @@ class Mu
|
|
79
87
|
raise "This command isn't implemented yet"
|
80
88
|
end
|
81
89
|
|
82
|
-
|
90
|
+
def cmd_escape argv
|
91
|
+
if setup argv
|
92
|
+
else
|
93
|
+
raise "Invalid command line options"
|
94
|
+
end
|
95
|
+
result = escape File.read(@options.in_files[0])
|
96
|
+
if !@options.print_stdout
|
97
|
+
File.open(@options.out_file,'w') do |file|
|
98
|
+
file.write "#{result}"
|
99
|
+
end
|
100
|
+
puts "Created html escaped file: #{@options.out_file}"
|
101
|
+
else
|
102
|
+
puts result
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def cmd_bin2hex argv
|
107
|
+
if setup argv
|
108
|
+
else
|
109
|
+
raise "Invalid command line options"
|
110
|
+
end
|
111
|
+
result = bin2hex @options.in_files[0]
|
112
|
+
if !@options.print_stdout
|
113
|
+
File.open(@options.out_file,'w') do |file|
|
114
|
+
file.write "#{result[0]}"
|
115
|
+
end
|
116
|
+
puts "Created hex file: #{@options.out_file}"
|
117
|
+
else
|
118
|
+
puts result[0].to_s
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
83
122
|
|
84
123
|
|
85
124
|
private
|
@@ -154,9 +193,18 @@ class Mu
|
|
154
193
|
@opts.on( '-s', '--scenario <FILENAME>', 'Specify the msl filename to be created' ) do |scenario|
|
155
194
|
@options.scenario = scenario
|
156
195
|
end
|
196
|
+
@opts.on( '-o', '--output <FILENAME>', 'Specify the output filename to be created' ) do |outfile|
|
197
|
+
@options.out_file = outfile
|
198
|
+
end
|
157
199
|
# Remove all options just leaving the harfiles
|
158
200
|
@opts.parse! @arguments rescue return false
|
159
|
-
@options.
|
201
|
+
@options.in_files = @arguments
|
202
|
+
@options.har_files = @arguments
|
203
|
+
if @options.out_file
|
204
|
+
@options.print_stdout = false
|
205
|
+
else
|
206
|
+
@options.print_stdout = true
|
207
|
+
end
|
160
208
|
unless @options.scenario
|
161
209
|
# Identical filename replacing the extension har with msl
|
162
210
|
begin
|
@@ -171,11 +219,6 @@ class Mu
|
|
171
219
|
|
172
220
|
true
|
173
221
|
end # parsed_options()
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
222
|
end # Cmd_musl
|
180
223
|
end # Command
|
181
224
|
end # Mu
|
data/lib/mu/helper.rb
CHANGED
@@ -68,5 +68,38 @@ module Helper
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
ESCAPES= Array.new 256 do |i|
|
72
|
+
case i
|
73
|
+
when 9; "\\t".freeze
|
74
|
+
when 13; "\\r".freeze
|
75
|
+
when 92; "\\\\".freeze
|
76
|
+
when 10; "\\n".freeze
|
77
|
+
when 32..126; i.chr.freeze
|
78
|
+
else ; ('\x%02x' % i).freeze
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Only works for 1.9
|
83
|
+
#ESCAPES["'".ord] = %q{\'}
|
84
|
+
#ESCAPES['"'.ord] = %q{\"}
|
85
|
+
# Works for 1.8 and 1.9
|
86
|
+
ESCAPES['"'.unpack('c*')[0]] = %q{\"}
|
87
|
+
ESCAPES["'".unpack('c*')[0]] = %q{\'}
|
88
|
+
ESCAPES.freeze
|
89
|
+
|
90
|
+
# Takes input and a table that maps ascii codes to their representation
|
91
|
+
def escape input, escapes=nil
|
92
|
+
escapes ||= ESCAPES
|
93
|
+
output = []
|
94
|
+
input.each_byte do |i|
|
95
|
+
output << escapes[i]
|
96
|
+
end
|
97
|
+
output.join
|
98
|
+
end
|
99
|
+
|
100
|
+
def bin2hex input
|
101
|
+
IO.read("#{input}").unpack('H*')
|
102
|
+
end
|
103
|
+
|
71
104
|
end
|
72
105
|
end # Mu
|
data/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION='5.7.
|
1
|
+
VERSION='5.7.27'
|
metadata
CHANGED
@@ -1,158 +1,148 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mu
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.7.27
|
4
5
|
prerelease:
|
5
|
-
version: 5.7.26
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- MuEng
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-06-09 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: nokogiri
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &13214620 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 1.4.4
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rest-client
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *13214620
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rest-client
|
27
|
+
requirement: &13214160 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
35
32
|
version: 1.6.1
|
36
33
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: mime-types
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *13214160
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: mime-types
|
38
|
+
requirement: &13213700 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.16'
|
47
44
|
type: :runtime
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: json
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *13213700
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: json
|
49
|
+
requirement: &13213320 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
58
55
|
type: :runtime
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: hexy
|
62
56
|
prerelease: false
|
63
|
-
|
57
|
+
version_requirements: *13213320
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: hexy
|
60
|
+
requirement: &13212780 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
68
65
|
version: 0.1.1
|
69
66
|
type: :runtime
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: uuid
|
73
67
|
prerelease: false
|
74
|
-
|
68
|
+
version_requirements: *13212780
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: uuid
|
71
|
+
requirement: &13212280 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
79
76
|
version: 2.0.2
|
80
77
|
type: :runtime
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
email:
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *13212280
|
80
|
+
description: ! "The Mu gem allows users to include mu libraries within scripts\n that
|
81
|
+
interact with mu appliance software. The gem also supplies command line interfaces\n
|
82
|
+
\ to many of these same libraries"
|
83
|
+
email:
|
87
84
|
- info@mudynamics.com
|
88
|
-
executables:
|
85
|
+
executables:
|
89
86
|
- mu
|
90
87
|
extensions: []
|
91
|
-
|
92
88
|
extra_rdoc_files: []
|
93
|
-
|
94
|
-
|
95
|
-
- lib/mu/
|
96
|
-
- lib/mu/
|
97
|
-
- lib/mu/
|
89
|
+
files:
|
90
|
+
- lib/mu.rb
|
91
|
+
- lib/mu/har.rb
|
92
|
+
- lib/mu/http_helper.rb
|
93
|
+
- lib/mu/client.rb
|
98
94
|
- lib/mu/api/netconfig.rb
|
99
|
-
- lib/mu/api/
|
95
|
+
- lib/mu/api/muapi.rb
|
96
|
+
- lib/mu/api/homepage.rb
|
100
97
|
- lib/mu/api/system.rb
|
101
|
-
- lib/mu/
|
98
|
+
- lib/mu/api/scale.rb
|
99
|
+
- lib/mu/api/ddt.rb
|
100
|
+
- lib/mu/helper.rb
|
101
|
+
- lib/mu/maker.rb
|
102
|
+
- lib/mu/command/cmd_homepage.rb
|
102
103
|
- lib/mu/command/api.rb
|
103
104
|
- lib/mu/command/cmd_ddt.rb
|
104
|
-
- lib/mu/command/
|
105
|
+
- lib/mu/command/cmd_scale.rb
|
106
|
+
- lib/mu/command/curl.rb
|
105
107
|
- lib/mu/command/cmd_muapi.rb
|
108
|
+
- lib/mu/command/help.rb
|
106
109
|
- lib/mu/command/cmd_musl.rb
|
107
|
-
- lib/mu/command/
|
108
|
-
- lib/mu/command/cmd_runanalysis.rb
|
110
|
+
- lib/mu/command/cmd_system.rb
|
109
111
|
- lib/mu/command/cmd_runscale.rb
|
110
112
|
- lib/mu/command/cmd_runscenario.rb
|
113
|
+
- lib/mu/command/cmd_runanalysis.rb
|
114
|
+
- lib/mu/command/cmd_netconfig.rb
|
111
115
|
- lib/mu/command/cmd_runverify.rb
|
112
|
-
- lib/mu/command/cmd_scale.rb
|
113
|
-
- lib/mu/command/cmd_system.rb
|
114
|
-
- lib/mu/command/curl.rb
|
115
|
-
- lib/mu/command/help.rb
|
116
116
|
- lib/mu/command.rb
|
117
117
|
- lib/mu/curl/error.rb
|
118
118
|
- lib/mu/curl/verify.rb
|
119
|
-
- lib/mu/har.rb
|
120
|
-
- lib/mu/helper.rb
|
121
|
-
- lib/mu/http_helper.rb
|
122
|
-
- lib/mu/maker.rb
|
123
|
-
- lib/mu.rb
|
124
119
|
- bin/mu
|
125
120
|
- Mu_Gem.html
|
126
121
|
- version.rb
|
127
122
|
- LICENSE.txt
|
128
123
|
- README.rdoc
|
129
|
-
has_rdoc: true
|
130
124
|
homepage: http://www.mudynamics.com
|
131
125
|
licenses: []
|
132
|
-
|
133
126
|
post_install_message:
|
134
127
|
rdoc_options: []
|
135
|
-
|
136
|
-
require_paths:
|
128
|
+
require_paths:
|
137
129
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
131
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
143
135
|
version: 1.8.7
|
144
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
137
|
none: false
|
146
|
-
requirements:
|
147
|
-
- -
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version:
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
150
142
|
requirements: []
|
151
|
-
|
152
143
|
rubyforge_project:
|
153
|
-
rubygems_version: 1.
|
144
|
+
rubygems_version: 1.8.5
|
154
145
|
signing_key:
|
155
146
|
specification_version: 3
|
156
147
|
summary: Mu Dynamics General Purpose Library and Command Line Tool
|
157
148
|
test_files: []
|
158
|
-
|