wingman 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ spec/rails/rails-*
data/Appraisals ADDED
@@ -0,0 +1,3 @@
1
+ appraise 'rails-3.2' do
2
+ gem 'rails', '3.2.0'
3
+ end
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in wingman.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'appraisal'
3
+ require 'rspec/core/rake_task'
4
+
5
+ namespace :wingman do
6
+
7
+ desc "Set up current environment variables"
8
+ task :env do
9
+ require 'rails/version'
10
+ ENV[ 'WINGMAN_RAILS_NAME' ] = "rails-#{Rails::VERSION::STRING}"
11
+ ENV[ 'WINGMAN_RAILS_PATH' ] = "spec/rails/#{ENV[ 'WINGMAN_RAILS_NAME' ]}"
12
+ end
13
+
14
+ desc "Remove all test rails apps"
15
+ task :clean => [ :env ] do
16
+ Dir[ 'spec/rails/rails-*' ].each do |app|
17
+ FileUtils.rm_rf app
18
+ end
19
+ end
20
+
21
+ desc "Create a test rails app if necessary"
22
+ task :rails do
23
+ if File.exist? ENV[ 'WINGMAN_RAILS_PATH' ]
24
+ puts "Using existing #{ENV[ 'WINGMAN_RAILS_NAME' ]} app"
25
+ else
26
+ sh "bundle exec rails new #{ENV[ 'WINGMAN_RAILS_PATH' ]} -m spec/support/rails_template.rb"
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ RSpec::Core::RakeTask.new :spec => [ :'wingman:env', :'wingman:rails' ]
@@ -0,0 +1,16 @@
1
+ module Wingman
2
+ class StatusController < ActionController::Base
3
+
4
+ respond_to :json, :only => :status
5
+
6
+ def status
7
+
8
+ render :json => {
9
+ :current_time => Time.now.utc.to_s
10
+ }
11
+ end
12
+
13
+ def index
14
+ end
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ <h1>sup</h1>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ Wingman::Engine.routes.draw do
2
+
3
+ get '/status' => 'status#status'
4
+
5
+ root :to => 'status#index'
6
+ end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "3.2.0"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,118 @@
1
+ PATH
2
+ remote: /Users/jeremy.ruppel/Git/wingman
3
+ specs:
4
+ wingman (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (3.2.0)
10
+ actionpack (= 3.2.0)
11
+ mail (~> 2.4.0)
12
+ actionpack (3.2.0)
13
+ activemodel (= 3.2.0)
14
+ activesupport (= 3.2.0)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ journey (~> 1.0.0)
18
+ rack (~> 1.4.0)
19
+ rack-cache (~> 1.1)
20
+ rack-test (~> 0.6.1)
21
+ sprockets (~> 2.1.2)
22
+ activemodel (3.2.0)
23
+ activesupport (= 3.2.0)
24
+ builder (~> 3.0.0)
25
+ activerecord (3.2.0)
26
+ activemodel (= 3.2.0)
27
+ activesupport (= 3.2.0)
28
+ arel (~> 3.0.0)
29
+ tzinfo (~> 0.3.29)
30
+ activeresource (3.2.0)
31
+ activemodel (= 3.2.0)
32
+ activesupport (= 3.2.0)
33
+ activesupport (3.2.0)
34
+ i18n (~> 0.6)
35
+ multi_json (~> 1.0)
36
+ appraisal (0.4.1)
37
+ bundler
38
+ rake
39
+ arel (3.0.2)
40
+ builder (3.0.0)
41
+ diff-lcs (1.1.3)
42
+ erubis (2.7.0)
43
+ hike (1.2.1)
44
+ i18n (0.6.0)
45
+ journey (1.0.2)
46
+ json (1.6.5)
47
+ mail (2.4.1)
48
+ i18n (>= 0.4.0)
49
+ mime-types (~> 1.16)
50
+ treetop (~> 1.4.8)
51
+ mime-types (1.17.2)
52
+ multi_json (1.1.0)
53
+ polyglot (0.3.3)
54
+ rack (1.4.1)
55
+ rack-cache (1.1)
56
+ rack (>= 0.4)
57
+ rack-ssl (1.3.2)
58
+ rack
59
+ rack-test (0.6.1)
60
+ rack (>= 1.0)
61
+ rails (3.2.0)
62
+ actionmailer (= 3.2.0)
63
+ actionpack (= 3.2.0)
64
+ activerecord (= 3.2.0)
65
+ activeresource (= 3.2.0)
66
+ activesupport (= 3.2.0)
67
+ bundler (~> 1.0)
68
+ railties (= 3.2.0)
69
+ railties (3.2.0)
70
+ actionpack (= 3.2.0)
71
+ activesupport (= 3.2.0)
72
+ rack-ssl (~> 1.3.2)
73
+ rake (>= 0.8.7)
74
+ rdoc (~> 3.4)
75
+ thor (~> 0.14.6)
76
+ rake (0.9.2.2)
77
+ rdoc (3.12)
78
+ json (~> 1.4)
79
+ rspec (2.8.0)
80
+ rspec-core (~> 2.8.0)
81
+ rspec-expectations (~> 2.8.0)
82
+ rspec-mocks (~> 2.8.0)
83
+ rspec-core (2.8.0)
84
+ rspec-expectations (2.8.0)
85
+ diff-lcs (~> 1.1.2)
86
+ rspec-mocks (2.8.0)
87
+ rspec-rails (2.8.1)
88
+ actionpack (>= 3.0)
89
+ activesupport (>= 3.0)
90
+ railties (>= 3.0)
91
+ rspec (~> 2.8.0)
92
+ shoulda (3.0.0.beta2)
93
+ shoulda-context (~> 1.0.0.beta1)
94
+ shoulda-matchers (~> 1.0.0.beta1)
95
+ shoulda-context (1.0.0)
96
+ shoulda-matchers (1.0.0)
97
+ sprockets (2.1.2)
98
+ hike (~> 1.2)
99
+ rack (~> 1.0)
100
+ tilt (~> 1.1, != 1.3.0)
101
+ sqlite3 (1.3.5)
102
+ thor (0.14.6)
103
+ tilt (1.3.3)
104
+ treetop (1.4.10)
105
+ polyglot
106
+ polyglot (>= 0.3.1)
107
+ tzinfo (0.3.31)
108
+
109
+ PLATFORMS
110
+ ruby
111
+
112
+ DEPENDENCIES
113
+ appraisal (= 0.4.1)
114
+ rails (= 3.2.0)
115
+ rspec-rails (= 2.8.1)
116
+ shoulda
117
+ sqlite3
118
+ wingman!
data/lib/wingman.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'wingman/version'
2
+
3
+ module Wingman
4
+ autoload :Engine, 'wingman/engine'
5
+ end
6
+
7
+ require 'wingman/engine' if defined?(Rails)
@@ -0,0 +1,8 @@
1
+ require 'rails/engine'
2
+
3
+ module Wingman
4
+ class Engine < Rails::Engine
5
+ isolate_namespace Wingman
6
+
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Wingman
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wingman::StatusController do
4
+
5
+ # any better suggestions?
6
+ # http://stackoverflow.com/questions/7691594/how-to-test-routes-in-a-rails-3-1-mountable-engine
7
+ before :each do
8
+ @routes = Wingman::Engine.routes
9
+ end
10
+
11
+ context 'GET index' do
12
+
13
+ it { should route( :get, '/' ).to( :action => :index ) }
14
+
15
+ before do
16
+ get :index
17
+ end
18
+
19
+ it { should respond_with( :success ) }
20
+ it { should respond_with_content_type( :html ) }
21
+ it { should render_template( :index ) }
22
+ end
23
+
24
+ context 'GET status' do
25
+
26
+ it { should route( :get, '/status.json' ).to( :action => :status, :format => :json ) }
27
+
28
+ before do
29
+ get :status, :format => :json
30
+ end
31
+
32
+ it { should respond_with( :success ) }
33
+ it { should respond_with_content_type( :json ) }
34
+
35
+ describe 'the response body' do
36
+ subject { JSON.parse response.body, :symbolize_names => true }
37
+
38
+ it { should eq(
39
+
40
+ {
41
+ :current_time => Time.now.utc.to_s
42
+ }
43
+
44
+ ) }
45
+ end
46
+ end
47
+ end
File without changes
@@ -0,0 +1,24 @@
1
+ # Set the environment variables for the test app
2
+ ENV[ 'RAILS_ENV' ] = 'test'
3
+ # ENV[ 'RAILS_ROOT' ] =
4
+
5
+ # Add the test app to the load path
6
+ $: << ENV[ 'WINGMAN_RAILS_PATH' ]
7
+
8
+ # Require all dependencies
9
+ Bundler.require
10
+
11
+ # Boot the rails app
12
+ require 'config/environment'
13
+
14
+ # Require test dependencies *after* rails
15
+ require 'rspec/rails'
16
+ require 'shoulda'
17
+
18
+ # Configure RSpec
19
+ RSpec.configure do |config|
20
+ # Use color
21
+ config.color_enabled = true
22
+ # Change the formatter
23
+ config.formatter = :documentation
24
+ end
@@ -0,0 +1,16 @@
1
+ # Clean up the app a bit
2
+ run 'rm -r test'
3
+ run 'rm -r doc'
4
+ run 'rm -r README.rdoc'
5
+ run 'rm -r vendor'
6
+
7
+ # Add our wingman dependency
8
+ gem 'wingman'
9
+
10
+ # Mount the wingman app
11
+ route "mount Wingman::Engine => '/status'"
12
+
13
+ # Create the wingman initializer
14
+ # initializer 'wingman.rb', <<-CODE
15
+ # # TODO write the initializer
16
+ # CODE
data/wingman.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "wingman/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "wingman"
7
+ s.version = Wingman::VERSION
8
+ s.authors = ["Jeremy Ruppel"]
9
+ s.email = ["jeremy.ruppel@gmail.com"]
10
+ s.homepage = "https://github.com/jeremyruppel/wingman"
11
+ s.summary = %q{DO NOT USE YET}
12
+ s.description = %q{DO NOT USE YET}
13
+
14
+ s.rubyforge_project = "wingman"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+
25
+ s.add_development_dependency 'sqlite3'
26
+ s.add_development_dependency 'appraisal', '0.4.1'
27
+ s.add_development_dependency 'rspec-rails', '2.8.1'
28
+ s.add_development_dependency 'shoulda'
29
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wingman
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jeremy Ruppel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sqlite3
16
+ requirement: &2164725820 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2164725820
25
+ - !ruby/object:Gem::Dependency
26
+ name: appraisal
27
+ requirement: &2164725180 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - =
31
+ - !ruby/object:Gem::Version
32
+ version: 0.4.1
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2164725180
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec-rails
38
+ requirement: &2164724540 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - =
42
+ - !ruby/object:Gem::Version
43
+ version: 2.8.1
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2164724540
47
+ - !ruby/object:Gem::Dependency
48
+ name: shoulda
49
+ requirement: &2164723820 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2164723820
58
+ description: DO NOT USE YET
59
+ email:
60
+ - jeremy.ruppel@gmail.com
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - .gitignore
66
+ - Appraisals
67
+ - Gemfile
68
+ - Rakefile
69
+ - app/controllers/wingman/status_controller.rb
70
+ - app/views/wingman/status/index.html.erb
71
+ - config/routes.rb
72
+ - gemfiles/rails-3.2.gemfile
73
+ - gemfiles/rails-3.2.gemfile.lock
74
+ - lib/wingman.rb
75
+ - lib/wingman/engine.rb
76
+ - lib/wingman/version.rb
77
+ - spec/controllers/status_controller_spec.rb
78
+ - spec/rails/.gitkeep
79
+ - spec/spec_helper.rb
80
+ - spec/support/rails_template.rb
81
+ - wingman.gemspec
82
+ homepage: https://github.com/jeremyruppel/wingman
83
+ licenses: []
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project: wingman
102
+ rubygems_version: 1.8.15
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: DO NOT USE YET
106
+ test_files:
107
+ - spec/controllers/status_controller_spec.rb
108
+ - spec/rails/.gitkeep
109
+ - spec/spec_helper.rb
110
+ - spec/support/rails_template.rb