hotspotlogin 0.1.1 → 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -22,11 +22,11 @@ On the command-line:
22
22
 
23
23
  ==== Options
24
24
 
25
- --daemon daemonize
25
+ --[no-]daemon daemonize [by default, executes in foreground]
26
26
 
27
- --log log file (ignored when no --daemon)
27
+ --log log file (ignored when --no-daemon)
28
28
 
29
- --pid pid file (ignored when no --daemon)
29
+ --pid pid file (ignored when --no-daemon)
30
30
 
31
31
  --port [default 4990]
32
32
 
@@ -50,7 +50,7 @@ See also chilli.conf(5) manual page.
50
50
 
51
51
  (The MIT License)
52
52
 
53
- Copyright (c) 2010 Guido De Rosa
53
+ Copyright (c) 2010 Guido De Rosa <job*guidoderosa.net>
54
54
 
55
55
  Permission is hereby granted, free of charge, to any person obtaining
56
56
  a copy of this software and associated documentation files (the
data/bin/hotspotlogin.rb CHANGED
@@ -16,26 +16,35 @@ require File.expand_path(
16
16
  File.dirname(file) + "/../lib/hotspotlogin"
17
17
  )
18
18
 
19
- config = HotSpotLogin.config!
20
-
21
- if config['daemon']
22
- pid = fork do
23
- if config['log']
24
- STDOUT.reopen(config['log'], 'a')
25
- STDERR.reopen(config['log'], 'a')
26
- Signal.trap('USR1') do
27
- STDOUT.flush
28
- STDERR.flush
19
+ # The $0 hack also would break the following code :-/
20
+
21
+ # RubyGems sucks 'cause it includes bin/ directories into the $LOAD_PATH
22
+ #
23
+ # So, this file may be actually used to just 'require' the
24
+ # hotspotlogin library (in this case $0 != __FILE__)
25
+
26
+ if $0 == __FILE__ # actually start hotspotlogin service
27
+ config = HotSpotLogin.config!
28
+
29
+ if config['daemon']
30
+ pid = fork do
31
+ if config['log']
32
+ STDOUT.reopen(config['log'], 'a')
33
+ STDERR.reopen(config['log'], 'a')
34
+ Signal.trap('USR1') do
35
+ STDOUT.flush
36
+ STDERR.flush
37
+ end
29
38
  end
39
+ HotSpotLogin::App.run!
40
+ FileUtils.rm config['pid'] if config['pid'] and File.exists? config['pid']
30
41
  end
31
- HotSpotLogin::App.run!
32
- FileUtils.rm config['pid'] if config['pid'] and File.exists? config['pid']
33
- end
34
- if config['pid'] =~ /\S/
35
- File.open config['pid'], 'w' do |f|
36
- f.write pid
42
+ if config['pid'] =~ /\S/
43
+ File.open config['pid'], 'w' do |f|
44
+ f.write pid
45
+ end
37
46
  end
47
+ else # run in foreground
48
+ HotSpotLogin::App.run!
38
49
  end
39
- else
40
- HotSpotLogin::App.run!
41
50
  end
@@ -28,8 +28,8 @@ module HotSpotLogin
28
28
 
29
29
  # Command line switches override configuration file.
30
30
 
31
- opts.on('--daemon', 'become a daemon') do
32
- @@config['daemon'] = true
31
+ opts.on('--[no-]daemon', 'become a daemon') do |daemonize|
32
+ @@config['daemon'] = daemonize
33
33
  end
34
34
 
35
35
  opts.on('--log FILE', 'log file (overwrite existing)') do |filename|
@@ -1,6 +1,6 @@
1
1
  module HotSpotLogin
2
2
 
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.1.1'
4
4
 
5
5
  DEFAULT_CONFIG = {
6
6
  'listen-address' => '0.0.0.0',
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotspotlogin
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
4
+ version: 0.1.1.1
10
5
  platform: ruby
11
6
  authors:
12
7
  - Guido De Rosa
@@ -14,25 +9,23 @@ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2010-03-04 00:00:00 +00:00
12
+ date: 2010-03-04 00:00:00 +01:00
18
13
  default_executable:
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: sinatra
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
24
20
  requirements:
25
21
  - - ">="
26
22
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
23
  version: "0"
30
- type: :runtime
31
- version_requirements: *id001
24
+ version:
32
25
  description: Traditionally, a PHP or Perl/CGI web page has been used to login unauthenticated users to a Network Access Controller like ChilliSpot; this hotspotlogin implementation is based on Ruby and Sinatra (the classy web framework).
33
26
  email: guidoderosa@gmail.com
34
- executables: []
35
-
27
+ executables:
28
+ - hotspotlogin.rb
36
29
  extensions: []
37
30
 
38
31
  extra_rdoc_files:
@@ -64,20 +57,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
57
  requirements:
65
58
  - - ">="
66
59
  - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
60
  version: "0"
61
+ version:
70
62
  required_rubygems_version: !ruby/object:Gem::Requirement
71
63
  requirements:
72
64
  - - ">="
73
65
  - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
66
  version: "0"
67
+ version:
77
68
  requirements: []
78
69
 
79
70
  rubyforge_project:
80
- rubygems_version: 1.3.6
71
+ rubygems_version: 1.3.5
81
72
  signing_key:
82
73
  specification_version: 3
83
74
  summary: Ruby/Sinatra implementation of the login page used with ChilliSpot and friends.