explorer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -10
- data/data/setup/dev +2 -0
- data/data/setup/firewall.plist +19 -0
- data/lib/explorer.rb +1 -0
- data/lib/explorer/cli.rb +4 -0
- data/lib/explorer/cli/proxy.rb +1 -0
- data/lib/explorer/cli/setup.rb +26 -0
- data/lib/explorer/setup.rb +68 -0
- data/lib/explorer/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6868f036ef96d91102731a1f805024563e7a8e84
|
4
|
+
data.tar.gz: 2072dfb48e958eb3800b0a3179e82af2c53d6153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3d4c72345746c75b82294c9e860bdc4bc89436991d79c32bac09778198e7da978699d098c38eaaecee66854a2b244e310fe83e52e22768d0ad0c63aaea544f
|
7
|
+
data.tar.gz: 358e8b32723334191182b56f87b6c066628b52123ea1c6f23086c4c8a1dc035179c0a243299e396fd80e1bec1d8a3c950171f9cb83c0d3b8b268475c3cbe9802
|
data/README.md
CHANGED
@@ -3,26 +3,28 @@
|
|
3
3
|
Explorer is a replacement for Pow! written in Ruby.
|
4
4
|
|
5
5
|
[![Dependency Status](https://gemnasium.com/Darksecond/explorer.svg)](https://gemnasium.com/Darksecond/explorer)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/explorer.svg)](http://badge.fury.io/rb/explorer)
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
9
|
-
|
10
|
+
Install it yourself as:
|
10
11
|
|
11
|
-
|
12
|
-
gem 'explorer'
|
13
|
-
```
|
12
|
+
$ gem install explorer
|
14
13
|
|
15
|
-
|
14
|
+
## Usage
|
16
15
|
|
17
|
-
|
16
|
+
Run the following command to start up the server
|
18
17
|
|
19
|
-
|
18
|
+
$ explore boot
|
20
19
|
|
21
|
-
|
20
|
+
The server can be controlled using various subcommands.
|
21
|
+
More information can be gotten by running:
|
22
22
|
|
23
|
-
|
23
|
+
$ explore help proxy
|
24
|
+
|
25
|
+
and
|
24
26
|
|
25
|
-
|
27
|
+
$ explore help process
|
26
28
|
|
27
29
|
## Contributing
|
28
30
|
|
data/data/setup/dev
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Label</key>
|
6
|
+
<string>nl.darksecond.explorer</string>
|
7
|
+
<key>ProgramArguments</key>
|
8
|
+
<array>
|
9
|
+
<string>sh</string>
|
10
|
+
<string>-c</string>
|
11
|
+
<string>echo "rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 23401
|
12
|
+
rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 23402" | pfctl -a 'com.apple/250.ExplorerFirewall' -f - -E</string>
|
13
|
+
</array>
|
14
|
+
<key>RunAtLoad</key>
|
15
|
+
<true/>
|
16
|
+
<key>UserName</key>
|
17
|
+
<string>root</string>
|
18
|
+
</dict>
|
19
|
+
</plist>
|
data/lib/explorer.rb
CHANGED
data/lib/explorer/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'explorer/cli/proxy'
|
3
3
|
require 'explorer/cli/process'
|
4
|
+
require 'explorer/cli/setup'
|
4
5
|
|
5
6
|
module Explorer
|
6
7
|
module CLI
|
@@ -18,6 +19,9 @@ module Explorer
|
|
18
19
|
desc 'process SUBCOMMAND ...ARGS', 'manage processes'
|
19
20
|
subcommand 'process', Process
|
20
21
|
|
22
|
+
desc 'setup SUBCOMMAND ...ARGS', 'manage explorer setup'
|
23
|
+
subcommand 'setup', Setup
|
24
|
+
|
21
25
|
desc "boot [CONFIG]", 'Start explorer'
|
22
26
|
def boot(config=nil)
|
23
27
|
servers = Servers.new hostmap: {'test.dev' => {host: 'localhost', port: 8080}}
|
data/lib/explorer/cli/proxy.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'rainbow'
|
3
|
+
|
4
|
+
module Explorer
|
5
|
+
module CLI
|
6
|
+
class Setup < Thor
|
7
|
+
desc 'install', 'install explorer so that it can be used with `.dev` domains'
|
8
|
+
def install
|
9
|
+
setup = Explorer::Setup.new
|
10
|
+
return puts Rainbow('Explorer is already installed').color(:red) if setup.installed?
|
11
|
+
return puts Rainbow('Cannot install, not suitable').color(:red) unless setup.suitable?
|
12
|
+
setup.install
|
13
|
+
puts Rainbow('Done installing `.dev` support').color(:green).bright
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'uninstall', 'uninstall `.dev` domain support'
|
17
|
+
def uninstall
|
18
|
+
setup = Explorer::Setup.new
|
19
|
+
return puts Rainbow('Explorer is not installed').color(:red) unless setup.installed?
|
20
|
+
return puts Rainbow('Cannot uninstall, not suitable').color(:red) unless setup.suitable?
|
21
|
+
setup.uninstall
|
22
|
+
puts Rainbow('Done uninstalling `.dev` support').color(:green).bright
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'etc'
|
2
|
+
|
3
|
+
module Explorer
|
4
|
+
class Setup
|
5
|
+
FIREWALL_PLIST_DST = '/Library/LaunchDaemons/nl.darksecond.explorer.firewall.plist'
|
6
|
+
RESOLVER_FILE_DST = '/etc/resolver/dev'
|
7
|
+
RESOLVER_DIR_DST = '/etc/resolver'
|
8
|
+
|
9
|
+
def install
|
10
|
+
firewall_plist_src = File.join(Explorer::DATADIR, 'setup', 'firewall.plist')
|
11
|
+
resolver_file_src = File.join(Explorer::DATADIR, 'setup', 'dev')
|
12
|
+
|
13
|
+
mkdir(RESOLVER_DIR_DST)
|
14
|
+
FileUtils.cp resolver_file_src, RESOLVER_FILE_DST
|
15
|
+
puts Rainbow("Installed `#{RESOLVER_FILE_DST}`").color(:green).bright
|
16
|
+
|
17
|
+
FileUtils.cp firewall_plist_src, FIREWALL_PLIST_DST
|
18
|
+
puts Rainbow("Installed `#{FIREWALL_PLIST_DST}`").color(:green).bright
|
19
|
+
|
20
|
+
unload_firewall
|
21
|
+
load_firewall
|
22
|
+
puts Rainbow('Loaded firwall rules').color(:green).bright
|
23
|
+
|
24
|
+
rescue Errno::EACCES => e
|
25
|
+
puts Rainbow("Something went wrong installing (#{e.message})").color(:red).bright
|
26
|
+
end
|
27
|
+
|
28
|
+
def uninstall
|
29
|
+
FileUtils.rm RESOLVER_FILE_DST
|
30
|
+
puts Rainbow("Removed `#{RESOLVER_FILE_DST}`").color(:green).bright
|
31
|
+
|
32
|
+
unload_firewall
|
33
|
+
puts Rainbow("Unloaded firewall rules").color(:green).bright
|
34
|
+
|
35
|
+
FileUtils.rm FIREWALL_PLIST_DST
|
36
|
+
puts Rainbow("Removed `#{FIREWALL_PLIST_DST}`").color(:green).bright
|
37
|
+
|
38
|
+
rescue Errno::EACCES => e
|
39
|
+
puts Rainbow("Something went wrong uninstalling (#{e.message})").color(:red).bright
|
40
|
+
end
|
41
|
+
|
42
|
+
def installed?
|
43
|
+
return false unless File.exists? FIREWALL_PLIST_DST
|
44
|
+
return false unless File.exists? RESOLVER_FILE_DST
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
def suitable?
|
49
|
+
return false unless Etc.uname[:sysname] == 'Darwin'
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def unload_firewall
|
56
|
+
system("pfctl -a com.apple/250.ExplorerFirewall -F nat 2>/dev/null")
|
57
|
+
system("launchctl unload -w #{FIREWALL_PLIST_DST} 2>/dev/null")
|
58
|
+
end
|
59
|
+
|
60
|
+
def load_firewall
|
61
|
+
system("launchctl load -Fw #{FIREWALL_PLIST_DST} 2>/dev/null")
|
62
|
+
end
|
63
|
+
|
64
|
+
def mkdir(dir)
|
65
|
+
FileUtils.mkdir(dir) unless Dir.exists? dir
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/explorer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: explorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Peters
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -166,12 +166,15 @@ files:
|
|
166
166
|
- bin/explore
|
167
167
|
- data/server.crt
|
168
168
|
- data/server.key
|
169
|
+
- data/setup/dev
|
170
|
+
- data/setup/firewall.plist
|
169
171
|
- explorer.gemspec
|
170
172
|
- lib/celluloid/io/pty.rb
|
171
173
|
- lib/explorer.rb
|
172
174
|
- lib/explorer/cli.rb
|
173
175
|
- lib/explorer/cli/process.rb
|
174
176
|
- lib/explorer/cli/proxy.rb
|
177
|
+
- lib/explorer/cli/setup.rb
|
175
178
|
- lib/explorer/ipc_client.rb
|
176
179
|
- lib/explorer/log_watcher.rb
|
177
180
|
- lib/explorer/process.rb
|
@@ -183,6 +186,7 @@ files:
|
|
183
186
|
- lib/explorer/server/https.rb
|
184
187
|
- lib/explorer/server/ipc.rb
|
185
188
|
- lib/explorer/servers.rb
|
189
|
+
- lib/explorer/setup.rb
|
186
190
|
- lib/explorer/version.rb
|
187
191
|
homepage: ''
|
188
192
|
licenses:
|