smcutil 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 3c4bb933bb6f5f67cd3df1439465c31ea4e2bc98
4
- data.tar.gz: 9e473e109138ab90e03d6aec19267ef494a15bb9
3
+ metadata.gz: 1123a5675b914e96a1d506894878b2f8b4ee56f5
4
+ data.tar.gz: c675623d045542fad367ef37ed13c9afcb788e03
5
5
  SHA512:
6
- metadata.gz: f6ee078e9cd3e827bae43c9a69ba6fec82c7cb73b9e4a24aa565eb38f4747de909e1958fbfc3cde64a70f180bff6402195829692a5a9a355f0f310c347d51d56
7
- data.tar.gz: 8644ee2a9b45a9aed11e5d551399626d4f19f3c6f15f289c127ff41224bd1e3553aef19dc2f489c60fa6384865045ac08ff529cfadb552f20fd1541843cebfb8
6
+ metadata.gz: b265f393229b443c465f6e9e03b9b1c6445f8aae1248d4c3ceb0a8290efa0a5bb7eda235fe8267fe6443ef27ab0084e5283f30eec7ed00e024d42521e4faa1c4
7
+ data.tar.gz: 2c1e9557f175d3fb336f1ce822d7f121c36130cb15108c89f8c06a6cdc7a82f5ca2e774aeb8e763722a7697e1887744d66ea08f8e3538be21e7e02f923f7bc8b
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ *.gem
data/.idea/workspace.xml CHANGED
@@ -7,11 +7,11 @@
7
7
  </component>
8
8
  <component name="ChangeListManager">
9
9
  <list default="true" id="79f8e064-6b6b-45b7-a43f-11c6b4aaa82e" name="Default" comment="">
10
- <change type="DELETED" beforePath="$PROJECT_DIR$/smcutil-0.1.0.gem" afterPath="" />
11
10
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
12
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
13
11
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/exe/smcutil" afterPath="$PROJECT_DIR$/exe/smcutil" />
12
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/smcutil/file_extractor.rb" afterPath="$PROJECT_DIR$/lib/smcutil/file_extractor.rb" />
14
13
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/smcutil/version.rb" afterPath="$PROJECT_DIR$/lib/smcutil/version.rb" />
14
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb" afterPath="$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb" />
15
15
  </list>
16
16
  <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
17
17
  <option name="TRACKING_ENABLED" value="true" />
@@ -21,25 +21,15 @@
21
21
  <option name="LAST_RESOLUTION" value="IGNORE" />
22
22
  </component>
23
23
  <component name="CoverageDataManager">
24
- <SUITE FILE_PATH="coverage/smcutil@Rake__spec.coverage" NAME="Rake: spec Coverage Results" MODIFIED="1507714768825" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="smcutil" />
24
+ <SUITE FILE_PATH="coverage/smcutil@Rake__spec.coverage" NAME="Rake: spec Coverage Results" MODIFIED="1507773960688" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="smcutil" />
25
25
  </component>
26
26
  <component name="FileEditorManager">
27
27
  <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
28
- <file leaf-file-name="file_extractor.rb" pinned="false" current-in-tab="false">
29
- <entry file="file://$PROJECT_DIR$/lib/smcutil/file_extractor.rb">
30
- <provider selected="true" editor-type-id="text-editor">
31
- <state relative-caret-position="0">
32
- <caret line="24" column="3" lean-forward="false" selection-start-line="24" selection-start-column="3" selection-end-line="24" selection-end-column="3" />
33
- <folding />
34
- </state>
35
- </provider>
36
- </entry>
37
- </file>
38
28
  <file leaf-file-name="smcutil" pinned="false" current-in-tab="false">
39
29
  <entry file="file://$PROJECT_DIR$/exe/smcutil">
40
30
  <provider selected="true" editor-type-id="text-editor">
41
- <state relative-caret-position="105">
42
- <caret line="7" column="12" lean-forward="false" selection-start-line="7" selection-start-column="12" selection-end-line="7" selection-end-column="12" />
31
+ <state relative-caret-position="353">
32
+ <caret line="52" column="44" lean-forward="false" selection-start-line="52" selection-start-column="44" selection-end-line="52" selection-end-column="44" />
43
33
  <folding />
44
34
  </state>
45
35
  </provider>
@@ -58,18 +48,18 @@
58
48
  <file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
59
49
  <entry file="file://$PROJECT_DIR$/lib/smcutil/version.rb">
60
50
  <provider selected="true" editor-type-id="text-editor">
61
- <state relative-caret-position="15">
62
- <caret line="1" column="18" lean-forward="false" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
51
+ <state relative-caret-position="45">
52
+ <caret line="3" column="0" lean-forward="true" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
63
53
  <folding />
64
54
  </state>
65
55
  </provider>
66
56
  </entry>
67
57
  </file>
68
- <file leaf-file-name="file_reader_spec.rb" pinned="false" current-in-tab="false">
69
- <entry file="file://$PROJECT_DIR$/spec/smcutil/file_reader_spec.rb">
58
+ <file leaf-file-name="flasher_base.smc" pinned="false" current-in-tab="false">
59
+ <entry file="file://$PROJECT_DIR$/spec/fixtures/flasher_base.smc">
70
60
  <provider selected="true" editor-type-id="text-editor">
71
- <state relative-caret-position="75">
72
- <caret line="5" column="0" lean-forward="false" selection-start-line="4" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
61
+ <state relative-caret-position="-10920">
62
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
73
63
  <folding />
74
64
  </state>
75
65
  </provider>
@@ -88,8 +78,28 @@
88
78
  <file leaf-file-name="file_extractor_spec.rb" pinned="false" current-in-tab="false">
89
79
  <entry file="file://$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb">
90
80
  <provider selected="true" editor-type-id="text-editor">
91
- <state relative-caret-position="135">
92
- <caret line="9" column="42" lean-forward="false" selection-start-line="9" selection-start-column="42" selection-end-line="9" selection-end-column="42" />
81
+ <state relative-caret-position="270">
82
+ <caret line="18" column="3" lean-forward="true" selection-start-line="18" selection-start-column="3" selection-end-line="18" selection-end-column="3" />
83
+ <folding />
84
+ </state>
85
+ </provider>
86
+ </entry>
87
+ </file>
88
+ <file leaf-file-name="file_reader.rb" pinned="false" current-in-tab="false">
89
+ <entry file="file://$PROJECT_DIR$/lib/smcutil/file_reader.rb">
90
+ <provider selected="true" editor-type-id="text-editor">
91
+ <state relative-caret-position="120">
92
+ <caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
93
+ <folding />
94
+ </state>
95
+ </provider>
96
+ </entry>
97
+ </file>
98
+ <file leaf-file-name="smcutil.rb" pinned="false" current-in-tab="false">
99
+ <entry file="file://$PROJECT_DIR$/lib/smcutil.rb">
100
+ <provider selected="true" editor-type-id="text-editor">
101
+ <state relative-caret-position="75">
102
+ <caret line="5" column="51" lean-forward="false" selection-start-line="5" selection-start-column="51" selection-end-line="5" selection-end-column="51" />
93
103
  <folding />
94
104
  </state>
95
105
  </provider>
@@ -125,11 +135,11 @@
125
135
  <option value="$PROJECT_DIR$/spec/smcutil/file_validator_spec.rb" />
126
136
  <option value="$PROJECT_DIR$/spec/fixtures/flasher_base_checksum.smc" />
127
137
  <option value="$PROJECT_DIR$/lib/smcutil.rb" />
128
- <option value="$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb" />
129
138
  <option value="$PROJECT_DIR$/lib/smcutil/file_reader.rb" />
139
+ <option value="$PROJECT_DIR$/README.md" />
130
140
  <option value="$PROJECT_DIR$/lib/smcutil/file_extractor.rb" />
141
+ <option value="$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb" />
131
142
  <option value="$PROJECT_DIR$/exe/smcutil" />
132
- <option value="$PROJECT_DIR$/README.md" />
133
143
  <option value="$PROJECT_DIR$/lib/smcutil/version.rb" />
134
144
  </list>
135
145
  </option>
@@ -275,44 +285,44 @@
275
285
  <updated>1507637323942</updated>
276
286
  <workItem from="1507637325399" duration="2380000" />
277
287
  <workItem from="1507706458195" duration="11326000" />
278
- <workItem from="1507771477082" duration="56000" />
288
+ <workItem from="1507771477082" duration="2423000" />
279
289
  </task>
280
290
  <servers />
281
291
  </component>
282
292
  <component name="TestHistory">
283
- <history-entry file="Rake__spec - 2017.10.11 at 02h 32m 45s.xml">
293
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 00m 38s.xml">
284
294
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
285
295
  </history-entry>
286
- <history-entry file="Rake__spec - 2017.10.11 at 02h 32m 58s.xml">
296
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 01m 03s.xml">
287
297
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
288
298
  </history-entry>
289
- <history-entry file="Rake__spec - 2017.10.11 at 02h 35m 01s.xml">
299
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 01m 18s.xml">
290
300
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
291
301
  </history-entry>
292
- <history-entry file="Rake__spec - 2017.10.11 at 02h 35m 22s.xml">
302
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 01m 21s.xml">
293
303
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
294
304
  </history-entry>
295
- <history-entry file="Rake__spec - 2017.10.11 at 02h 35m 36s.xml">
305
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 01m 51s.xml">
296
306
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
297
307
  </history-entry>
298
- <history-entry file="Rake__spec - 2017.10.11 at 02h 36m 23s.xml">
308
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 02m 02s.xml">
299
309
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
300
310
  </history-entry>
301
- <history-entry file="Rake__spec - 2017.10.11 at 02h 37m 07s.xml">
311
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 02m 08s.xml">
302
312
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
303
313
  </history-entry>
304
- <history-entry file="Rake__spec - 2017.10.11 at 02h 37m 18s.xml">
314
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 03m 38s.xml">
305
315
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
306
316
  </history-entry>
307
- <history-entry file="Rake__spec - 2017.10.11 at 02h 39m 08s.xml">
317
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 05m 58s.xml">
308
318
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
309
319
  </history-entry>
310
- <history-entry file="Rake__spec - 2017.10.11 at 02h 39m 29s.xml">
320
+ <history-entry file="Rake__spec - 2017.10.11 at 19h 06m 01s.xml">
311
321
  <configuration name="Rake: spec" configurationId="RakeRunConfigurationType" />
312
322
  </history-entry>
313
323
  </component>
314
324
  <component name="TimeTrackingManager">
315
- <option name="totallyTimeSpent" value="13762000" />
325
+ <option name="totallyTimeSpent" value="16129000" />
316
326
  </component>
317
327
  <component name="ToolWindowManager">
318
328
  <frame x="0" y="23" width="1680" height="983" extended-state="6" />
@@ -411,6 +421,7 @@
411
421
  <provider selected="true" editor-type-id="text-editor">
412
422
  <state relative-caret-position="45">
413
423
  <caret line="3" column="32" lean-forward="false" selection-start-line="3" selection-start-column="32" selection-end-line="3" selection-end-column="32" />
424
+ <folding />
414
425
  </state>
415
426
  </provider>
416
427
  </entry>
@@ -458,6 +469,7 @@
458
469
  <provider selected="true" editor-type-id="text-editor">
459
470
  <state relative-caret-position="210">
460
471
  <caret line="14" column="3" lean-forward="true" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
472
+ <folding />
461
473
  </state>
462
474
  </provider>
463
475
  </entry>
@@ -469,13 +481,6 @@
469
481
  </state>
470
482
  </provider>
471
483
  </entry>
472
- <entry file="file://$PROJECT_DIR$/spec/smcutil_spec.rb">
473
- <provider selected="true" editor-type-id="text-editor">
474
- <state relative-caret-position="105">
475
- <caret line="7" column="0" lean-forward="true" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
476
- </state>
477
- </provider>
478
- </entry>
479
484
  <entry file="file://$PROJECT_DIR$/spec/fixtures/flasher_base_unknown_command.smc">
480
485
  <provider selected="true" editor-type-id="text-editor">
481
486
  <state relative-caret-position="285">
@@ -497,13 +502,6 @@
497
502
  </state>
498
503
  </provider>
499
504
  </entry>
500
- <entry file="file://$PROJECT_DIR$/lib/smcutil.rb">
501
- <provider selected="true" editor-type-id="text-editor">
502
- <state relative-caret-position="75">
503
- <caret line="5" column="51" lean-forward="false" selection-start-line="5" selection-start-column="51" selection-end-line="5" selection-end-column="51" />
504
- </state>
505
- </provider>
506
- </entry>
507
505
  <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
508
506
  <provider selected="true" editor-type-id="text-editor">
509
507
  <state relative-caret-position="0">
@@ -511,7 +509,6 @@
511
509
  </state>
512
510
  </provider>
513
511
  </entry>
514
- <entry file="file://$PROJECT_DIR$/spec/fixtures/flasher_base.smc" />
515
512
  <entry file="file://$PROJECT_DIR$/spec/smcutil/file_reader_spec.rb">
516
513
  <provider selected="true" editor-type-id="text-editor">
517
514
  <state relative-caret-position="75">
@@ -528,10 +525,37 @@
528
525
  </state>
529
526
  </provider>
530
527
  </entry>
531
- <entry file="file://$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb">
528
+ <entry file="file://$PROJECT_DIR$/README.md">
529
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
530
+ <state split_layout="SPLIT">
531
+ <first_editor relative-caret-position="210">
532
+ <caret line="14" column="37" lean-forward="false" selection-start-line="14" selection-start-column="37" selection-end-line="14" selection-end-column="37" />
533
+ <folding />
534
+ </first_editor>
535
+ <second_editor />
536
+ </state>
537
+ </provider>
538
+ </entry>
539
+ <entry file="file://$PROJECT_DIR$/smcutil.gemspec">
532
540
  <provider selected="true" editor-type-id="text-editor">
533
- <state relative-caret-position="135">
534
- <caret line="9" column="42" lean-forward="false" selection-start-line="9" selection-start-column="42" selection-end-line="9" selection-end-column="42" />
541
+ <state relative-caret-position="283">
542
+ <caret line="19" column="62" lean-forward="false" selection-start-line="19" selection-start-column="62" selection-end-line="19" selection-end-column="62" />
543
+ <folding />
544
+ </state>
545
+ </provider>
546
+ </entry>
547
+ <entry file="file://$PROJECT_DIR$/spec/fixtures/flasher_base.smc">
548
+ <provider selected="true" editor-type-id="text-editor">
549
+ <state relative-caret-position="-10920">
550
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
551
+ <folding />
552
+ </state>
553
+ </provider>
554
+ </entry>
555
+ <entry file="file://$PROJECT_DIR$/spec/smcutil_spec.rb">
556
+ <provider selected="true" editor-type-id="text-editor">
557
+ <state relative-caret-position="105">
558
+ <caret line="7" column="0" lean-forward="true" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
535
559
  <folding />
536
560
  </state>
537
561
  </provider>
@@ -548,48 +572,46 @@
548
572
  <provider selected="true" editor-type-id="text-editor">
549
573
  <state relative-caret-position="120">
550
574
  <caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
575
+ <folding />
551
576
  </state>
552
577
  </provider>
553
578
  </entry>
554
579
  <entry file="file://$PROJECT_DIR$/lib/smcutil/file_extractor.rb">
555
580
  <provider selected="true" editor-type-id="text-editor">
556
- <state relative-caret-position="0">
557
- <caret line="24" column="3" lean-forward="false" selection-start-line="24" selection-start-column="3" selection-end-line="24" selection-end-column="3" />
581
+ <state relative-caret-position="255">
582
+ <caret line="17" column="3" lean-forward="true" selection-start-line="17" selection-start-column="3" selection-end-line="17" selection-end-column="3" />
558
583
  <folding />
559
584
  </state>
560
585
  </provider>
561
586
  </entry>
562
- <entry file="file://$PROJECT_DIR$/README.md">
563
- <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
564
- <state split_layout="SPLIT">
565
- <first_editor relative-caret-position="210">
566
- <caret line="14" column="37" lean-forward="false" selection-start-line="14" selection-start-column="37" selection-end-line="14" selection-end-column="37" />
567
- <folding />
568
- </first_editor>
569
- <second_editor />
587
+ <entry file="file://$PROJECT_DIR$/spec/smcutil/file_extractor_spec.rb">
588
+ <provider selected="true" editor-type-id="text-editor">
589
+ <state relative-caret-position="270">
590
+ <caret line="18" column="3" lean-forward="true" selection-start-line="18" selection-start-column="3" selection-end-line="18" selection-end-column="3" />
591
+ <folding />
570
592
  </state>
571
593
  </provider>
572
594
  </entry>
573
595
  <entry file="file://$PROJECT_DIR$/exe/smcutil">
574
596
  <provider selected="true" editor-type-id="text-editor">
575
- <state relative-caret-position="105">
576
- <caret line="7" column="12" lean-forward="false" selection-start-line="7" selection-start-column="12" selection-end-line="7" selection-end-column="12" />
597
+ <state relative-caret-position="353">
598
+ <caret line="52" column="44" lean-forward="false" selection-start-line="52" selection-start-column="44" selection-end-line="52" selection-end-column="44" />
577
599
  <folding />
578
600
  </state>
579
601
  </provider>
580
602
  </entry>
581
- <entry file="file://$PROJECT_DIR$/smcutil.gemspec">
603
+ <entry file="file://$PROJECT_DIR$/lib/smcutil.rb">
582
604
  <provider selected="true" editor-type-id="text-editor">
583
- <state relative-caret-position="283">
584
- <caret line="19" column="62" lean-forward="false" selection-start-line="19" selection-start-column="62" selection-end-line="19" selection-end-column="62" />
605
+ <state relative-caret-position="75">
606
+ <caret line="5" column="51" lean-forward="false" selection-start-line="5" selection-start-column="51" selection-end-line="5" selection-end-column="51" />
585
607
  <folding />
586
608
  </state>
587
609
  </provider>
588
610
  </entry>
589
611
  <entry file="file://$PROJECT_DIR$/lib/smcutil/version.rb">
590
612
  <provider selected="true" editor-type-id="text-editor">
591
- <state relative-caret-position="15">
592
- <caret line="1" column="18" lean-forward="false" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
613
+ <state relative-caret-position="45">
614
+ <caret line="3" column="0" lean-forward="true" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
593
615
  <folding />
594
616
  </state>
595
617
  </provider>
data/exe/smcutil CHANGED
@@ -1,12 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "smcutil"
3
+ $:.unshift File.expand_path('../lib', __dir__)
4
+ require_relative '../lib/smcutil'
4
5
  require 'optparse'
5
6
 
6
-
7
- options = {}
8
- OptionParser.new do |opts|
9
- opts.banner = <<-BANNER
7
+ BANNER = <<-BANNER
10
8
  Usage: smcutil {command} [PARAMS]
11
9
 
12
10
  Command is one of:
@@ -22,5 +20,43 @@ OptionParser.new do |opts|
22
20
 
23
21
  save {output.bin}:
24
22
  Has magical cow powers. Assuming I can make this work: GOLDEN TICKET
25
- BANNER
26
- end.parse!
23
+ BANNER
24
+
25
+ def show_usage
26
+ puts BANNER
27
+ exit
28
+ end
29
+
30
+ command = (ARGV.shift || '').to_sym
31
+
32
+ COMMANDS = [ :validate, :info, :decode, :save ]
33
+
34
+ show_usage unless COMMANDS.include? command
35
+
36
+ case command
37
+ when :validate
38
+ begin
39
+ file = ARGV.shift
40
+ show_usage unless file
41
+ reader = SmcUtil::FileReader.parse file
42
+ puts "The file '#{file}' is valid."
43
+ rescue => ex
44
+ puts ex
45
+ end
46
+ when :decode
47
+ begin
48
+ input = ARGV.shift
49
+ output = ARGV.shift
50
+
51
+ show_usage unless input && output
52
+ reader = SmcUtil::FileReader.parse input
53
+ extractor = SmcUtil::FileExtractor.new reader
54
+ extractor.extract_to output
55
+ rescue => ex
56
+ puts ex
57
+ end
58
+ when :info
59
+
60
+ else
61
+ show_usage
62
+ end
@@ -7,17 +7,10 @@ class SmcUtil::FileExtractor
7
7
 
8
8
 
9
9
  def extract_to(path)
10
- File.open(File.join(path, 'header.bin'), OUTPUT_FILE_FLAGS) do |file|
11
- file.write @file_reader.header
12
- end
13
-
14
- File.open(File.join(path, 'signature.bin'), OUTPUT_FILE_FLAGS) do |file|
15
- file.write @file_reader.signature
16
- end
17
-
18
- File.open(File.join(path, 'binary.bin'), OUTPUT_FILE_FLAGS) do |file|
10
+ File.open(path, OUTPUT_FILE_FLAGS) do |file|
19
11
  @file_reader.regions.each do |offset, content|
20
- file.seek offset
12
+ range_bytes = offset - file.pos
13
+ file.write "\0" * range_bytes if range_bytes > 0
21
14
  file.write content
22
15
  end
23
16
  end
@@ -1,3 +1,3 @@
1
1
  module SmcUtil
2
- VERSION = "0.1.1"
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smcutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Mark