meltdown 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gemset ADDED
@@ -0,0 +1 @@
1
+ RVM_GEMSET="ruby-1.9.3@meltdown"
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.rvmrc ADDED
@@ -0,0 +1,11 @@
1
+ source .gemset
2
+ export USE_BUNDLER=force
3
+
4
+ rvm use --create --install $RVM_GEMSET
5
+
6
+ if [[ -s "./bootstrap.gems" ]]; then
7
+ if ! rvm gemset import bootstrap.gems > /dev/null 2>&1; then
8
+ echo "ERROR: Unable to bootstrap the gems" >&2
9
+ fi
10
+ fi
11
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in meltdown.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Corey Innis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # Meltdown
2
+
3
+ meltdown... An alternative to [pow](http://pow.cx/) and
4
+ [powder](http://git.io/powder)
5
+
6
+ meltdown... A result of my frustrations with the above. Handles local DNS,
7
+ like *pow*, but assumes that (read "allows for") you to set up your own
8
+ http --> app server configuration (e.g., with nginx).
9
+
10
+ At some future point, *meltdown* may include http proxy-ing capabilities,
11
+ like *pow*, but it's just DNS for now.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'meltdown'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install meltdown
26
+
27
+ ## Usage
28
+
29
+ TODO: Write usage instructions here
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'fileutils'
5
+ require 'rexec'
6
+ require 'thor'
7
+ require 'meltdown'
8
+
9
+ module Meltdown
10
+ class CLI < Thor
11
+ include Thor::Actions
12
+ default_task :help
13
+
14
+ PROJ_CONFIG = ".meltdown"
15
+ HOME_CONFIG = "#{ENV['HOME']}/.meltdown"
16
+
17
+ desc "start", "Enable meltdown"
18
+ def start
19
+ fail(:install) unless installed?
20
+ fail(:sudo) unless as_root?
21
+
22
+ Meltdown::DnsServer.start
23
+ end
24
+
25
+ desc "stop", "Disable meltdown"
26
+ def stop
27
+ fail(:install) unless installed?
28
+ fail(:sudo) unless as_root?
29
+
30
+ Meltdown::DnsServer.stop
31
+ end
32
+
33
+ desc "install", "Install meltdown (run as root)"
34
+ # method_option :tld, :type => :string, :default => 'dev'
35
+ def install
36
+ fail(:sudo) unless as_root?
37
+
38
+ source = File.expand_path('../../lib/meltdown/resolver.conf', __FILE__)
39
+ target = File.join('/etc/resolver/dev')
40
+
41
+ say "meltdown... installing resolver config at #{target}"
42
+ FileUtils.cp(source, target)
43
+
44
+ File.open(HOME_CONFIG, 'w') do |f|
45
+ f.puts "MELTDOWN_RESOLVER=#{target}"
46
+ end
47
+ FileUtils.chown(ENV['SUDO_USER'], nil, HOME_CONFIG)
48
+ end
49
+
50
+ private
51
+
52
+ def fail(type)
53
+ case type
54
+ when :install
55
+ say "\nmeltdown is not installed.\n\n"
56
+ $stderr.puts
57
+ $stderr.puts "Apologies, 'meltdown' is not yet installed"
58
+ $stderr.puts
59
+ when :sudo
60
+ $stderr.puts
61
+ $stderr.puts "Apologies, 'meltdown' must be run as root"
62
+ $stderr.puts
63
+ $stderr.puts " # system (without rvm)"
64
+ $stderr.puts " sudo meltdown install"
65
+ $stderr.puts
66
+ $stderr.puts " # using rvm"
67
+ $stderr.puts " rvmsudo meltdown install"
68
+ $stderr.puts
69
+ end
70
+
71
+ help
72
+ exit 1
73
+ end
74
+
75
+ def installed?
76
+ installed = File.exist?(HOME_CONFIG)
77
+ end
78
+
79
+ def as_root?
80
+ RExec.current_user == 'root'
81
+ end
82
+ end
83
+ end
84
+
85
+ Meltdown::CLI.start
@@ -0,0 +1 @@
1
+ bundler -v 1.1.3
@@ -0,0 +1,5 @@
1
+ require "meltdown/version"
2
+
3
+ module Meltdown
4
+ autoload :DnsServer, "meltdown/dns_server"
5
+ end
@@ -0,0 +1,28 @@
1
+ require 'rexec'
2
+ require 'rexec/daemon'
3
+ require 'rubydns'
4
+
5
+ module Meltdown
6
+ class DnsServer < RExec::Daemon::Base
7
+ class << self
8
+ def run
9
+ # don't buffer output (for realtime debugging)
10
+ $stdout.sync = true
11
+ $stderr.sync = true
12
+
13
+ # listen on same port as Pow, registered in /etc/resolver/dev
14
+ RubyDNS::run_server(:listen => [[:udp, "0.0.0.0", 20560]]) do
15
+ match(/.*\.dev$/, :A) do |match, transaction|
16
+ logger.info "DNS match A : #{transaction.inspect}"
17
+ transaction.respond!("127.0.0.1")
18
+ end
19
+
20
+ match("1.0.0.127.in-addr.arpa", :PTR) do |transaction|
21
+ logger.info "DNS match PTR : #{transaction.inspect}"
22
+ transaction.respond!(Name.create("default.dev."))
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ # meltdown
2
+ nameserver 127.0.0.1
3
+ port 20560
@@ -0,0 +1,3 @@
1
+ module Meltdown
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/meltdown/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Corey Innis"]
6
+ gem.email = ["corey@coolerator.net"]
7
+ gem.description = %q{A ruby alternative to pow/powder}
8
+ gem.summary = %q{A ruby alternative to pow/powder}
9
+ gem.homepage = "https://github.com/coreyti/meltdown"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "meltdown"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Meltdown::VERSION
17
+
18
+ gem.add_dependency 'rexec', '>= 1.4.1'
19
+ gem.add_dependency 'rubydns', '>= 0.3.4'
20
+ gem.add_dependency 'thor', '>= 0.11.5'
21
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meltdown
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Corey Innis
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rexec
16
+ requirement: &70244073157220 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.4.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70244073157220
25
+ - !ruby/object:Gem::Dependency
26
+ name: rubydns
27
+ requirement: &70244073156340 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.3.4
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70244073156340
36
+ - !ruby/object:Gem::Dependency
37
+ name: thor
38
+ requirement: &70244073155860 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 0.11.5
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70244073155860
47
+ description: A ruby alternative to pow/powder
48
+ email:
49
+ - corey@coolerator.net
50
+ executables:
51
+ - meltdown
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gemset
56
+ - .gitignore
57
+ - .rspec
58
+ - .rvmrc
59
+ - Gemfile
60
+ - LICENSE
61
+ - README.md
62
+ - Rakefile
63
+ - bin/meltdown
64
+ - bootstrap.gems
65
+ - lib/meltdown.rb
66
+ - lib/meltdown/dns_server.rb
67
+ - lib/meltdown/resolver.conf
68
+ - lib/meltdown/version.rb
69
+ - meltdown.gemspec
70
+ homepage: https://github.com/coreyti/meltdown
71
+ licenses: []
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 1.8.11
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: A ruby alternative to pow/powder
94
+ test_files: []