steam-vapor 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,29 +1,29 @@
1
1
  # Vapor
2
2
 
3
- TODO: Write a gem description
3
+ Vapor is a command-line utility that allows you to view and connect to Source game servers (Team Fortress 2, Counter-Strike: Source, etc.) as well as keep tabs on your Steam friends. Instead of launching Steam, followed by TF2, to see if it's worth joining your favorite server, you can just run `vapor server list` to see how many players are online and what the current map is. Then you can connect with `vapor server connect [server alias]`.
4
4
 
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
5
+ ![Screenshot](http://i.imgur.com/3nvdU8k.png)
8
6
 
9
- gem 'vapor'
7
+ ## Installation
10
8
 
11
- And then execute:
9
+ First, ensure that you have Ruby 1.9.x installed. (Vapor was written on Ruby 1.9.3.) You also need to have RubyGems. With those prerequisites aside, installation should be a simple matter of:
12
10
 
13
- $ bundle
11
+ gem install steam-vapor
14
12
 
15
- Or install it yourself as:
13
+ ## Usage
16
14
 
17
- $ gem install vapor
15
+ **Servers**
18
16
 
19
- ## Usage
17
+ * `vapor server add nickname 127.0.0.1` — Save a server to Vapor's server list. The default port used is 27015, though you can specify another by inputting it after the IP/domain (with a space as a separator). The custom nickname is how Vapor keeps track of the server.
18
+ * `vapor server rm nickname` — Remove the server corresponding to "nickname."
19
+ * `vapor server connect nickname` — Launch Steam and connect to the server corresponding to "nickname."
20
+ * `vapor server list` — View a listing of every server you have saved, complete with player counts and the current map.
21
+ * `vapor server info nickname` — Display the same information as `vapor server list`, but with a listing of players and their scores.
20
22
 
21
- TODO: Write usage instructions here
23
+ **Users**
22
24
 
23
- ## Contributing
25
+ * `vapor user mynameis you` — (Replace "you" with your Steam username or numeric ID.) This tells Vapor who you are so the friends list will work.
26
+ * `vapor user friends` — Displays a listing of your Steam friends, with their current status.
27
+ * `vapor user profile username` — Displays a brief overview of the profile matching "username."
24
28
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
29
+ Note: For the most accurate command listing, use the `vapor` command's built-in help function.
data/bin/vapor CHANGED
@@ -1,129 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'thor'
4
6
  require 'user_config'
5
7
  require 'steam-condenser'
6
8
  require 'vapor/steam'
7
9
  require 'vapor/config'
8
-
9
-
10
- module Vapor
11
-
12
-
13
- class Server < Thor
14
-
15
-
16
- def initialize(*args)
17
- super
18
- @config = STConfig.new
19
- end
20
-
21
-
22
- desc "info <handle> [--ip <ip:port>]", "Display server info"
23
- option :ip
24
- def info(handle=nil)
25
- if (options[:ip])
26
- parts = options[:ip].strip.split(':')
27
- ip = parts[0]
28
- port = parts[1]
29
- else
30
- s = @config.lookup_server_by_handle(handle)
31
- ip = s['ip']
32
- port = s['port']
33
- end
34
- Steam.server_info(ip, port)
35
- end
36
-
37
-
38
- desc "list", "List servers"
39
- def list
40
- Steam.server_listing(@config.data['servers'])
41
- end
42
-
43
-
44
- desc "add <handle> <ip> [port]", "Save a server to the list"
45
- def add(handle, ip, port=27015)
46
- @config.add_server(handle, ip, port)
47
- end
48
-
49
-
50
- desc "rm <handle>", "Delete a server from the list"
51
- def rm(handle)
52
- @config.rm_server(handle)
53
- end
54
-
55
-
56
- desc "connect <handle>", "Connect to a server"
57
- def connect(handle)
58
- s = @config.lookup_server_by_handle(handle)
59
- uri = "steam://connect/#{s['ip']}:#{s['port']}"
60
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
61
- system "start #{uri}"
62
- elsif RbConfig::CONFIG['host_os'] =~ /darwin/
63
- system "open #{uri}"
64
- elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
65
- system "xdg-open #{uri}"
66
- end
67
- end
68
-
69
-
70
- end
71
-
72
-
73
-
74
- class User < Thor
75
-
76
-
77
- def initialize(*args)
78
- super
79
- @config = STConfig.new
80
- end
81
-
82
-
83
- desc "profile <username>", "Display information about a Steam user"
84
- def profile(username)
85
- Steam.user_profile(username)
86
- end
87
-
88
-
89
- desc "friends", "Display friends list"
90
- def friends
91
- Steam.friends_list(@config.data['me'])
92
- end
93
-
94
-
95
- desc "mynameis <me>", "Tell Vapor your Steam username or numeric Steam ID"
96
- def mynameis(me)
97
- @config.set_user(me)
98
- end
99
-
100
-
101
- end
102
-
103
-
104
-
105
- class CLI < Thor
106
-
107
-
108
- def initialize(*args)
109
- super
110
- @config = STConfig.new
111
- end
112
-
113
-
114
- desc "server [SUBCOMMAND]", "Query servers"
115
- subcommand "server", Server
116
-
117
-
118
- desc "user [SUBCOMMAND]", "Lookup Steam user details"
119
- subcommand "user", User
120
-
121
-
122
- end
123
-
124
-
125
-
126
- CLI.start
127
-
128
-
129
- end
10
+ require 'vapor'
data/lib/vapor.rb CHANGED
@@ -1 +1,123 @@
1
- require "vapor/version"
1
+ require "vapor/version"
2
+
3
+
4
+ module Vapor
5
+
6
+
7
+ class Server < Thor
8
+
9
+
10
+ def initialize(*args)
11
+ super
12
+ @config = STConfig.new
13
+ end
14
+
15
+
16
+ desc "info <handle> [--ip <ip:port>]", "Display server info"
17
+ option :ip
18
+ def info(handle=nil)
19
+ if (options[:ip])
20
+ parts = options[:ip].strip.split(':')
21
+ ip = parts[0]
22
+ port = parts[1]
23
+ else
24
+ s = @config.lookup_server_by_handle(handle)
25
+ ip = s['ip']
26
+ port = s['port']
27
+ end
28
+ Steam.server_info(ip, port)
29
+ end
30
+
31
+
32
+ desc "list", "List servers"
33
+ def list
34
+ Steam.server_listing(@config.data['servers'])
35
+ end
36
+
37
+
38
+ desc "add <handle> <ip> [port]", "Save a server to the list"
39
+ def add(handle, ip, port=27015)
40
+ @config.add_server(handle, ip, port)
41
+ end
42
+
43
+
44
+ desc "rm <handle>", "Delete a server from the list"
45
+ def rm(handle)
46
+ @config.rm_server(handle)
47
+ end
48
+
49
+
50
+ desc "connect <handle>", "Connect to a server"
51
+ def connect(handle)
52
+ s = @config.lookup_server_by_handle(handle)
53
+ uri = "steam://connect/#{s['ip']}:#{s['port']}"
54
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
55
+ system "start #{uri}"
56
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin/
57
+ system "open #{uri}"
58
+ elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
59
+ system "xdg-open #{uri}"
60
+ end
61
+ end
62
+
63
+
64
+ end
65
+
66
+
67
+
68
+ class User < Thor
69
+
70
+
71
+ def initialize(*args)
72
+ super
73
+ @config = STConfig.new
74
+ end
75
+
76
+
77
+ desc "profile <username>", "Display information about a Steam user"
78
+ def profile(username)
79
+ Steam.user_profile(username)
80
+ end
81
+
82
+
83
+ desc "friends", "Display friends list"
84
+ def friends
85
+ Steam.friends_list(@config.data['me'])
86
+ end
87
+
88
+
89
+ desc "mynameis <me>", "Tell Vapor your Steam username or numeric Steam ID"
90
+ def mynameis(me)
91
+ @config.set_user(me)
92
+ end
93
+
94
+
95
+ end
96
+
97
+
98
+
99
+ class CLI < Thor
100
+
101
+
102
+ def initialize(*args)
103
+ super
104
+ @config = STConfig.new
105
+ end
106
+
107
+
108
+ desc "server [SUBCOMMAND]", "Query servers"
109
+ subcommand "server", Server
110
+
111
+
112
+ desc "user [SUBCOMMAND]", "Lookup Steam user details"
113
+ subcommand "user", User
114
+
115
+
116
+ end
117
+
118
+
119
+
120
+ CLI.start
121
+
122
+
123
+ end
data/lib/vapor/steam.rb CHANGED
@@ -9,9 +9,10 @@ class Steam
9
9
  if server
10
10
 
11
11
  server_info = server.server_info
12
+ game = self.game_name_string(server_info[:game_id])
12
13
 
13
14
  puts "----------------------------------------------------"
14
- puts "\033[36m" + server_info[:server_name] + "\033[0m"
15
+ puts "\033[36m" + server_info[:server_name] + "\033[0m [#{game}] "
15
16
  puts "\033[32mPlayers:\033[0m #{server_info[:number_of_players]}/#{server_info[:max_players]} \t \033[32mMap:\033[0m #{server_info[:map_name]}"
16
17
  puts "----------------------------------------------------"
17
18
 
@@ -66,6 +67,24 @@ class Steam
66
67
 
67
68
 
68
69
 
70
+ def self.game_name_string(gameid)
71
+ games = {
72
+ 440 => "TF2",
73
+ 240 => "CS:S",
74
+ 730 => "CS:GO",
75
+ 320 => "HL2",
76
+ 500 => "L4D",
77
+ 550 => "L4D2"
78
+ }
79
+ if games.has_key?(gameid)
80
+ return games[gameid]
81
+ else
82
+ return "SRC"
83
+ end
84
+ end
85
+
86
+
87
+
69
88
  def self.user_profile(user)
70
89
  uid = Integer(user) rescue user
71
90
  id = SteamId.new(uid)
data/lib/vapor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vapor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam-vapor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-31 00:00:00.000000000 Z
12
+ date: 2013-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: 4386472134216201780
126
+ hash: -2124532433296563554
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  segments:
134
134
  - 0
135
- hash: 4386472134216201780
135
+ hash: -2124532433296563554
136
136
  requirements: []
137
137
  rubyforge_project:
138
138
  rubygems_version: 1.8.25