[
  {
    "path": ".travis.yml",
    "content": "language: ruby\nrvm:\n  - 1.9.3\n"
  },
  {
    "path": "MIT-LICENSE",
    "content": "Copyright (C) 2012 Xavier Noria\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
  },
  {
    "path": "README.md",
    "content": "# I Told You it Was Private\n\nWhen you, beloved library author, remove private methods, praise and glory should\ncome in hordes for gardening your code with such dedication and pursuit of\npristine end-user interfaces and overall library perfection.\n\nWhat you face instead is hordes of complaints because some frickin lazy people\ncall themselves rebels, resist any kind of authority, and have access to the\nsource code, so to the hell with the contract, they say.\n\nEnough diplomacy, the time for punishment has arrived! This library will put\nthose losers in their place:\n\n    class Awesome\n      i_told_you_it_was_private :gone_method\n    end\n\nAnd contemplate your **revenge**.\n\n## Quality Badge\n\nThis badge guarantees superior quality:\n\n![Superior Quality Badge](http://img.shields.io/badge/wadus-chaflan-brightgreen.svg)\n\n## License\n\nReleased under the MIT License, Copyright (c) 2012–<i>ω</i> Xavier Noria.\n"
  },
  {
    "path": "Rakefile",
    "content": "require 'rake/testtask'\n\ntask :default => :test\n\nRake::TestTask.new do |t|\n  t.pattern = 'test/*_test.rb'\n  t.ruby_opts = %w(-rminitest/pride)\nend\n"
  },
  {
    "path": "i-told-you-it-was-private.gemspec",
    "content": "Gem::Specification.new do |spec|\n  spec.name     = 'i-told-you-it-was-private'\n  spec.version  = '1.0'\n  spec.summary  = 'Enough diplomacy, is time for punishment!'\n  spec.homepage = 'http://github.com/fxn/i-told-you-it-was-private'\n  spec.author   = 'Xavier Noria'\n  spec.email    = 'fxn@hashref.com'\n\n  spec.test_files = Dir['test/*_test.rb']\n\n  spec.files = %w(\n    i-told-you-it-was-private.gemspec\n    Rakefile\n    README.md\n    MIT-LICENSE\n  ) + Dir['lib/*.rb'] + spec.test_files\nend"
  },
  {
    "path": "lib/i-told-you-it-was-private.rb",
    "content": "require 'fileutils'\n\nModule.class_eval do\n  def i_told_you_it_was_private(*methods)\n    methods.each do |method|\n      define_method(method) do |*args, &block|\n        offender = caller_locations(1, 1).first.absolute_path.to_s\n        FileUtils.rm_f(offender)\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "test/punishes_offenders_test.rb",
    "content": "require 'minitest/unit'\nrequire 'minitest/autorun'\nrequire 'fileutils'\nrequire 'i-told-you-it-was-private'\n\nclass C\n  i_told_you_it_was_private :p\nend\n\nclass TestPunishment < MiniTest::Unit::TestCase\n  def test_punishes_offenders\n    Dir.chdir(File.dirname(__FILE__)) do\n      File.write('offender.rb', 'C.new.p')\n      load 'offender.rb'\n      assert !File.exist?('offender.rb')\n    end\n  end\n\n  def test_punished_offenders_another_level\n    Dir.chdir(File.dirname(__FILE__)) do\n      File.write('offender.rb', <<-EOS)\n        class D\n          def p\n            C.new.p\n          end\n        end\n      EOS\n      File.write('poor_guy.rb', 'D.new.p')\n\n      load 'offender.rb'\n      load 'poor_guy.rb'\n\n      assert File.exist?('poor_guy.rb')\n      assert !File.exist?('offender.rb')\n\n      FileUtils.rm_f('poor_guy.rb')\n    end\n  end\n\n  def test_file_name_includes_a_colon\n    Dir.chdir(File.dirname(__FILE__)) do\n      File.write('offender:is_bad.rb', 'C.new.p')\n\n      load 'offender:is_bad.rb'\n\n      assert !File.exist?('offender:is_bad.rb')\n    end\n  end\n\n  def test_caller_is_not_a_file\n    Dir.chdir(File.dirname(__FILE__)) do\n      eval 'C.new.p'\n    end\n  end\nend\n"
  }
]