ruby-magic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,68 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ # :enddoc:
4
+
5
+ #
6
+ # ruby-magic.gemspec
7
+ #
8
+ # Copyright 2013-2014 Krzysztof Wilczynski
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ #
22
+
23
+ signing_key = File.expand_path('~/.gem/kwilczynski-private.pem')
24
+
25
+ Gem::Specification.new do |s|
26
+ s.name = 'ruby-magic'
27
+
28
+ s.description = <<-EOS
29
+ File Magic in Ruby.
30
+
31
+ Simple interface to libmagic for Ruby Programming Language.
32
+ EOS
33
+
34
+ s.platform = Gem::Platform::RUBY
35
+ s.version = File.read('VERSION').strip
36
+ s.license = 'Apache License, Version 2.0'
37
+ s.author = 'Krzysztof Wilczynski'
38
+ s.email = 'krzysztof.wilczynski@linux.com'
39
+ s.homepage = 'http://about.me/kwilczynski'
40
+
41
+ s.rubyforge_project = 'ruby-magic'
42
+ s.rubygems_version = '~> 2.2.0'
43
+ s.has_rdoc = true
44
+
45
+ s.summary = 'File Magic in Ruby'
46
+
47
+ s.files = Dir['ext/**/*.{c,h,rb}'] +
48
+ Dir['lib/**/*.rb'] +
49
+ Dir['benchmark/**/*.rb'] +
50
+ Dir['test/**/*.rb'] +
51
+ %w(Rakefile ruby-magic.gemspec AUTHORS
52
+ CHANGES CHANGES.rdoc COPYRIGHT LICENSE
53
+ README README.rdoc TODO VERSION)
54
+
55
+ s.executables << 'magic'
56
+ s.require_paths << 'lib'
57
+ s.extensions << 'ext/magic/extconf.rb'
58
+
59
+ s.add_development_dependency 'rake', '~> 10.1', '>= 10.1.1'
60
+ s.add_development_dependency 'rdoc', '~> 4.1', '>= 4.1.1'
61
+ s.add_development_dependency 'test-unit', '~> 2.5', '>= 2.5.5'
62
+ s.add_development_dependency 'rake-compiler', '~> 0.9', '>= 0.9.2'
63
+
64
+ s.signing_key = signing_key if File.exists?(signing_key)
65
+ end
66
+
67
+ # vim: set ts=2 sw=2 sts=2 et :
68
+ # encoding: utf-8
@@ -0,0 +1,47 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ # :enddoc:
4
+
5
+ #
6
+ # test_constants.rb
7
+ #
8
+ # Copyright 2013-2014 Krzysztof Wilczynski
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ #
22
+
23
+ begin
24
+ require 'coveralls'
25
+ Coveralls.wear!
26
+ rescue LoadError
27
+ STDERR.puts 'The Coveralls gem is not installed, skipping ...'
28
+ end
29
+
30
+ gem 'test-unit', '>= 2.5.2'
31
+
32
+ require 'test/unit'
33
+ require 'magic'
34
+
35
+ class MagicConstantsTest < Test::Unit::TestCase
36
+ def setup
37
+ end
38
+
39
+ def teardown
40
+ end
41
+
42
+ def test_constants
43
+ end
44
+ end
45
+
46
+ # vim: set ts=2 sw=2 sts=2 et :
47
+ # encoding: utf-8
@@ -0,0 +1,260 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ # :enddoc:
4
+
5
+ #
6
+ # test_magic.rb
7
+ #
8
+ # Copyright 2013-2014 Krzysztof Wilczynski
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ #
22
+
23
+ begin
24
+ require 'coveralls'
25
+ Coveralls.wear!
26
+ rescue LoadError
27
+ STDERR.puts 'The Coveralls gem is not installed, skipping ...'
28
+ end
29
+
30
+ gem 'test-unit', '>= 2.5.2'
31
+
32
+ require 'test/unit'
33
+ require 'magic'
34
+
35
+ DEFAULT_SINGLETON_METHODS = [
36
+ :open,
37
+ :mime,
38
+ :type,
39
+ :encoding,
40
+ :compile,
41
+ :check,
42
+ :version,
43
+ :version_to_a,
44
+ :version_to_s
45
+ ]
46
+
47
+ DEFAULT_INSTANCE_METHODS = [
48
+ :close,
49
+ :closed?,
50
+ :path,
51
+ :flags,
52
+ :flags_array,
53
+ :file,
54
+ :buffer,
55
+ :descriptor,
56
+ :load,
57
+ :compile,
58
+ :check
59
+ ]
60
+
61
+ DEFAULT_INTEGRATION_METHODS = [
62
+ :magic,
63
+ :mime,
64
+ :type
65
+ ]
66
+
67
+ class MagicTest < Test::Unit::TestCase
68
+ def setup
69
+ @magic = Magic.new
70
+ end
71
+
72
+ def teardown
73
+ @magic.close
74
+ end
75
+
76
+ def test_magic_alias
77
+ assert(FileMagic == Magic)
78
+ end
79
+
80
+ def test_magic_singleton_methods
81
+ assert_block do
82
+ DEFAULT_SINGLETON_METHODS.all? {|i| Magic.respond_to?(i) }
83
+ end
84
+ end
85
+
86
+ def test_magic_new_instance
87
+ assert(@magic.class == Magic)
88
+ end
89
+
90
+ def test_magic_instance_methods
91
+ assert_block do
92
+ DEFAULT_INSTANCE_METHODS.all? {|i| @magic.respond_to?(i) }
93
+ end
94
+ end
95
+
96
+ def test_magic_close
97
+ @magic.close
98
+
99
+ assert(@magic.closed?)
100
+ assert_raise Magic::LibraryError do
101
+ @magic.file('')
102
+ end
103
+ end
104
+
105
+ def test_magic_closed?
106
+ assert_equal(@magic.closed?, false)
107
+ @magic.close
108
+ assert_equal(@magic.closed?, true)
109
+ end
110
+
111
+ def test_magic_inspect
112
+ assert(@magic.inspect.match(%r{^#<Magic:0x.+>$}))
113
+ @magic.close
114
+ assert(@magic.inspect.match(%r{^#<Magic:0x.+ \(closed\)>$}))
115
+ end
116
+
117
+ def test_magic_path
118
+ end
119
+
120
+ def test_magic_path_MAGIC_environment_variable
121
+ end
122
+
123
+ def test_magic_flags
124
+ end
125
+
126
+ def test_magic_flags_to_a
127
+ end
128
+
129
+ def test_magic_file
130
+ end
131
+
132
+ def test_magic_file_with_MAGIC_CONTINUE_flag
133
+ end
134
+
135
+ def test_magic_buffer
136
+ end
137
+
138
+ def test_magic_buffer_with_MAGIC_CONTINUE_flag
139
+ end
140
+
141
+ def test_magic_descriptor
142
+ end
143
+
144
+ def test_magic_descriptor_with_MAGIC_CONTINUE_flag
145
+ end
146
+
147
+ def test_magic_load
148
+ end
149
+
150
+ def test_magic_load_MAGIC_environment_variable
151
+ end
152
+
153
+ def test_magic_check
154
+ end
155
+
156
+ def test_magic_valid?
157
+ end
158
+
159
+ def test_magic_compile
160
+ end
161
+
162
+ def test_magic_version
163
+ end
164
+
165
+ def test_magic_singleton_open
166
+ end
167
+
168
+ def test_magic_singleton_open_custom_flag
169
+ end
170
+
171
+ def test_magic_singleton_open_block
172
+ end
173
+
174
+ def test_magic_singleton_open_block_custom_flag
175
+ end
176
+
177
+ def test_magic_singleton_mime
178
+ end
179
+
180
+ def test_magic_singleton_mime_block
181
+ end
182
+
183
+ def test_magic_singleton_type
184
+ end
185
+
186
+ def test_magic_singleton_type_block
187
+ end
188
+
189
+ def test_magic_singleton_encoding
190
+ end
191
+
192
+ def test_magic_singleton_encoding_block
193
+ end
194
+
195
+ def test_magic_singleton_compile
196
+ end
197
+
198
+ def test_magic_singleton_check
199
+ end
200
+
201
+ def test_magic_flags_error
202
+ end
203
+
204
+ def test_magic_magic_error
205
+ end
206
+
207
+ def test_magic_library_error
208
+ end
209
+
210
+ def test_magic_new_instance_with_arguments
211
+ end
212
+
213
+ def test_file_integration
214
+ end
215
+
216
+ def test_file_integration_magic
217
+ end
218
+
219
+ def test_file_integration_magic_custom_flag
220
+ end
221
+
222
+ def test_file_integration_mime
223
+ end
224
+
225
+ def test_file_integration_type
226
+ end
227
+
228
+ def test_file_integration_singleton_magic
229
+ end
230
+
231
+ def test_file_integration_singleton_magic_custom_flag
232
+ end
233
+
234
+ def test_file_integration_singleton_mime
235
+ end
236
+
237
+ def test_file_integration_singleton_type
238
+ end
239
+
240
+ def test_string_integration
241
+ end
242
+
243
+ def test_string_integration_magic
244
+ end
245
+
246
+ def test_string_integration_magic_custom_flag
247
+ end
248
+
249
+ def test_string_integration_mime
250
+ end
251
+
252
+ def test_string_integration_type
253
+ end
254
+
255
+ def test_magic_mutex_unlocked
256
+ end
257
+ end
258
+
259
+ # vim: set ts=2 sw=2 sts=2 et :
260
+ # encoding: utf-8
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-magic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Krzysztof Wilczynski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-30 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: '10.1'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 10.1.1
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '10.1'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 10.1.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: rdoc
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '4.1'
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 4.1.1
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '4.1'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 4.1.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: test-unit
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: '2.5'
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 2.5.5
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '2.5'
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: 2.5.5
73
+ - !ruby/object:Gem::Dependency
74
+ name: rake-compiler
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '0.9'
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.2
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: 0.9.2
93
+ description: |
94
+ File Magic in Ruby.
95
+
96
+ Simple interface to libmagic for Ruby Programming Language.
97
+ email: krzysztof.wilczynski@linux.com
98
+ executables:
99
+ - magic
100
+ extensions:
101
+ - ext/magic/extconf.rb
102
+ extra_rdoc_files: []
103
+ files:
104
+ - AUTHORS
105
+ - CHANGES
106
+ - CHANGES.rdoc
107
+ - COPYRIGHT
108
+ - LICENSE
109
+ - README
110
+ - README.rdoc
111
+ - Rakefile
112
+ - TODO
113
+ - VERSION
114
+ - bin/magic
115
+ - ext/magic/common.h
116
+ - ext/magic/extconf.rb
117
+ - ext/magic/functions.c
118
+ - ext/magic/functions.h
119
+ - ext/magic/ruby-magic.c
120
+ - ext/magic/ruby-magic.h
121
+ - lib/magic.rb
122
+ - lib/magic/core/file.rb
123
+ - lib/magic/core/string.rb
124
+ - lib/magic/version.rb
125
+ - ruby-magic.gemspec
126
+ - test/test_constants.rb
127
+ - test/test_magic.rb
128
+ homepage: http://about.me/kwilczynski
129
+ licenses:
130
+ - Apache License, Version 2.0
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project: ruby-magic
149
+ rubygems_version: 2.2.2
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: File Magic in Ruby
153
+ test_files: []