masquito 1.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +8 -2
- data/bin/masquito +1 -3
- data/lib/masquito/install.rb +51 -49
- data/lib/masquito/version.rb +1 -1
- data/lib/masquito.rb +1 -0
- metadata +9 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 475805dc608ba0ec90ad60fe06e97e808c6df2d4
|
4
|
+
data.tar.gz: 064c50eede7608e545e02882de927db547aef397
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c47cb5b111aadaa9aec0c214c2078b2c2d423b04e4d6a5d8a7f2d026d153dd801d4fcdcb0937d5a20c7158ae768afe4f303a60eb34b5d159f1f5a03b13c8945
|
7
|
+
data.tar.gz: b1788664477278498a85ff82db93607c751f3669b10abc2cbf2ee1a8a566f9bd0b7ab131ff1689de060bebfa131daa52438d8d5b14c1f0a65009f8f6f3d76e8f
|
data/README.md
CHANGED
@@ -4,8 +4,14 @@ This gem is for DNS masquerading for rubists. Everyone knows `Pow`, but what
|
|
4
4
|
I really don't like that it uses `node.js` to run ruby applications. Sometimes
|
5
5
|
we have to run our apps on the certain domain. Masquito allows you to do it,
|
6
6
|
you can create dns records in the similar Pow's way by creating symbolic links
|
7
|
-
|
8
|
-
|
7
|
+
to your apps or just files in `.masquito` directory.
|
8
|
+
|
9
|
+
## Notice:
|
10
|
+
|
11
|
+
Masquito doesn't run rack applications. It just masquerads dns records to your
|
12
|
+
local IP. Check our another gem
|
13
|
+
[https://github.com/route/pump](https://github.com/route/pump) out for full
|
14
|
+
replacement of Pow.
|
9
15
|
|
10
16
|
## Installation
|
11
17
|
|
data/bin/masquito
CHANGED
@@ -13,14 +13,12 @@ case command
|
|
13
13
|
when 'start'
|
14
14
|
Masquito::DNS.new
|
15
15
|
when /daemon|resolver/
|
16
|
-
require 'masquito/install'
|
17
16
|
options = %w(install uninstall)
|
18
17
|
unless options.include?(subcommand)
|
19
18
|
abort "Usage: #{filename} #{command} #{options.join(' | ')}"
|
20
19
|
end
|
21
|
-
Masquito.send("#{command}_#{subcommand}")
|
20
|
+
Masquito::Install.send("#{command}_#{subcommand}")
|
22
21
|
when 'version'
|
23
|
-
require 'masquito/version'
|
24
22
|
puts Masquito::VERSION
|
25
23
|
else
|
26
24
|
puts "Usage: #{filename} #{%w(daemon resolver version).join(' | ')}"
|
data/lib/masquito/install.rb
CHANGED
@@ -12,70 +12,72 @@ module Masquito
|
|
12
12
|
RESOLVER_TEMPLATE_PATH = File.join(GEM_PATH, 'config', 'masquito.erb')
|
13
13
|
RESOLVER_PATH = '/etc/resolver/masquito'
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
15
|
+
module Install
|
16
|
+
class << self
|
17
|
+
def daemon_install
|
18
|
+
abort_if_superuser
|
19
|
+
FileUtils.mkdir_p(CONFIG_PATH)
|
20
|
+
|
21
|
+
plist = ERB.new(File.read(TEMPLATE_PLIST_PATH))
|
22
|
+
masquito_bin = File.join(GEM_PATH, 'bin', 'masquito')
|
23
|
+
template = plist.result(binding)
|
24
|
+
|
25
|
+
filename = File.join(Dir.tmpdir, PLIST_NAME)
|
26
|
+
File.open(filename, 'w') { |f| f.write(template) }
|
27
|
+
lunchy.install([filename])
|
28
|
+
lunchy.start([SERVICE_NAME])
|
29
|
+
File.unlink(filename)
|
30
|
+
|
31
|
+
puts 'Daemon was successfully installed.'
|
32
|
+
puts 'Run: sudo masquito resolver install'
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
def daemon_uninstall
|
36
|
+
abort_if_superuser
|
37
|
+
lunchy.stop([SERVICE_NAME])
|
38
|
+
lunchy.uninstall([PLIST_NAME])
|
39
|
+
puts "You can remove #{CONFIG_PATH} if you don't need these settings"
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
def resolver_install
|
43
|
+
abort_unless_superuser
|
44
|
+
resolver = ERB.new(File.read(RESOLVER_TEMPLATE_PATH))
|
45
|
+
template = resolver.result(binding)
|
46
|
+
File.open(RESOLVER_PATH, 'w') { |f| f.write(template) }
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def resolver_uninstall
|
50
|
+
abort_unless_superuser
|
51
|
+
FileUtils.rm_rf(RESOLVER_PATH)
|
52
|
+
end
|
52
53
|
|
53
|
-
|
54
|
+
private
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
def lunchy
|
57
|
+
@lunchy ||= Lunchy.new
|
58
|
+
end
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
def abort_unless_superuser
|
61
|
+
unless superuser?
|
62
|
+
abort 'We need superuser privileges, run this command with sudo'
|
63
|
+
end
|
62
64
|
end
|
63
|
-
end
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
def abort_if_superuser
|
67
|
+
if superuser?
|
68
|
+
abort 'No need superuser privileges, run this command without sudo'
|
69
|
+
end
|
68
70
|
end
|
69
|
-
end
|
70
71
|
|
71
|
-
|
72
|
-
|
72
|
+
def superuser?
|
73
|
+
[Process.uid, Process.euid] == [0, 0]
|
74
|
+
end
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
77
79
|
class Lunchy
|
78
|
-
CONFIG = { :verbose => false, :write =>
|
80
|
+
CONFIG = { :verbose => false, :write => nil }
|
79
81
|
|
80
82
|
def uninstall(params)
|
81
83
|
raise ArgumentError, "uninstall [file]" if params.empty?
|
data/lib/masquito/version.rb
CHANGED
data/lib/masquito.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: masquito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dmitry Vorotilin
|
@@ -10,22 +9,20 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: lunchy
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
description: Masquito is a dns masquerading server for rubists
|
@@ -56,27 +53,26 @@ files:
|
|
56
53
|
- test/test_helper.rb
|
57
54
|
homepage: https://github.com/evrone/masquito
|
58
55
|
licenses: []
|
56
|
+
metadata: {}
|
59
57
|
post_install_message:
|
60
58
|
rdoc_options: []
|
61
59
|
require_paths:
|
62
60
|
- lib
|
63
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
62
|
requirements:
|
66
|
-
- -
|
63
|
+
- - '>='
|
67
64
|
- !ruby/object:Gem::Version
|
68
65
|
version: '0'
|
69
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
67
|
requirements:
|
72
|
-
- -
|
68
|
+
- - '>='
|
73
69
|
- !ruby/object:Gem::Version
|
74
70
|
version: '0'
|
75
71
|
requirements: []
|
76
72
|
rubyforge_project:
|
77
|
-
rubygems_version:
|
73
|
+
rubygems_version: 2.0.3
|
78
74
|
signing_key:
|
79
|
-
specification_version:
|
75
|
+
specification_version: 4
|
80
76
|
summary: It masquerades your dns records
|
81
77
|
test_files:
|
82
78
|
- test/dns_test.rb
|