├── VERSION ├── .document ├── Gemfile ├── bin └── json_formatter ├── Gemfile.lock ├── README.rdoc ├── .gitignore ├── LICENSE.txt ├── Rakefile └── json_formatter.gemspec /VERSION: -------------------------------------------------------------------------------- 1 | 0.1.0 -------------------------------------------------------------------------------- /.document: -------------------------------------------------------------------------------- 1 | lib/**/*.rb 2 | bin/* 3 | - 4 | features/**/*.feature 5 | LICENSE.txt 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem 'json' 4 | 5 | group :development do 6 | gem "jeweler", "~> 1.6.4" 7 | gem 'rcov' 8 | end 9 | -------------------------------------------------------------------------------- /bin/json_formatter: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | json = ARGV.first || ARGF.read 4 | 5 | puts "Usage: json_formatter 'json string'" unless json 6 | 7 | puts JSON.pretty_generate(JSON.parse(json)) rescue "Error parsing JSON 8 | string" 9 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | git (1.2.5) 5 | jeweler (1.6.4) 6 | bundler (~> 1.0) 7 | git (>= 1.2.5) 8 | rake 9 | json (1.6.3) 10 | rake (0.9.2.2) 11 | rcov (0.9.8) 12 | 13 | PLATFORMS 14 | ruby 15 | 16 | DEPENDENCIES 17 | jeweler (~> 1.6.4) 18 | json 19 | rcov 20 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = json_formatter 2 | 3 | Simple json formatting from your command line. 4 | 5 | Installation: 6 | 7 | gem install json_formatter 8 | 9 | Example: 10 | 11 | curl http://example.com | json_formatter 12 | 13 | or 14 | 15 | json_formatter "{}" 16 | 17 | == Copyright 18 | 19 | Copyright (c) 2011 Oscar Del Ben. See LICENSE.txt for 20 | further details. 21 | 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # rcov generated 2 | coverage 3 | 4 | # rdoc generated 5 | rdoc 6 | 7 | # yard generated 8 | doc 9 | .yardoc 10 | 11 | # bundler 12 | .bundle 13 | 14 | # jeweler generated 15 | pkg 16 | 17 | # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: 18 | # 19 | # * Create a file at ~/.gitignore 20 | # * Include files you want ignored 21 | # * Run: git config --global core.excludesfile ~/.gitignore 22 | # 23 | # After doing this, these files will be ignored in all your git projects, 24 | # saving you from having to 'pollute' every project you touch with them 25 | # 26 | # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) 27 | # 28 | # For MacOS: 29 | # 30 | #.DS_Store 31 | 32 | # For TextMate 33 | #*.tmproj 34 | #tmtags 35 | 36 | # For emacs: 37 | #*~ 38 | #\#* 39 | #.\#* 40 | 41 | # For vim: 42 | #*.swp 43 | 44 | # For redcar: 45 | #.redcar 46 | 47 | # For rubinius: 48 | #*.rbc 49 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Oscar Del Ben 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'rubygems' 4 | require 'bundler' 5 | begin 6 | Bundler.setup(:default, :development) 7 | rescue Bundler::BundlerError => e 8 | $stderr.puts e.message 9 | $stderr.puts "Run `bundle install` to install missing gems" 10 | exit e.status_code 11 | end 12 | require 'rake' 13 | 14 | require 'jeweler' 15 | Jeweler::Tasks.new do |gem| 16 | # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options 17 | gem.name = "json_formatter" 18 | gem.homepage = "http://github.com/oscardelben/json_formatter" 19 | gem.license = "MIT" 20 | gem.summary = %Q{Simple JSON formatting from your command line} 21 | gem.description = %Q{} 22 | gem.email = "info@oscardelben.com" 23 | gem.authors = ["Oscar Del Ben"] 24 | # dependencies defined in Gemfile 25 | end 26 | Jeweler::RubygemsDotOrgTasks.new 27 | 28 | require 'rake/testtask' 29 | Rake::TestTask.new(:test) do |test| 30 | test.libs << 'lib' << 'test' 31 | test.pattern = 'test/**/test_*.rb' 32 | test.verbose = true 33 | end 34 | 35 | require 'rcov/rcovtask' 36 | Rcov::RcovTask.new do |test| 37 | test.libs << 'test' 38 | test.pattern = 'test/**/test_*.rb' 39 | test.verbose = true 40 | test.rcov_opts << '--exclude "gems/*"' 41 | end 42 | 43 | task :default => :test 44 | 45 | require 'rake/rdoctask' 46 | Rake::RDocTask.new do |rdoc| 47 | version = File.exist?('VERSION') ? File.read('VERSION') : "" 48 | 49 | rdoc.rdoc_dir = 'rdoc' 50 | rdoc.title = "json_formatter #{version}" 51 | rdoc.rdoc_files.include('README*') 52 | rdoc.rdoc_files.include('lib/**/*.rb') 53 | end 54 | -------------------------------------------------------------------------------- /json_formatter.gemspec: -------------------------------------------------------------------------------- 1 | # Generated by jeweler 2 | # DO NOT EDIT THIS FILE DIRECTLY 3 | # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' 4 | # -*- encoding: utf-8 -*- 5 | 6 | Gem::Specification.new do |s| 7 | s.name = "json_formatter" 8 | s.version = "0.1.0" 9 | 10 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 11 | s.authors = ["Oscar Del Ben"] 12 | s.date = "2011-12-09" 13 | s.description = "" 14 | s.email = "info@oscardelben.com" 15 | s.executables = ["json_formatter"] 16 | s.extra_rdoc_files = [ 17 | "LICENSE.txt", 18 | "README.rdoc" 19 | ] 20 | s.files = [ 21 | ".document", 22 | "Gemfile", 23 | "Gemfile.lock", 24 | "LICENSE.txt", 25 | "README.rdoc", 26 | "Rakefile", 27 | "VERSION", 28 | "bin/json_formatter" 29 | ] 30 | s.homepage = "http://github.com/oscardelben/json_formatter" 31 | s.licenses = ["MIT"] 32 | s.require_paths = ["lib"] 33 | s.rubygems_version = "1.8.10" 34 | s.summary = "Simple JSON formatting from your command line" 35 | 36 | if s.respond_to? :specification_version then 37 | s.specification_version = 3 38 | 39 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then 40 | s.add_runtime_dependency(%q, [">= 0"]) 41 | s.add_development_dependency(%q, ["~> 1.6.4"]) 42 | s.add_development_dependency(%q, [">= 0"]) 43 | else 44 | s.add_dependency(%q, [">= 0"]) 45 | s.add_dependency(%q, ["~> 1.6.4"]) 46 | s.add_dependency(%q, [">= 0"]) 47 | end 48 | else 49 | s.add_dependency(%q, [">= 0"]) 50 | s.add_dependency(%q, ["~> 1.6.4"]) 51 | s.add_dependency(%q, [">= 0"]) 52 | end 53 | end 54 | 55 | --------------------------------------------------------------------------------