frostbitten 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+ gem 'hashie', :git => "git://github.com/intridea/hashie.git"
3
+ # Add dependencies required to use your gem here.
4
+ # Example:
5
+ # gem "activesupport", ">= 2.3.5"
6
+
7
+ # Add dependencies to develop your gem here.
8
+ # Include everything needed to run rake, tests, features, etc.
9
+ group :development do
10
+ gem "shoulda", ">= 0"
11
+ gem "rdoc", "~> 3.12"
12
+ gem "bundler"
13
+ gem "jeweler", "~> 1.8.4"
14
+ gem 'rspec'
15
+ gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
16
+ gem 'guard-rspec'
17
+ gem 'terminal-notifier-guard'
18
+ gem 'rake-compiler'
19
+ end
20
+
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ GIT
2
+ remote: git://github.com/intridea/hashie.git
3
+ revision: f7adbf6b6e29bfcd3efbc33695fe0e018d62e66e
4
+ specs:
5
+ hashie (2.0.0.beta)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ activesupport (3.2.11)
11
+ i18n (~> 0.6)
12
+ multi_json (~> 1.0)
13
+ bourne (1.1.2)
14
+ mocha (= 0.10.5)
15
+ coderay (1.0.8)
16
+ diff-lcs (1.1.3)
17
+ git (1.2.5)
18
+ guard (1.6.2)
19
+ listen (>= 0.6.0)
20
+ lumberjack (>= 1.0.2)
21
+ pry (>= 0.9.10)
22
+ terminal-table (>= 1.4.3)
23
+ thor (>= 0.14.6)
24
+ guard-rspec (2.4.0)
25
+ guard (>= 1.1)
26
+ rspec (~> 2.11)
27
+ i18n (0.6.1)
28
+ jeweler (1.8.4)
29
+ bundler (~> 1.0)
30
+ git (>= 1.2.5)
31
+ rake
32
+ rdoc
33
+ json (1.7.6)
34
+ listen (0.7.2)
35
+ lumberjack (1.0.2)
36
+ metaclass (0.0.1)
37
+ method_source (0.8.1)
38
+ mocha (0.10.5)
39
+ metaclass (~> 0.0.1)
40
+ multi_json (1.5.0)
41
+ pry (0.9.11.4)
42
+ coderay (~> 1.0.5)
43
+ method_source (~> 0.8)
44
+ slop (~> 3.4)
45
+ rake (10.0.3)
46
+ rake-compiler (0.8.1)
47
+ rake
48
+ rb-fsevent (0.9.3)
49
+ rdoc (3.12)
50
+ json (~> 1.4)
51
+ rspec (2.12.0)
52
+ rspec-core (~> 2.12.0)
53
+ rspec-expectations (~> 2.12.0)
54
+ rspec-mocks (~> 2.12.0)
55
+ rspec-core (2.12.2)
56
+ rspec-expectations (2.12.1)
57
+ diff-lcs (~> 1.1.3)
58
+ rspec-mocks (2.12.2)
59
+ shoulda (3.3.2)
60
+ shoulda-context (~> 1.0.1)
61
+ shoulda-matchers (~> 1.4.1)
62
+ shoulda-context (1.0.2)
63
+ shoulda-matchers (1.4.2)
64
+ activesupport (>= 3.0.0)
65
+ bourne (~> 1.1.2)
66
+ slop (3.4.3)
67
+ terminal-notifier-guard (1.5.3)
68
+ terminal-table (1.4.5)
69
+ thor (0.17.0)
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ bundler
76
+ guard-rspec
77
+ hashie!
78
+ jeweler (~> 1.8.4)
79
+ rake-compiler
80
+ rb-fsevent
81
+ rdoc (~> 3.12)
82
+ rspec
83
+ shoulda
84
+ terminal-notifier-guard
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Emil Palm
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,45 @@
1
+ = frostbitten
2
+
3
+ Gem that provides RCON commands for frostbite 2 engine games. BF3, BFBC2 and so on
4
+
5
+ == Example usage
6
+
7
+ require 'rubygems'
8
+ require 'frostbitten'
9
+ client = Frostbitten::Client.new("fbrcon://yourserver:yourport")
10
+ client.send "serverinfo"
11
+ => ["OK", "[x86] - Pew Pew! - [HC] - No limitations", "0", "32", "ConquestSmall0", "MP_Subway", "0",
12
+ "2", "2", "350", "350", "0", "", "true", "true", "false", "427121", "246028", "188.126.64.19:25270",
13
+ "v1.863 | A1386 C2.317", "true", "EU", "ams", "SE", "true"]
14
+
15
+ === Another usage
16
+ require 'rubygems'
17
+ require 'frostbitten'
18
+ Frostbitten::setup("fbrcon://yourserver:yourport")
19
+ Frostbitten::players
20
+ => [#<Frostbitten::Player deaths="0" guid="" kills="9" name="-I-Kaktus-I-" score="2291" squad_id="32"
21
+ team_id="1">, #<Frostbitten::Player deaths="1" guid="" kills="0" name="Umalswe" score="210" squad_id="3"
22
+ team_id="1">]
23
+
24
+ == Method
25
+ Implemented methods:
26
+ * serverinfo
27
+ * listPlayers
28
+ * mapList.list
29
+
30
+ More to come
31
+
32
+ == Contributing to frostbitten
33
+
34
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
35
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
36
+ * Fork the project.
37
+ * Start a feature/bugfix branch.
38
+ * Commit and push until you are happy with your contribution.
39
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
40
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
41
+
42
+ == Copyright
43
+
44
+ Copyright (c) 2013 Emil Palm. See LICENSE.txt for
45
+ further details.
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+ require './lib/frostbitten/version'
14
+
15
+ require 'jeweler'
16
+ t = Jeweler::Tasks.new do |gem|
17
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
18
+ gem.name = "frostbitten"
19
+ gem.homepage = "http://github.com/mrevilme/frostbitten"
20
+ gem.license = "MIT"
21
+ gem.summary = %Q{Gem that provides RCON commands for frostbite 2 engine games. BF3, BFBC2 and so on}
22
+ gem.description = %Q{Gem that provides RCON commands for frostbite 2 engine games. BF3, BFBC2 and so on}
23
+ gem.email = "emil.palm@x86.nu"
24
+ gem.authors = ["Emil Palm"]
25
+ gem.version = Frostbitten::Version::STRING
26
+ gem.extensions = FileList['ext/**/extconf.rb']
27
+ # dependencies defined in Gemfile
28
+ end
29
+ Jeweler::RubygemsDotOrgTasks.new
30
+
31
+ require 'rspec/core/rake_task'
32
+
33
+ RSpec::Core::RakeTask.new('spec')
34
+
35
+ task :default => :spec
36
+
37
+ require 'rake/extensiontask'
38
+ Rake::ExtensionTask.new('native', t.jeweler.gemspec) do |r|
39
+ r.lib_dir = 'lib/frostbitten'
40
+ r.ext_dir = 'ext/frostbitten'
41
+ end
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "frostbitten #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/ext/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,213 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ # V=0 quiet, V=1 verbose. other values don't work.
5
+ V = 0
6
+ Q1 = $(V:1=)
7
+ Q = $(Q1:0=@)
8
+ n=$(NULLCMD)
9
+ ECHO1 = $(V:1=@$n)
10
+ ECHO = $(ECHO1:0=@echo)
11
+
12
+ #### Start of system configuration section. ####
13
+
14
+ srcdir = .
15
+ topdir = /Users/emilpalm/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1
16
+ hdrdir = /Users/emilpalm/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1
17
+ arch_hdrdir = /Users/emilpalm/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/$(arch)
18
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
19
+ prefix = $(DESTDIR)/Users/emilpalm/.rvm/rubies/ruby-1.9.3-p194
20
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
21
+ exec_prefix = $(prefix)
22
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
23
+ sitehdrdir = $(rubyhdrdir)/site_ruby
24
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
25
+ vendordir = $(rubylibprefix)/vendor_ruby
26
+ sitedir = $(rubylibprefix)/site_ruby
27
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
28
+ mandir = $(datarootdir)/man
29
+ localedir = $(datarootdir)/locale
30
+ libdir = $(exec_prefix)/lib
31
+ psdir = $(docdir)
32
+ pdfdir = $(docdir)
33
+ dvidir = $(docdir)
34
+ htmldir = $(docdir)
35
+ infodir = $(datarootdir)/info
36
+ docdir = $(datarootdir)/doc/$(PACKAGE)
37
+ oldincludedir = $(DESTDIR)/usr/include
38
+ includedir = $(prefix)/include
39
+ localstatedir = $(prefix)/var
40
+ sharedstatedir = $(prefix)/com
41
+ sysconfdir = $(prefix)/etc
42
+ datadir = $(datarootdir)
43
+ datarootdir = $(prefix)/share
44
+ libexecdir = $(exec_prefix)/libexec
45
+ sbindir = $(exec_prefix)/sbin
46
+ bindir = $(exec_prefix)/bin
47
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
48
+ archdir = $(rubylibdir)/$(arch)
49
+ sitelibdir = $(sitedir)/$(ruby_version)
50
+ sitearchdir = $(sitelibdir)/$(sitearch)
51
+ vendorlibdir = $(vendordir)/$(ruby_version)
52
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
53
+
54
+ NULLCMD = :
55
+
56
+ CC = clang
57
+ CXX = clang++
58
+ LIBRUBY = $(LIBRUBY_SO)
59
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
60
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
61
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
62
+ OUTFLAG = -o
63
+ COUTFLAG = -o
64
+
65
+ RUBY_EXTCONF_H =
66
+ cflags = $(optflags) $(debugflags) $(warnflags)
67
+ optflags = -O3
68
+ debugflags = -g3
69
+ warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration
70
+ CFLAGS = -fno-common $(cflags) -fno-common -pipe $(ARCH_FLAG)
71
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
72
+ DEFS =
73
+ CPPFLAGS = -I/Users/emilpalm/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
74
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
75
+ ldflags = -L.
76
+ dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
77
+ ARCH_FLAG =
78
+ DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
79
+ LDSHARED = $(CC) -dynamic -bundle
80
+ LDSHAREDXX = $(CXX) -dynamic -bundle
81
+ AR = ar
82
+ EXEEXT =
83
+
84
+ RUBY_BASE_NAME = ruby
85
+ RUBY_INSTALL_NAME = ruby
86
+ RUBY_SO_NAME = ruby.1.9.1
87
+ arch = x86_64-darwin11.4.2
88
+ sitearch = $(arch)
89
+ ruby_version = 1.9.1
90
+ ruby = /Users/emilpalm/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
91
+ RUBY = $(ruby)
92
+ RM = rm -f
93
+ RM_RF = $(RUBY) -run -e rm -- -rf
94
+ RMDIRS = rmdir -p
95
+ MAKEDIRS = mkdir -p
96
+ INSTALL = /usr/bin/install -c
97
+ INSTALL_PROG = $(INSTALL) -m 0755
98
+ INSTALL_DATA = $(INSTALL) -m 644
99
+ COPY = cp
100
+
101
+ #### End of system configuration section. ####
102
+
103
+ preload =
104
+
105
+ libpath = . $(libdir) /Users/emilpalm/.rvm/usr/lib
106
+ LIBPATH = -L. -L$(libdir) -L/Users/emilpalm/.rvm/usr/lib
107
+ DEFFILE =
108
+
109
+ CLEANFILES = mkmf.log
110
+ DISTCLEANFILES =
111
+ DISTCLEANDIRS =
112
+
113
+ extout =
114
+ extout_prefix =
115
+ target_prefix = /frostbitten
116
+ LOCAL_LIBS =
117
+ LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
118
+ SRCS = header.c message.c native.c packet.c word.c
119
+ OBJS = header.o message.o native.o packet.o word.o
120
+ TARGET = native
121
+ DLLIB = $(TARGET).bundle
122
+ EXTSTATIC =
123
+ STATIC_LIB =
124
+
125
+ BINDIR = $(bindir)
126
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
127
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
128
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
129
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
130
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
131
+
132
+ TARGET_SO = $(DLLIB)
133
+ CLEANLIBS = $(TARGET).bundle
134
+ CLEANOBJS = *.o *.bak
135
+
136
+ all: $(DLLIB)
137
+ static: $(STATIC_LIB)
138
+ .PHONY: all install static install-so install-rb
139
+ .PHONY: clean clean-so clean-rb
140
+
141
+ clean-rb-default::
142
+ clean-rb::
143
+ clean-so::
144
+ clean: clean-so clean-rb-default clean-rb
145
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
146
+
147
+ distclean-rb-default::
148
+ distclean-rb::
149
+ distclean-so::
150
+ distclean: clean distclean-so distclean-rb-default distclean-rb
151
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
152
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
153
+ @-$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
154
+
155
+ realclean: distclean
156
+ install: install-so install-rb
157
+
158
+ install-so: $(RUBYARCHDIR)
159
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
160
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
161
+ @-$(MAKEDIRS) $(@D)
162
+ $(INSTALL_PROG) $(DLLIB) $(@D)
163
+ install-rb: pre-install-rb install-rb-default
164
+ install-rb-default: pre-install-rb-default
165
+ pre-install-rb: Makefile
166
+ pre-install-rb-default: Makefile
167
+ pre-install-rb-default:
168
+ $(ECHO) installing default native libraries
169
+ $(RUBYARCHDIR):
170
+ $(Q) $(MAKEDIRS) $@
171
+
172
+ site-install: site-install-so site-install-rb
173
+ site-install-so: install-so
174
+ site-install-rb: install-rb
175
+
176
+ .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
177
+
178
+ .cc.o:
179
+ $(ECHO) compiling $(<)
180
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
181
+
182
+ .mm.o:
183
+ $(ECHO) compiling $(<)
184
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
185
+
186
+ .cxx.o:
187
+ $(ECHO) compiling $(<)
188
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
189
+
190
+ .cpp.o:
191
+ $(ECHO) compiling $(<)
192
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
193
+
194
+ .C.o:
195
+ $(ECHO) compiling $(<)
196
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
197
+
198
+ .c.o:
199
+ $(ECHO) compiling $(<)
200
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
201
+
202
+ .m.o:
203
+ $(ECHO) compiling $(<)
204
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
205
+
206
+ $(DLLIB): $(OBJS) Makefile
207
+ $(ECHO) linking shared-object frostbitten/$(DLLIB)
208
+ @-$(RM) $(@)
209
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
210
+
211
+
212
+
213
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h