hotplate 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/bin/toast +2 -0
  5. data/hotplate.gemspec +30 -0
  6. data/lib/hotplate/cli/build.rb +51 -0
  7. data/lib/hotplate/cli/init.rb +64 -0
  8. data/lib/hotplate/cli/main.rb +39 -0
  9. data/lib/hotplate/gems/rubyzip-1.1.7/README.md +271 -0
  10. data/lib/hotplate/gems/rubyzip-1.1.7/Rakefile +19 -0
  11. data/lib/hotplate/gems/rubyzip-1.1.7/TODO +15 -0
  12. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/central_directory.rb +208 -0
  13. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/compressor.rb +10 -0
  14. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/constants.rb +63 -0
  15. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/crypto/encryption.rb +11 -0
  16. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/crypto/null_encryption.rb +45 -0
  17. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/crypto/traditional_encryption.rb +99 -0
  18. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/decompressor.rb +13 -0
  19. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/deflater.rb +32 -0
  20. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/dos_time.rb +49 -0
  21. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/entry.rb +696 -0
  22. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/entry_set.rb +86 -0
  23. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/errors.rb +16 -0
  24. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb +43 -0
  25. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/ntfs.rb +92 -0
  26. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/old_unix.rb +45 -0
  27. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb +47 -0
  28. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb +38 -0
  29. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/zip64.rb +67 -0
  30. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/zip64_placeholder.rb +16 -0
  31. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field.rb +101 -0
  32. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/file.rb +436 -0
  33. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/filesystem.rb +626 -0
  34. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/inflater.rb +66 -0
  35. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/input_stream.rb +164 -0
  36. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/ioextras/abstract_input_stream.rb +115 -0
  37. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/ioextras/abstract_output_stream.rb +45 -0
  38. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/ioextras.rb +38 -0
  39. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/null_compressor.rb +15 -0
  40. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/null_decompressor.rb +27 -0
  41. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/null_input_stream.rb +10 -0
  42. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/output_stream.rb +190 -0
  43. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/pass_thru_compressor.rb +23 -0
  44. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/pass_thru_decompressor.rb +41 -0
  45. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/streamable_directory.rb +15 -0
  46. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/streamable_stream.rb +56 -0
  47. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip/version.rb +3 -0
  48. data/lib/hotplate/gems/rubyzip-1.1.7/lib/zip.rb +63 -0
  49. data/lib/hotplate/gems/rubyzip-1.1.7/samples/example.rb +91 -0
  50. data/lib/hotplate/gems/rubyzip-1.1.7/samples/example_filesystem.rb +33 -0
  51. data/lib/hotplate/gems/rubyzip-1.1.7/samples/example_recursive.rb +48 -0
  52. data/lib/hotplate/gems/rubyzip-1.1.7/samples/gtkRubyzip.rb +86 -0
  53. data/lib/hotplate/gems/rubyzip-1.1.7/samples/qtzip.rb +101 -0
  54. data/lib/hotplate/gems/rubyzip-1.1.7/samples/write_simple.rb +13 -0
  55. data/lib/hotplate/gems/rubyzip-1.1.7/samples/zipfind.rb +74 -0
  56. data/lib/hotplate/gems/rubyzip-1.1.7/test/basic_zip_file_test.rb +64 -0
  57. data/lib/hotplate/gems/rubyzip-1.1.7/test/central_directory_entry_test.rb +73 -0
  58. data/lib/hotplate/gems/rubyzip-1.1.7/test/central_directory_test.rb +104 -0
  59. data/lib/hotplate/gems/rubyzip-1.1.7/test/crypto/null_encryption_test.rb +53 -0
  60. data/lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb +80 -0
  61. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/WarnInvalidDate.zip +0 -0
  62. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/file1.txt +46 -0
  63. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/file1.txt.deflatedData +0 -0
  64. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/file2.txt +1504 -0
  65. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest/foo/bar/baz/foo.txt +0 -0
  66. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest/foo.txt +0 -0
  67. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest/food.txt +0 -0
  68. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/globTest.zip +0 -0
  69. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/mimetype +1 -0
  70. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/notzippedruby.rb +7 -0
  71. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/ntfs.zip +0 -0
  72. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/rubycode.zip +0 -0
  73. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/rubycode2.zip +0 -0
  74. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/testDirectory.bin +0 -0
  75. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/zip64-sample.zip +0 -0
  76. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/zipWithDirs.zip +0 -0
  77. data/lib/hotplate/gems/rubyzip-1.1.7/test/data/zipWithEncryption.zip +0 -0
  78. data/lib/hotplate/gems/rubyzip-1.1.7/test/deflater_test.rb +67 -0
  79. data/lib/hotplate/gems/rubyzip-1.1.7/test/encryption_test.rb +42 -0
  80. data/lib/hotplate/gems/rubyzip-1.1.7/test/entry_set_test.rb +138 -0
  81. data/lib/hotplate/gems/rubyzip-1.1.7/test/entry_test.rb +165 -0
  82. data/lib/hotplate/gems/rubyzip-1.1.7/test/errors_test.rb +36 -0
  83. data/lib/hotplate/gems/rubyzip-1.1.7/test/extra_field_test.rb +78 -0
  84. data/lib/hotplate/gems/rubyzip-1.1.7/test/file_extract_directory_test.rb +56 -0
  85. data/lib/hotplate/gems/rubyzip-1.1.7/test/file_extract_test.rb +90 -0
  86. data/lib/hotplate/gems/rubyzip-1.1.7/test/file_split_test.rb +60 -0
  87. data/lib/hotplate/gems/rubyzip-1.1.7/test/file_test.rb +559 -0
  88. data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/dir_iterator_test.rb +62 -0
  89. data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/directory_test.rb +131 -0
  90. data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/file_mutating_test.rb +100 -0
  91. data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/file_nonmutating_test.rb +514 -0
  92. data/lib/hotplate/gems/rubyzip-1.1.7/test/filesystem/file_stat_test.rb +66 -0
  93. data/lib/hotplate/gems/rubyzip-1.1.7/test/gentestfiles.rb +134 -0
  94. data/lib/hotplate/gems/rubyzip-1.1.7/test/inflater_test.rb +14 -0
  95. data/lib/hotplate/gems/rubyzip-1.1.7/test/input_stream_test.rb +170 -0
  96. data/lib/hotplate/gems/rubyzip-1.1.7/test/ioextras/abstract_input_stream_test.rb +103 -0
  97. data/lib/hotplate/gems/rubyzip-1.1.7/test/ioextras/abstract_output_stream_test.rb +106 -0
  98. data/lib/hotplate/gems/rubyzip-1.1.7/test/ioextras/fake_io_test.rb +18 -0
  99. data/lib/hotplate/gems/rubyzip-1.1.7/test/local_entry_test.rb +156 -0
  100. data/lib/hotplate/gems/rubyzip-1.1.7/test/output_stream_test.rb +129 -0
  101. data/lib/hotplate/gems/rubyzip-1.1.7/test/pass_thru_compressor_test.rb +31 -0
  102. data/lib/hotplate/gems/rubyzip-1.1.7/test/pass_thru_decompressor_test.rb +15 -0
  103. data/lib/hotplate/gems/rubyzip-1.1.7/test/settings_test.rb +92 -0
  104. data/lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb +228 -0
  105. data/lib/hotplate/gems/rubyzip-1.1.7/test/unicode_file_names_and_comments_test.rb +52 -0
  106. data/lib/hotplate/gems/rubyzip-1.1.7/test/zip64_full_test.rb +53 -0
  107. data/lib/hotplate/gems/rubyzip-1.1.7/test/zip64_support_test.rb +15 -0
  108. data/lib/hotplate/java/build.gradle +38 -0
  109. data/lib/hotplate/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  110. data/lib/hotplate/java/gradle/wrapper/gradle-wrapper.properties +6 -0
  111. data/lib/hotplate/java/gradlew +164 -0
  112. data/lib/hotplate/java/gradlew.bat +90 -0
  113. data/lib/hotplate/java/template.java +25 -0
  114. data/lib/hotplate/version.rb +3 -0
  115. data/lib/hotplate.rb +2 -0
  116. metadata +186 -0
@@ -0,0 +1,62 @@
1
+ require 'test_helper'
2
+ require 'zip/filesystem'
3
+
4
+ class ZipFsDirIteratorTest < MiniTest::Test
5
+
6
+ FILENAME_ARRAY = [ "f1", "f2", "f3", "f4", "f5", "f6" ]
7
+
8
+ def setup
9
+ @dirIt = ::Zip::FileSystem::ZipFsDirIterator.new(FILENAME_ARRAY)
10
+ end
11
+
12
+ def test_close
13
+ @dirIt.close
14
+ assert_raises(IOError, "closed directory") {
15
+ @dirIt.each { |e| p e }
16
+ }
17
+ assert_raises(IOError, "closed directory") {
18
+ @dirIt.read
19
+ }
20
+ assert_raises(IOError, "closed directory") {
21
+ @dirIt.rewind
22
+ }
23
+ assert_raises(IOError, "closed directory") {
24
+ @dirIt.seek(0)
25
+ }
26
+ assert_raises(IOError, "closed directory") {
27
+ @dirIt.tell
28
+ }
29
+
30
+ end
31
+
32
+ def test_each
33
+ # Tested through Enumerable.entries
34
+ assert_equal(FILENAME_ARRAY, @dirIt.entries)
35
+ end
36
+
37
+ def test_read
38
+ FILENAME_ARRAY.size.times {
39
+ |i|
40
+ assert_equal(FILENAME_ARRAY[i], @dirIt.read)
41
+ }
42
+ end
43
+
44
+ def test_rewind
45
+ @dirIt.read
46
+ @dirIt.read
47
+ assert_equal(FILENAME_ARRAY[2], @dirIt.read)
48
+ @dirIt.rewind
49
+ assert_equal(FILENAME_ARRAY[0], @dirIt.read)
50
+ end
51
+
52
+ def test_tell_seek
53
+ @dirIt.read
54
+ @dirIt.read
55
+ pos = @dirIt.tell
56
+ valAtPos = @dirIt.read
57
+ @dirIt.read
58
+ @dirIt.seek(pos)
59
+ assert_equal(valAtPos, @dirIt.read)
60
+ end
61
+
62
+ end
@@ -0,0 +1,131 @@
1
+ require 'test_helper'
2
+ require 'zip/filesystem'
3
+
4
+ class ZipFsDirectoryTest < MiniTest::Test
5
+ TEST_ZIP = "test/data/generated/zipWithDirs_copy.zip"
6
+
7
+ def setup
8
+ FileUtils.cp("test/data/zipWithDirs.zip", TEST_ZIP)
9
+ end
10
+
11
+ def test_delete
12
+ ::Zip::File.open(TEST_ZIP) {
13
+ |zf|
14
+ assert_raises(Errno::ENOENT, "No such file or directory - NoSuchFile.txt") {
15
+ zf.dir.delete("NoSuchFile.txt")
16
+ }
17
+ assert_raises(Errno::EINVAL, "Invalid argument - file1") {
18
+ zf.dir.delete("file1")
19
+ }
20
+ assert(zf.file.exists?("dir1"))
21
+ zf.dir.delete("dir1")
22
+ assert(! zf.file.exists?("dir1"))
23
+ }
24
+ end
25
+
26
+ def test_mkdir
27
+ ::Zip::File.open(TEST_ZIP) {
28
+ |zf|
29
+ assert_raises(Errno::EEXIST, "File exists - dir1") {
30
+ zf.dir.mkdir("file1")
31
+ }
32
+ assert_raises(Errno::EEXIST, "File exists - dir1") {
33
+ zf.dir.mkdir("dir1")
34
+ }
35
+ assert(!zf.file.exists?("newDir"))
36
+ zf.dir.mkdir("newDir")
37
+ assert(zf.file.directory?("newDir"))
38
+ assert(!zf.file.exists?("newDir2"))
39
+ zf.dir.mkdir("newDir2", 3485)
40
+ assert(zf.file.directory?("newDir2"))
41
+ }
42
+ end
43
+
44
+ def test_pwd_chdir_entries
45
+ ::Zip::File.open(TEST_ZIP) {
46
+ |zf|
47
+ assert_equal("/", zf.dir.pwd)
48
+
49
+ assert_raises(Errno::ENOENT, "No such file or directory - no such dir") {
50
+ zf.dir.chdir "no such dir"
51
+ }
52
+
53
+ assert_raises(Errno::EINVAL, "Invalid argument - file1") {
54
+ zf.dir.chdir "file1"
55
+ }
56
+
57
+ assert_equal(["dir1", "dir2", "file1"].sort, zf.dir.entries(".").sort)
58
+ zf.dir.chdir "dir1"
59
+ assert_equal("/dir1", zf.dir.pwd)
60
+ assert_equal(["dir11", "file11", "file12"], zf.dir.entries(".").sort)
61
+
62
+ zf.dir.chdir "../dir2/dir21"
63
+ assert_equal("/dir2/dir21", zf.dir.pwd)
64
+ assert_equal(["dir221"].sort, zf.dir.entries(".").sort)
65
+ }
66
+ end
67
+
68
+ def test_foreach
69
+ ::Zip::File.open(TEST_ZIP) {
70
+ |zf|
71
+
72
+ blockCalled = false
73
+ assert_raises(Errno::ENOENT, "No such file or directory - noSuchDir") {
74
+ zf.dir.foreach("noSuchDir") { |e| blockCalled = true }
75
+ }
76
+ assert(! blockCalled)
77
+
78
+ assert_raises(Errno::ENOTDIR, "Not a directory - file1") {
79
+ zf.dir.foreach("file1") { |e| blockCalled = true }
80
+ }
81
+ assert(! blockCalled)
82
+
83
+ entries = []
84
+ zf.dir.foreach(".") { |e| entries << e }
85
+ assert_equal(["dir1", "dir2", "file1"].sort, entries.sort)
86
+
87
+ entries = []
88
+ zf.dir.foreach("dir1") { |e| entries << e }
89
+ assert_equal(["dir11", "file11", "file12"], entries.sort)
90
+ }
91
+ end
92
+
93
+ def test_chroot
94
+ ::Zip::File.open(TEST_ZIP) {
95
+ |zf|
96
+ assert_raises(NotImplementedError) {
97
+ zf.dir.chroot
98
+ }
99
+ }
100
+ end
101
+
102
+ # Globbing not supported yet
103
+ #def test_glob
104
+ # # test alias []-operator too
105
+ # fail "implement test"
106
+ #end
107
+
108
+ def test_open_new
109
+ ::Zip::File.open(TEST_ZIP) {
110
+ |zf|
111
+
112
+ assert_raises(Errno::ENOTDIR, "Not a directory - file1") {
113
+ zf.dir.new("file1")
114
+ }
115
+
116
+ assert_raises(Errno::ENOENT, "No such file or directory - noSuchFile") {
117
+ zf.dir.new("noSuchFile")
118
+ }
119
+
120
+ d = zf.dir.new(".")
121
+ assert_equal(["file1", "dir1", "dir2"].sort, d.entries.sort)
122
+ d.close
123
+
124
+ zf.dir.open("dir1") {
125
+ |dir|
126
+ assert_equal(["dir11", "file11", "file12"].sort, dir.entries.sort)
127
+ }
128
+ }
129
+ end
130
+
131
+ end
@@ -0,0 +1,100 @@
1
+ require 'test_helper'
2
+ require 'zip/filesystem'
3
+
4
+ class ZipFsFileMutatingTest < MiniTest::Test
5
+ TEST_ZIP = "test/data/generated/zipWithDirs_copy.zip"
6
+ def setup
7
+ FileUtils.cp("test/data/zipWithDirs.zip", TEST_ZIP)
8
+ end
9
+
10
+ def teardown
11
+ end
12
+
13
+ def test_delete
14
+ do_test_delete_or_unlink(:delete)
15
+ end
16
+
17
+ def test_unlink
18
+ do_test_delete_or_unlink(:unlink)
19
+ end
20
+
21
+ def test_open_write
22
+ ::Zip::File.open(TEST_ZIP) {
23
+ |zf|
24
+
25
+ zf.file.open("test_open_write_entry", "w") {
26
+ |f|
27
+ f.write "This is what I'm writing"
28
+ }
29
+ assert_equal("This is what I'm writing",
30
+ zf.file.read("test_open_write_entry"))
31
+
32
+ # Test with existing entry
33
+ zf.file.open("file1", "wb") { #also check that 'b' option is ignored
34
+ |f|
35
+ f.write "This is what I'm writing too"
36
+ }
37
+ assert_equal("This is what I'm writing too",
38
+ zf.file.read("file1"))
39
+ }
40
+ end
41
+
42
+ def test_rename
43
+ ::Zip::File.open(TEST_ZIP) {
44
+ |zf|
45
+ assert_raises(Errno::ENOENT, "") {
46
+ zf.file.rename("NoSuchFile", "bimse")
47
+ }
48
+ zf.file.rename("file1", "newNameForFile1")
49
+ }
50
+
51
+ ::Zip::File.open(TEST_ZIP) {
52
+ |zf|
53
+ assert(! zf.file.exists?("file1"))
54
+ assert(zf.file.exists?("newNameForFile1"))
55
+ }
56
+ end
57
+
58
+ def test_chmod
59
+ ::Zip::File.open(TEST_ZIP) {
60
+ |zf|
61
+
62
+ zf.file.chmod(0765, "file1")
63
+ }
64
+
65
+ ::Zip::File.open(TEST_ZIP) {
66
+ |zf|
67
+ assert_equal(0100765, zf.file.stat("file1").mode)
68
+ }
69
+ end
70
+
71
+ def do_test_delete_or_unlink(symbol)
72
+ ::Zip::File.open(TEST_ZIP) {
73
+ |zf|
74
+ assert(zf.file.exists?("dir2/dir21/dir221/file2221"))
75
+ zf.file.send(symbol, "dir2/dir21/dir221/file2221")
76
+ assert(! zf.file.exists?("dir2/dir21/dir221/file2221"))
77
+
78
+ assert(zf.file.exists?("dir1/file11"))
79
+ assert(zf.file.exists?("dir1/file12"))
80
+ zf.file.send(symbol, "dir1/file11", "dir1/file12")
81
+ assert(! zf.file.exists?("dir1/file11"))
82
+ assert(! zf.file.exists?("dir1/file12"))
83
+
84
+ assert_raises(Errno::ENOENT) { zf.file.send(symbol, "noSuchFile") }
85
+ assert_raises(Errno::EISDIR) { zf.file.send(symbol, "dir1/dir11") }
86
+ assert_raises(Errno::EISDIR) { zf.file.send(symbol, "dir1/dir11/") }
87
+ }
88
+
89
+ ::Zip::File.open(TEST_ZIP) {
90
+ |zf|
91
+ assert(! zf.file.exists?("dir2/dir21/dir221/file2221"))
92
+ assert(! zf.file.exists?("dir1/file11"))
93
+ assert(! zf.file.exists?("dir1/file12"))
94
+
95
+ assert(zf.file.exists?("dir1/dir11"))
96
+ assert(zf.file.exists?("dir1/dir11/"))
97
+ }
98
+ end
99
+
100
+ end