jsonpretty 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/History.txt +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +1 -25
- data/{bin → exe}/jsonpretty +0 -0
- data/jsonpretty.gemspec +28 -0
- data/lib/jsonpretty/version.rb +3 -0
- data/lib/jsonpretty.rb +4 -6
- metadata +62 -42
- data/README.txt +0 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6775c26c6b8185ac435b1b62bc5433eeec5a226ed96a13c45309a19202d85d03
|
4
|
+
data.tar.gz: 9fadc1f02b65c3a748c6c4c82c9f1d9e2f790d9223af9e46a03a429e2f960040
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2ec75e36203be4d6e373a5fbec2802d2281dc622403339810c5fd7841c0080c138de6c393e0d9683534ce7f7e47f902fc881b56e09e0fce23358920831ac693d
|
7
|
+
data.tar.gz: f8fc3084248da34422d4312ec7b21a781632be9ebc701d89fa862680c8537bac5948f29f77d317d5341affdd584e281db1595840eaa8a978809ed02e5439ec13
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at nick@nicksieger.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/History.txt
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2007-2021 Nick Sieger <nick@nicksieger.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# jsonpretty
|
2
|
+
|
3
|
+
- http://github.com/nicksieger/jsonpretty
|
4
|
+
|
5
|
+
## DESCRIPTION
|
6
|
+
|
7
|
+
Command-line JSON pretty-printer, using the json gem.
|
8
|
+
|
9
|
+
## FEATURES/PROBLEMS
|
10
|
+
|
11
|
+
- Parse and pretty-print JSON/JSONP either from stdin or from command-line
|
12
|
+
arguments.
|
13
|
+
- All arguments are concatenated together in a single string for
|
14
|
+
pretty-printing.
|
15
|
+
- Use '@filename' as an argument to include the contents of the file.
|
16
|
+
- Use '-' or '@-' as an argument (or use no arguments) to read stdin.
|
17
|
+
- Detects HTTP response/headers, prints them untouched, and skips to
|
18
|
+
the body (for use with `curl -i').
|
19
|
+
|
20
|
+
## SYNOPSIS
|
21
|
+
|
22
|
+
```
|
23
|
+
curl -i http://api.com/json | jsonpretty
|
24
|
+
```
|
25
|
+
|
26
|
+
## REQUIREMENTS
|
27
|
+
|
28
|
+
json or json_pure
|
29
|
+
|
30
|
+
## INSTALL
|
31
|
+
|
32
|
+
```
|
33
|
+
gem install jsonpretty
|
34
|
+
```
|
35
|
+
|
36
|
+
or install globally with brew-gem:
|
37
|
+
|
38
|
+
```
|
39
|
+
brew install brew-gem
|
40
|
+
brew gem install jsonpretty
|
41
|
+
```
|
42
|
+
|
43
|
+
## LICENSE
|
44
|
+
|
45
|
+
See [LICENSE](LICENSE).
|
data/Rakefile
CHANGED
@@ -1,28 +1,4 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
require
|
4
|
-
require 'hoe'
|
5
|
-
require './lib/jsonpretty.rb'
|
3
|
+
require "bundler/gem_tasks"
|
6
4
|
|
7
|
-
h = Hoe.new('jsonpretty', Jsonpretty::VERSION) do |p|
|
8
|
-
p.rubyforge_name = 'caldersphere'
|
9
|
-
p.developer('Nick Sieger', 'nick@nicksieger.com')
|
10
|
-
p.url = 'http://github.com/nicksieger/jsonpretty'
|
11
|
-
p.extra_deps << ['json', '> 0'] if ENV["VERSION"]
|
12
|
-
end
|
13
|
-
spec = h.spec
|
14
|
-
spec.dependencies.delete_if { |dep| dep.name == "hoe" }
|
15
|
-
def spec.to_ruby
|
16
|
-
additional_src = %{
|
17
|
-
if defined?(JRUBY_VERSION)
|
18
|
-
s.add_dependency('json_pure', '> 0')
|
19
|
-
else
|
20
|
-
s.add_dependency('json', '> 0')
|
21
|
-
end
|
22
|
-
}
|
23
|
-
super.sub(/end\n\Z/m, "#{additional_src}\nend\n")
|
24
|
-
end
|
25
|
-
|
26
|
-
task :gemspec do
|
27
|
-
File.open("jsonpretty.gemspec", "w") {|f| f << spec.to_ruby }
|
28
|
-
end
|
data/{bin → exe}/jsonpretty
RENAMED
File without changes
|
data/jsonpretty.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "jsonpretty/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jsonpretty"
|
8
|
+
spec.version = Jsonpretty::VERSION
|
9
|
+
spec.authors = ["Nick Sieger"]
|
10
|
+
spec.email = ["nick@nicksieger.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Command-line JSON pretty-printer, using the json gem.}
|
13
|
+
spec.description = %q{Command-line JSON pretty-printer, using the json gem.}
|
14
|
+
spec.homepage = %q{http://github.com/nicksieger/jsonpretty}
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
end
|
data/lib/jsonpretty.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
class Jsonpretty
|
4
|
-
VERSION = '1.1.0'
|
5
|
-
|
6
4
|
def file_value(filename)
|
7
5
|
file = if filename == '-'
|
8
6
|
$stdin
|
@@ -10,7 +8,7 @@ class Jsonpretty
|
|
10
8
|
File.open(filename)
|
11
9
|
end
|
12
10
|
lines = file.readlines
|
13
|
-
if lines.first =~ /^HTTP
|
11
|
+
if lines.first =~ /^HTTP\/\d)/ # looks like an HTTP response; we just want the body
|
14
12
|
index = lines.index("\r\n") || lines.index("\n")
|
15
13
|
puts lines[0..index]
|
16
14
|
lines[(index+1)..-1].join('')
|
@@ -24,7 +22,7 @@ class Jsonpretty
|
|
24
22
|
def stdin_value
|
25
23
|
file_value('-')
|
26
24
|
end
|
27
|
-
|
25
|
+
|
28
26
|
def clean_jsonp(input_string)
|
29
27
|
match = input_string.match(/^(.+)\((.+)\)$/)
|
30
28
|
if match
|
@@ -34,7 +32,7 @@ class Jsonpretty
|
|
34
32
|
input_string
|
35
33
|
end
|
36
34
|
end
|
37
|
-
|
35
|
+
|
38
36
|
def main
|
39
37
|
if ARGV.length == 0
|
40
38
|
ARGV.unshift stdin_value
|
@@ -57,7 +55,7 @@ class Jsonpretty
|
|
57
55
|
end
|
58
56
|
end
|
59
57
|
end
|
60
|
-
|
58
|
+
|
61
59
|
input = clean_jsonp(ARGV.join(' '))
|
62
60
|
json = JSON.parse(input)
|
63
61
|
puts JSON.pretty_generate(json)
|
metadata
CHANGED
@@ -1,64 +1,84 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonpretty
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Nick Sieger
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
date: 2021-12-17 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.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
16
41
|
description: Command-line JSON pretty-printer, using the json gem.
|
17
|
-
email:
|
42
|
+
email:
|
18
43
|
- nick@nicksieger.com
|
19
|
-
executables:
|
44
|
+
executables:
|
20
45
|
- jsonpretty
|
21
46
|
extensions: []
|
22
|
-
|
23
|
-
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- CODE_OF_CONDUCT.md
|
51
|
+
- Gemfile
|
24
52
|
- History.txt
|
53
|
+
- LICENSE.txt
|
25
54
|
- Manifest.txt
|
26
|
-
- README.
|
27
|
-
files:
|
28
|
-
- History.txt
|
29
|
-
- Manifest.txt
|
30
|
-
- README.txt
|
55
|
+
- README.md
|
31
56
|
- Rakefile
|
32
|
-
-
|
57
|
+
- exe/jsonpretty
|
58
|
+
- jsonpretty.gemspec
|
33
59
|
- lib/jsonpretty.rb
|
34
|
-
|
60
|
+
- lib/jsonpretty/version.rb
|
35
61
|
homepage: http://github.com/nicksieger/jsonpretty
|
36
|
-
licenses:
|
37
|
-
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
38
65
|
post_install_message:
|
39
|
-
rdoc_options:
|
40
|
-
|
41
|
-
- README.txt
|
42
|
-
require_paths:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
43
68
|
- lib
|
44
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
46
71
|
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
-
|
50
|
-
|
51
|
-
requirements:
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
52
76
|
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
version:
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
56
79
|
requirements: []
|
57
|
-
|
58
|
-
rubyforge_project: caldersphere
|
59
|
-
rubygems_version: 1.3.5
|
80
|
+
rubygems_version: 3.0.3.1
|
60
81
|
signing_key:
|
61
|
-
specification_version:
|
82
|
+
specification_version: 4
|
62
83
|
summary: Command-line JSON pretty-printer, using the json gem.
|
63
84
|
test_files: []
|
64
|
-
|
data/README.txt
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
= jsonpretty
|
2
|
-
|
3
|
-
* http://github.com/nicksieger/jsonpretty
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
Command-line JSON pretty-printer, using the json gem.
|
8
|
-
|
9
|
-
== FEATURES/PROBLEMS:
|
10
|
-
|
11
|
-
- Parse and pretty-print JSON/JSONP either from stdin or from command-line
|
12
|
-
arguments.
|
13
|
-
- All arguments are concatenated together in a single string for
|
14
|
-
pretty-printing.
|
15
|
-
- Use '@filename' as an argument to include the contents of the file.
|
16
|
-
- Use '-' or '@-' as an argument (or use no arguments) to read stdin.
|
17
|
-
- Detects HTTP response/headers, prints them untouched, and skips to
|
18
|
-
the body (for use with `curl -i').
|
19
|
-
|
20
|
-
== SYNOPSIS:
|
21
|
-
|
22
|
-
|
23
|
-
== REQUIREMENTS:
|
24
|
-
|
25
|
-
json or json_pure
|
26
|
-
|
27
|
-
== INSTALL:
|
28
|
-
|
29
|
-
gem install jsonpretty
|
30
|
-
|
31
|
-
== LICENSE:
|
32
|
-
|
33
|
-
(The MIT License)
|
34
|
-
|
35
|
-
Copyright (c) 2007-2009 Nick Sieger <nick@nicksieger.com>
|
36
|
-
|
37
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
38
|
-
a copy of this software and associated documentation files (the
|
39
|
-
'Software'), to deal in the Software without restriction, including
|
40
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
41
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
42
|
-
permit persons to whom the Software is furnished to do so, subject to
|
43
|
-
the following conditions:
|
44
|
-
|
45
|
-
The above copyright notice and this permission notice shall be
|
46
|
-
included in all copies or substantial portions of the Software.
|
47
|
-
|
48
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
49
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
50
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
51
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
52
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
53
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
54
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|