simpleserve 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -0
  2. data/bin/simpleserve +31 -0
  3. data/rakefile +14 -0
  4. metadata +49 -0
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/simpleserve ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # thanks to jim weirich
4
+ # run ./servefiles from the root directory
5
+
6
+ require 'webrick'
7
+ include WEBrick
8
+
9
+ dir = Dir::pwd
10
+ port = (ARGV.first || (12000 + (dir.hash % 1000))).to_i
11
+
12
+ url = "http://#{Socket.gethostname}:#{port}"
13
+
14
+ puts "Opening #{url}"
15
+
16
+ if Config::CONFIG['host_os'] =~ /mingw|windows/
17
+ `start #{url}`
18
+ elsif Config::CONFIG['host_os'] =~ /darwin/
19
+ `open #{url}`
20
+ else
21
+ `xdg-open #{url}`
22
+ end
23
+
24
+
25
+ s = HTTPServer.new(
26
+ :Port => port,
27
+ :DocumentRoot => dir
28
+ )
29
+
30
+ trap("INT"){ s.shutdown }
31
+ s.start
data/rakefile ADDED
@@ -0,0 +1,14 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = "simpleserve"
5
+ gem.summary = "Turn any directory into a static web server with one beautify command"
6
+ gem.description = "type `/> simpleserve` into the command line and bam... it turns it into a web server"
7
+ gem.email = "rauh.ryan@gmail.com"
8
+ gem.homepage = "http://github.com/rauhryan/simpleserve"
9
+ gem.authors = ["Ryan Rauh"]
10
+ end
11
+ Jeweler::GemcutterTasks.new
12
+ rescue LoadError
13
+ puts "Jeweler not available. Install it with: gem install jeweler"
14
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simpleserve
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ryan Rauh
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-06 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: type `/> simpleserve` into the command line and bam... it turns it into
15
+ a web server
16
+ email: rauh.ryan@gmail.com
17
+ executables:
18
+ - simpleserve
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - VERSION
23
+ - bin/simpleserve
24
+ - rakefile
25
+ homepage: http://github.com/rauhryan/simpleserve
26
+ licenses: []
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.7
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: Turn any directory into a static web server with one beautify command
49
+ test_files: []