mimetype-xml 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/README.md +76 -2
- data/bin/mimetype-xml +1 -0
- data/lib/mimetype_xml.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f3e79194d0fef31b28e1f54d678533b39733cd
|
4
|
+
data.tar.gz: 7ba741ff3e85e93cc14564dd37d23ed838cc994d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a7feb2cd9eba3ab98e05f4fdf4dc9cfa70d58110924fd3a18870236141434dcc0b2f73be284c652c99cffe990b8301e2e42e91cabb7926611a10ed10babf5c4
|
7
|
+
data.tar.gz: 7e91383ec462db8c3b7f4e0b4db94ad95e714d3a5e00fa5a9351313de71f9f21a180150e133f5a14f2a8593e73abb91613c865aaf9526a9763bd1697e5e3292e
|
data/README.md
CHANGED
@@ -1,2 +1,76 @@
|
|
1
|
-
#
|
2
|
-
Custom mimetype from TOML to XML
|
1
|
+
# MimetypeXML
|
2
|
+
> Custom mimetype from TOML to XML
|
3
|
+
|
4
|
+
## Install
|
5
|
+
|
6
|
+
- You need Ruby and Gems (gems comes with ruby)
|
7
|
+
Install this gem with
|
8
|
+
```shell
|
9
|
+
gem install mimetype-xml
|
10
|
+
|
11
|
+
# You might want to run this with sudo,
|
12
|
+
# or add the Gem userdir to the beginning of your $PATH variable
|
13
|
+
# like so in your bashrc: `PATH=$(ruby -e 'print Gem.user_dir')/bin:$PATH`
|
14
|
+
# This depends on your platform.
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
Create the TOML config (`./custom-mime.toml`):
|
19
|
+
```toml
|
20
|
+
## CUSTOM MIMETYPES TOML CONFIG FILE ##
|
21
|
+
# Optional variables ard marked with `(opt.)` in a
|
22
|
+
# comment at the end of the line
|
23
|
+
|
24
|
+
# Add mimetype for elixir files
|
25
|
+
[x-application-elixir]
|
26
|
+
|
27
|
+
type = "application/x-elixir"
|
28
|
+
pattern = ["*.ex", "*.exs"] # Always in an array
|
29
|
+
# (even if only one pattern, e.g. ["*.ext"])
|
30
|
+
|
31
|
+
comment = "Elixir File" # Default language
|
32
|
+
comment_lang = [ ["no", "Elixir Fil"], ["la", "Ordo Elixir"] ] # etc. (opt.)
|
33
|
+
|
34
|
+
icon = "mimetypes/application-x-elixir.svg"
|
35
|
+
size = 48 # I don't really know
|
36
|
+
|
37
|
+
xml_file = "elixir-file-mimetype.xml" # (opt.), not useful...
|
38
|
+
|
39
|
+
|
40
|
+
# Another for crystal files
|
41
|
+
|
42
|
+
[x-application-crystal]
|
43
|
+
type = "application/x-crystal"
|
44
|
+
pattern = [".cr"]
|
45
|
+
comment = "Crystal File"
|
46
|
+
icon = "mimetypes/application-x-crystal.svg"
|
47
|
+
size = 48
|
48
|
+
|
49
|
+
# That simple to add new mimetypes, just make the icon in the
|
50
|
+
# path specified in the `icon` variable.
|
51
|
+
# e.g. 'mimetypes/appliaction-x-myfile.svg'
|
52
|
+
```
|
53
|
+
|
54
|
+
Then generate the xml files and install it through a ruby script (`./generate-mimetypes.rb`):
|
55
|
+
```ruby
|
56
|
+
require 'mimetype_xml'
|
57
|
+
require 'toml' # `toml` comes with this gem (`mimetype_xml`)
|
58
|
+
|
59
|
+
xml = MimetypeXML::Generate.toml_file(
|
60
|
+
:file => './custom-mime.toml', # The location of the TOML config
|
61
|
+
:xml_dir => './.xml', # Choose somewhere, make sure the dir exists
|
62
|
+
:icon_pack => '~/.icons/YOUR_ICON_PACK' # Replace this with the install dir of your iconpack
|
63
|
+
)
|
64
|
+
|
65
|
+
files = xml.write_files
|
66
|
+
files.install
|
67
|
+
```
|
68
|
+
|
69
|
+
Then run the script from your shell:
|
70
|
+
```shell
|
71
|
+
ruby ./generate-mimetypes.rb
|
72
|
+
```
|
73
|
+
|
74
|
+
---
|
75
|
+
|
76
|
+
The binary file doesn't do anything at the moment.
|
data/bin/mimetype-xml
CHANGED
data/lib/mimetype_xml.rb
CHANGED
@@ -6,7 +6,7 @@ require_relative 'mimetype_xml/xml'
|
|
6
6
|
require_relative 'mimetype_xml/generate'
|
7
7
|
|
8
8
|
module MimetypeXML
|
9
|
-
VERSIONS = { :major => 1, :minor => 1, :tiny =>
|
9
|
+
VERSIONS = { :major => 1, :minor => 1, :tiny => 2 }
|
10
10
|
|
11
11
|
def self.version *args
|
12
12
|
VERSIONS.flatten.select.with_index { |val, i| i.odd? }.join '.'
|