eve 1.0.2 → 2.0.1

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.
Files changed (50) hide show
  1. data/.gitignore +43 -0
  2. data/Gemfile +17 -0
  3. data/Gemfile.lock +109 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +24 -3
  6. data/Rakefile +26 -117
  7. data/eve.gemspec +35 -0
  8. data/lib/eve.rb +5 -10
  9. data/lib/eve/api.rb +3 -1
  10. data/lib/eve/api/response/inspection.rb +1 -1
  11. data/lib/eve/api/response/rowsets.rb +1 -1
  12. data/lib/eve/dependencies.rb +42 -12
  13. data/lib/eve/deprecation.rb +3 -0
  14. data/lib/eve/javascript_helper.rb +196 -0
  15. data/lib/eve/trust.rb +1 -2
  16. data/lib/eve/trust/controller_helpers.rb +62 -66
  17. data/lib/eve/trust/igb_interface.rb +14 -10
  18. data/lib/eve/version.rb +8 -0
  19. data/spec/controllers/controller_helpers_spec.rb +91 -0
  20. data/spec/{lib/eve/helpers → helpers}/javascript_helper_spec.rb +2 -2
  21. data/spec/helpers/view_helper_spec.rb +7 -0
  22. data/spec/lib/eve/api/calls/eve/character_id_spec.rb +8 -8
  23. data/spec/lib/eve/api/calls/server_status_spec.rb +4 -0
  24. data/spec/lib/eve/api/request_spec.rb +1 -0
  25. data/spec/lib/eve/trust/igb_interface_spec.rb +5 -5
  26. data/spec/spec_helper.rb +42 -1
  27. data/spec/support/controllers/trust_controller.rb +18 -1
  28. data/spec/support/mock_api_helpers.rb +6 -1
  29. data/spec/support/views/trust/html_and_igb.html.erb +1 -0
  30. data/spec/support/views/trust/html_and_igb.igb.erb +1 -0
  31. data/spec/support/views/trust/html_only.html.erb +1 -0
  32. data/spec/support/views/trust/igb_only.igb.erb +1 -0
  33. metadata +226 -169
  34. data/Manifest.txt +0 -174
  35. data/PostInstall.txt +0 -6
  36. data/features/support/env.rb +0 -1
  37. data/lib/eve/core_extensions.rb +0 -3
  38. data/lib/eve/core_extensions/hash.rb +0 -51
  39. data/lib/eve/core_extensions/string.rb +0 -11
  40. data/lib/eve/helpers.rb +0 -12
  41. data/lib/eve/helpers/javascript_helper.rb +0 -198
  42. data/lib/eve/helpers/view_helper.rb +0 -13
  43. data/script/console +0 -10
  44. data/script/console.cmd +0 -1
  45. data/script/destroy +0 -14
  46. data/script/destroy.cmd +0 -1
  47. data/script/generate +0 -14
  48. data/script/generate.cmd +0 -1
  49. data/spec/lib/eve/helpers/view_helper_spec.rb +0 -12
  50. data/spec/lib/eve/trust/controller_helpers_spec.rb +0 -70
@@ -0,0 +1,43 @@
1
+ api_key.yml
2
+ **/api_key.yml
3
+ .idea
4
+ .svn
5
+ coverage.data
6
+ coverage
7
+ **/coverage
8
+ pkg
9
+ dry-run
10
+ doc
11
+ t.rb
12
+ rdoc
13
+
14
+ #ignore thumbnails created by windows
15
+ Thumbs.db
16
+ #Ignore files build by Visual Studio
17
+ *.obj
18
+ *.exe
19
+ *.pdb
20
+ *.user
21
+ *.aps
22
+ *.pch
23
+ *.vspscc
24
+ *_i.c
25
+ *_p.c
26
+ *.ncb
27
+ *.suo
28
+ *.tlb
29
+ *.tlh
30
+ *.bak
31
+ *.cache
32
+ *.ilk
33
+ *.log
34
+ [Bb]in
35
+ [Dd]ebug*/
36
+ *.lib
37
+ *.sbr
38
+ obj/
39
+ [Rr]elease*/
40
+ _ReSharper*/
41
+ [Tt]est[Rr]esult*
42
+ .rvmrc
43
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 3.0"
5
+ # gem "actionpack", ">= 3.0"
6
+ gem "hpricot", "= 0.8.2"
7
+ gem 'sc-core-ext'
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ gem 'rails'
13
+ gem "rspec-rails", "~> 2.1.0"
14
+ gem "bundler", "~> 1.0.0"
15
+ gem "jeweler", "~> 1.5.1"
16
+ # gem "rcov", ">= 0"
17
+ end
@@ -0,0 +1,109 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.1)
5
+ actionpack (= 3.2.1)
6
+ mail (~> 2.4.0)
7
+ actionpack (3.2.1)
8
+ activemodel (= 3.2.1)
9
+ activesupport (= 3.2.1)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.1)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.1)
18
+ activesupport (= 3.2.1)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.1)
21
+ activemodel (= 3.2.1)
22
+ activesupport (= 3.2.1)
23
+ arel (~> 3.0.0)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.1)
26
+ activemodel (= 3.2.1)
27
+ activesupport (= 3.2.1)
28
+ activesupport (3.2.1)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.0)
32
+ builder (3.0.0)
33
+ diff-lcs (1.1.3)
34
+ erubis (2.7.0)
35
+ git (1.2.5)
36
+ hike (1.2.1)
37
+ hpricot (0.8.2)
38
+ i18n (0.6.0)
39
+ jeweler (1.5.2)
40
+ bundler (~> 1.0.0)
41
+ git (>= 1.2.5)
42
+ rake
43
+ journey (1.0.1)
44
+ json (1.6.5)
45
+ mail (2.4.1)
46
+ i18n (>= 0.4.0)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.17.2)
50
+ multi_json (1.0.4)
51
+ polyglot (0.3.3)
52
+ rack (1.4.1)
53
+ rack-cache (1.1)
54
+ rack (>= 0.4)
55
+ rack-ssl (1.3.2)
56
+ rack
57
+ rack-test (0.6.1)
58
+ rack (>= 1.0)
59
+ rails (3.2.1)
60
+ actionmailer (= 3.2.1)
61
+ actionpack (= 3.2.1)
62
+ activerecord (= 3.2.1)
63
+ activeresource (= 3.2.1)
64
+ activesupport (= 3.2.1)
65
+ bundler (~> 1.0)
66
+ railties (= 3.2.1)
67
+ railties (3.2.1)
68
+ actionpack (= 3.2.1)
69
+ activesupport (= 3.2.1)
70
+ rack-ssl (~> 1.3.2)
71
+ rake (>= 0.8.7)
72
+ rdoc (~> 3.4)
73
+ thor (~> 0.14.6)
74
+ rake (0.9.2.2)
75
+ rdoc (3.12)
76
+ json (~> 1.4)
77
+ rspec (2.1.0)
78
+ rspec-core (~> 2.1.0)
79
+ rspec-expectations (~> 2.1.0)
80
+ rspec-mocks (~> 2.1.0)
81
+ rspec-core (2.1.0)
82
+ rspec-expectations (2.1.0)
83
+ diff-lcs (~> 1.1.2)
84
+ rspec-mocks (2.1.0)
85
+ rspec-rails (2.1.0)
86
+ rspec (~> 2.1.0)
87
+ sc-core-ext (1.2.1)
88
+ activesupport (>= 2.3.5)
89
+ sprockets (2.1.2)
90
+ hike (~> 1.2)
91
+ rack (~> 1.0)
92
+ tilt (~> 1.1, != 1.3.0)
93
+ thor (0.14.6)
94
+ tilt (1.3.3)
95
+ treetop (1.4.10)
96
+ polyglot
97
+ polyglot (>= 0.3.1)
98
+ tzinfo (0.3.31)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ bundler (~> 1.0.0)
105
+ hpricot (= 0.8.2)
106
+ jeweler (~> 1.5.1)
107
+ rails
108
+ rspec-rails (~> 2.1.0)
109
+ sc-core-ext
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Colin MacKenzie IV
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.
@@ -11,15 +11,36 @@ stand-alone application or script using this library.
11
11
  == QUICK START:
12
12
 
13
13
  === Including The Gem
14
- In Rails:
15
- config.gem 'eve'
14
+ In Rails 3:
15
+
16
+ gem 'eve'
17
+
18
+ In Rails 2:
19
+
20
+ # Please note that the Rails 2 version of this gem is no longer being maintained, so
21
+ # you will need to download a 1.x version of the gem.
22
+ config.gem 'eve', :version => "~> 1.0"
23
+
16
24
  In Pure Ruby:
17
25
  require 'rubygems'
18
26
  require 'eve'
19
27
 
20
28
  === Usage Example: Controller
21
29
  class MyEveCompatibleController < ApplicationController
22
- requires_trust # or, requires_trust "with a custom trust message: please click yes"
30
+ requires_trust
31
+ end
32
+
33
+ Rails 3: This returns a blank page with a trust request. This behavior can be overridden with an initializer to provide custom trust request pages:
34
+ module Eve
35
+ module Trust
36
+ module ControllerHelpers
37
+ def require_trust(trust_message = self.class.trust_message)
38
+ if igb? && !igb.trusted?
39
+ render :text => "<center>Requires trust!</br><a href=\"#\" onclick=\"CCPEVE.requestTrust('http://#{request.host_with_port}/')\">give trust</a>", :layout => false
40
+ end
41
+ end
42
+ end
43
+ end
23
44
  end
24
45
 
25
46
  === Usage Example: View Helpers
data/Rakefile CHANGED
@@ -1,128 +1,37 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/eve'
6
-
7
- def rcov_opts
8
- IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
9
- end
10
-
11
- Hoe.plugin :newgem
12
- # Hoe.plugin :website
13
- # Hoe.plugin :cucumberfeatures
14
-
15
- # Generate all the Rake tasks
16
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
17
- $hoe = Hoe.spec 'eve' do
18
- self.version = Eve::VERSION
19
- #self.summary = Eve::VERSION::SUMMARY
20
- self.description = "A Ruby library for interfacing with all aspects of the EVE Online MMO. It is designed for use "+
21
- "within a Ruby on Rails project, but does not require Rails as a dependency. That means there is nothing "+
22
- "preventing you from writing a stand-alone application or script using this library."
23
- self.developer('Colin MacKenzie IV', 'sinisterchipmunk@gmail.com')
24
- self.url = ('http://github.com/sinisterchipmunk/eve')
25
- self.extra_deps << ["activesupport",">=2.3.5"] << ["hpricot",">=0.8.2"] << ["actionpack",">=2.3.5"]
26
- self.extra_dev_deps << ["cucumber",">=0.6.2"] << ["rspec",">=1.3.0"] << ["rcov",">=0.9.8"]
27
- self.rspec_options = ['--options', 'spec/spec.opts']
28
- #self.history_file = 'History.rdoc'
29
- self.readme_file = 'README.rdoc'
30
- self.post_install_message = ""
31
- end
32
-
33
- remove_task :docs
34
-
35
- Rake::RDocTask.new(:docs) do |rdoc|
36
- files = ['README.rdoc', # 'LICENSE', 'CHANGELOG',
37
- 'lib/**/*.rb', 'doc/**/*.rdoc']#, 'spec/*.rb']
38
- rdoc.rdoc_files.add(files)
39
- rdoc.main = 'README.rdoc'
40
- rdoc.title = 'EVE Documentation'
41
- #rdoc.template = '/path/to/gems/allison-2.0/lib/allison'
42
- rdoc.rdoc_dir = 'doc'
43
- rdoc.options << '--line-numbers' << '--inline-source'
44
- end
45
-
46
- require 'newgem/tasks'
47
- Dir['tasks/**/*.rake'].each { |t| load t }
48
-
49
- task :cleanup_rcov_files do
50
- rm_rf 'coverage.data'
51
- end
52
-
53
-
54
- if RUBY_VERSION =~ /^1.8/
55
- task :default => [:cleanup_rcov_files, :features, :verify_rcov]
56
- else
57
- task :default => [:spec, :features]
58
- end
59
-
60
- namespace :spec do
61
- desc "Run all specs with rcov"
62
- Spec::Rake::SpecTask.new(:rcov) do |t|
63
- t.spec_files = FileList['spec/**/*_spec.rb']
64
- t.spec_opts = ['--options', 'spec/spec.opts']
65
- t.rcov = true
66
- t.rcov_dir = 'coverage'
67
- t.rcov_opts = rcov_opts
68
- end
69
-
70
- desc "Run files listed in spec/spec_files.txt"
71
- Spec::Rake::SpecTask.new(:focus) do |t|
72
- if File.exists?('spec/spec_files.txt')
73
- t.spec_files = File.readlines('spec/spec_files.txt').collect{|f| f.chomp}
74
- end
75
- end
76
- end
77
-
78
1
  begin
79
- require 'cucumber/rake/task'
80
- desc "Run Cucumber features"
81
- if RUBY_VERSION =~ /^1.8/
82
- Cucumber::Rake::Task.new :features do |t|
83
- t.rcov = true
84
- t.rcov_opts = rcov_opts
85
- t.cucumber_opts = %w{--format progress}
86
- end
87
- else
88
- task :features do
89
- sh 'cucumber --profile no_heckle'
90
- end
91
- end
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+ Bundler.setup
92
6
  rescue LoadError
93
- puts "You need cucumber installed to run cucumber tasks"
7
+ puts " *** You don't seem to have Bundler installed. ***"
8
+ puts " Please run the following command:"
9
+ puts
10
+ puts " gem install bundler"
11
+ exit
94
12
  end
95
13
 
96
- def egrep(pattern)
97
- Dir['**/*.rb'].each do |fn|
98
- count = 0
99
- open(fn) do |f|
100
- while line = f.gets
101
- count += 1
102
- if line =~ pattern
103
- puts "#{fn}:#{count}:#{line}"
104
- end
105
- end
106
- end
107
- end
14
+ require 'rake'
15
+ require 'rspec/core'
16
+ require 'rspec/core/rake_task'
17
+ RSpec::Core::RakeTask.new(:spec) do |spec|
18
+ spec.pattern = FileList['spec/**/*_spec.rb']
108
19
  end
109
20
 
110
- desc "Look for TODO and FIXME tags in the code"
111
- task :todo do
112
- egrep /(FIXME|TODO|TBD)/
21
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
22
+ spec.pattern = 'spec/**/*_spec.rb'
23
+ spec.rcov = true
113
24
  end
114
25
 
115
- namespace :update do
116
- desc "update the manifest"
117
- task :manifest do
118
- system %q[touch Manifest.txt; rake check_manifest | grep -v "(in " | patch]
119
- end
120
- end
26
+ task :default => :spec
121
27
 
122
- task :clobber => :clobber_tmp
28
+ require 'rdoc/task'
29
+ RDoc::Task.new do |rdoc|
30
+ require './lib/eve/version'
31
+ version = Eve::VERSION
123
32
 
124
- task :clobber_tmp do
125
- cmd = %q[rm -r tmp]
126
- puts cmd
127
- system cmd if test ?d, 'tmp'
33
+ rdoc.rdoc_dir = 'rdoc'
34
+ rdoc.title = "eve #{version}"
35
+ rdoc.rdoc_files.include('README*')
36
+ rdoc.rdoc_files.include('lib/**/*.rb')
128
37
  end
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.expand_path('lib/eve/version', File.dirname(__FILE__))
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "eve"
7
+ s.version = Eve::VERSION
8
+
9
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.authors = ["Colin MacKenzie IV"]
11
+ s.date = "2012-02-15"
12
+ s.description = "A Ruby library for interfacing with all aspects of the EVE Online MMO. It is designed for use within a Ruby on Rails project, but does not require Rails as a dependency. That means there is nothing preventing you from writing a stand-alone application or script using this library."
13
+ s.email = "sinisterchipmunk@gmail.com"
14
+ s.extra_rdoc_files = [
15
+ "LICENSE.txt",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/**/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n")
21
+
22
+ s.homepage = "http://thoughtsincomputation.com"
23
+ s.licenses = ["MIT"]
24
+ s.require_paths = ["lib"]
25
+ s.rubygems_version = "1.8.10"
26
+ s.summary = "A Ruby library for interfacing with all aspects of the EVE Online MMO."
27
+
28
+ s.add_runtime_dependency 'hpricot', "= 0.8.2"
29
+ s.add_runtime_dependency 'activesupport', "~> 3.2"
30
+
31
+ s.add_development_dependency 'rails', ">= 0"
32
+ s.add_development_dependency 'rspec-rails', "~> 2.1.0"
33
+ s.add_development_dependency 'bundler', "~> 1.0.0"
34
+ end
35
+
data/lib/eve.rb CHANGED
@@ -2,15 +2,8 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  require 'eve/dependencies'
5
- require 'eve/core_extensions'
6
- require 'eve/errors'
7
- require 'eve/api'
8
- require 'eve/trust'
9
- require 'eve/helpers'
10
5
 
11
6
  module Eve
12
- VERSION = '1.0.2'
13
-
14
7
  class << self
15
8
  def cache_store
16
9
  @cache_store ||= [:file_store, "tmp/eve.cache"]
@@ -23,9 +16,11 @@ module Eve
23
16
 
24
17
  def cache
25
18
  return @cache if @cache
26
- @cache = defined?(Rails) ? Rails.cache : ActiveSupport::Cache.lookup_store(*cache_store)
27
- # @cache.logger = Logger.new($stdout) unless defined?(Rails)
28
- @cache
19
+ @cache = begin
20
+ Rails.cache
21
+ rescue NameError
22
+ ActiveSupport::Cache.lookup_store(*cache_store)
23
+ end
29
24
  end
30
25
  end
31
26
  end