mpcat 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a718ead7b55931b02eaf0f5a90feec9e69ed5d8b
4
+ data.tar.gz: f1a09882ab4cce647279cdfc539e784dff41788a
5
+ SHA512:
6
+ metadata.gz: 4eeffe0a9e026c4de3c2016eae78917b3357508b87bca7753c1ce475c4f4739013abb731ff9299e52ad16d4bb14edab9006c03344407cdac3c88fea966d3ab77
7
+ data.tar.gz: cf71813fe1f13e8c1328f526b761b34ff9a5c92a98d901165ba841917e56284da2d03704a1b1e6a2c8f8570f1fe7c1fe62adb37dae031d673deda11a3bf4d2d4
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ before_install:
5
+ - ruby --version
6
+ script:
7
+ - make test
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+
2
+ source 'https://rubygems.org'
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mpcat (0.1.0)
5
+ msgpack (~> 0.7)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ msgpack (0.7.1)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.10)
17
+ mpcat!
18
+
19
+ BUNDLED WITH
20
+ 1.10.2
data/Makefile ADDED
@@ -0,0 +1,8 @@
1
+
2
+ GEM_NAME = mpcat
3
+
4
+ include Makefile.common
5
+
6
+ .PHONY: test
7
+ test:
8
+ RUBYOPT=-w ./bin/mpcat tests/test1.mp
data/Makefile.common ADDED
@@ -0,0 +1,51 @@
1
+
2
+ # Ruby Common Big
3
+ # 2015-12-15
4
+
5
+ MV = mv -nv
6
+ RM = rm -rf
7
+ MKDIR = mkdir -p
8
+ BUNDLER = bundle
9
+ BUNDLER_OPTIONS = --jobs=5 --retry=3
10
+ GEMSPEC_FILE = $(GEM_NAME).gemspec
11
+
12
+ .PHONY: all $(ALL_TARGETS_EXT)
13
+ all: setup
14
+
15
+ .PHONY: setup
16
+ setup: .setup
17
+
18
+ .setup:
19
+ $(BUNDLER) install $(BUNDLER_OPTIONS)
20
+ touch $@
21
+
22
+ .PHONY: install
23
+ install:
24
+ gem_file=$$(gem build $(GEMSPEC_FILE) | grep 'File:' | tail -1 | awk '{ print $$2 }'); \
25
+ sudo gem install $$gem_file; \
26
+ $(RM) $$gem_file
27
+
28
+ .PHONY: uninstall
29
+ uninstall:
30
+ sudo gem uninstall $(GEM_NAME)
31
+
32
+ .PHONY: update
33
+ update:
34
+ $(BUNDLER) update
35
+
36
+ .PHONY: clean
37
+ clean:
38
+ $(RM) .setup
39
+
40
+ .PHONY: release
41
+ release: | releases
42
+ set -e; \
43
+ gem_file=$$(gem build $(GEMSPEC_FILE) | grep 'File:' | tail -1 | awk '{ print $$2 }'); \
44
+ dst="releases/$$gem_file"; \
45
+ [ ! -f $$dst ]; \
46
+ $(MV) $$gem_file releases; \
47
+ gem push $$dst; \
48
+ echo 'done'
49
+
50
+ releases:
51
+ $(MKDIR) $@
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # MessagePack Cat
2
+
3
+ Convert [MessagePack](http://msgpack.org/)-files to [YAML](http://yaml.org/).
4
+
5
+ This tool is actually a side product of [One Shall Pass](https://github.com/TheFox/osp).
6
+
7
+ ## Install
8
+
9
+ The preferred method of installation is via RubyGems.org:
10
+ https://rubygems.org/gems/mpcat
11
+
12
+ gem install mpcat
13
+
14
+ or via Gemfile:
15
+
16
+ gem 'mpcat', '~>0.1'
17
+
18
+ ## Project Links
19
+
20
+ - [Gem](https://rubygems.org/gems/mpcat)
21
+ - [Travis CI Repository](https://travis-ci.org/TheFox/mpcat)
22
+
23
+ ## Weblinks
24
+
25
+ - [MessagePack](http://msgpack.org/)
26
+ - [YAML](http://yaml.org/)
27
+
28
+ ## License
29
+ Copyright (C) 2015 Christian Mayer <http://fox21.at>
30
+
31
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
32
+
33
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
data/bin/mpcat ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: UTF-8
3
+
4
+ raise 'Ruby >=2.2 required' unless RUBY_VERSION >= '2.2.0'
5
+
6
+ require 'optparse'
7
+ require 'yaml'
8
+ require 'pp'
9
+
10
+ require 'bundler/setup'
11
+ require 'msgpack'
12
+
13
+
14
+ options = {
15
+ :path => nil,
16
+ :yaml => true,
17
+ }
18
+ opts = OptionParser.new do |o|
19
+ o.banner = 'Usage: mpcat [--no-yaml] <files...>'
20
+ o.separator('')
21
+
22
+ # o.on('-p', '--path <path>', 'Path msgpack file.') do |path|
23
+ # options[:path] = path
24
+ # end
25
+
26
+ o.on('--no-yaml', 'Do not use YAML as output format.') do
27
+ options[:yaml] = false
28
+ end
29
+
30
+ o.on_tail('-h', '--help', 'Show this message.') do
31
+ puts o
32
+ puts
33
+ exit 3
34
+ end
35
+ end
36
+ #ARGV << '-h' if ARGV.count == 0
37
+ args = opts.parse(ARGV)
38
+
39
+ if args.count > 0
40
+ options[:path] = args.shift
41
+
42
+ if !options[:path].nil?
43
+ ar = MessagePack.unpack(File.binread(options[:path]))
44
+
45
+ if options[:yaml]
46
+ print YAML.dump(ar)
47
+ else
48
+ pp ar
49
+ end
50
+ else
51
+ raise 'FATAL ERROR: path invalid.'
52
+ end
53
+ else
54
+ opts.parse(['-h'])
55
+ end
56
+
data/mpcat.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: UTF-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'mpcat'
5
+ spec.version = '0.1.0'
6
+ spec.date = '2015-12-18'
7
+ spec.author = 'Christian Mayer'
8
+ spec.email = 'christian@fox21.at'
9
+
10
+ spec.summary = %q{MessagePack Cat}
11
+ spec.description = %q{Pretty print for MessagePack files.}
12
+ spec.homepage = 'https://github.com/TheFox/mpcat'
13
+ spec.license = 'GPL-3.0'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject{ |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = 'bin'
17
+ spec.executables = ['mpcat']
18
+ spec.required_ruby_version = '>=2.2.0'
19
+
20
+ spec.add_development_dependency 'bundler', '~>1.10'
21
+
22
+ spec.add_dependency 'msgpack', '~>0.7'
23
+ end
@@ -0,0 +1,10 @@
1
+ {
2
+ "folders":[
3
+ {
4
+ "path": ".",
5
+ "name": "mpcat",
6
+ "folder_exclude_patterns": [ ],
7
+ "file_exclude_patterns": [ ]
8
+ }
9
+ ]
10
+ }
data/tests/test1.mp ADDED
@@ -0,0 +1 @@
1
+ ��h1��a�b�c�*
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mpcat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christian Mayer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: msgpack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.7'
41
+ description: Pretty print for MessagePack files.
42
+ email: christian@fox21.at
43
+ executables:
44
+ - mpcat
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".travis.yml"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - Makefile
52
+ - Makefile.common
53
+ - README.md
54
+ - bin/mpcat
55
+ - mpcat.gemspec
56
+ - mpcat.sublime-project
57
+ - tests/test1.mp
58
+ homepage: https://github.com/TheFox/mpcat
59
+ licenses:
60
+ - GPL-3.0
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 2.2.0
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.4.7
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: MessagePack Cat
82
+ test_files: []
83
+ has_rdoc: