iceburn 0.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 (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +111 -0
  5. data/LICENSE.txt +29 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +67 -0
  8. data/Rakefile +18 -0
  9. data/config/initializers/generators.rb +3 -0
  10. data/iceburn.gemspec +25 -0
  11. data/lib/iceburn.rb +13 -0
  12. data/lib/iceburn/filters.rb +39 -0
  13. data/lib/iceburn/routes.rb +13 -0
  14. data/lib/iceburn/version.rb +3 -0
  15. data/lib/tasks/iceburn_tasks.rake +4 -0
  16. data/spec/dummy/README.rdoc +28 -0
  17. data/spec/dummy/Rakefile +6 -0
  18. data/spec/dummy/app/assets/images/.keep +0 -0
  19. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  20. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  21. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  22. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  23. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  24. data/spec/dummy/app/mailers/.keep +0 -0
  25. data/spec/dummy/app/models/.keep +0 -0
  26. data/spec/dummy/app/models/concerns/.keep +0 -0
  27. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/spec/dummy/bin/bundle +3 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/config.ru +4 -0
  32. data/spec/dummy/config/application.rb +23 -0
  33. data/spec/dummy/config/boot.rb +5 -0
  34. data/spec/dummy/config/database.yml +85 -0
  35. data/spec/dummy/config/environment.rb +5 -0
  36. data/spec/dummy/config/environments/development.rb +37 -0
  37. data/spec/dummy/config/environments/production.rb +83 -0
  38. data/spec/dummy/config/environments/test.rb +39 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/spec/dummy/config/initializers/inflections.rb +16 -0
  43. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  44. data/spec/dummy/config/initializers/session_store.rb +3 -0
  45. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/spec/dummy/config/locales/en.yml +23 -0
  47. data/spec/dummy/config/routes.rb +7 -0
  48. data/spec/dummy/config/secrets.yml +22 -0
  49. data/spec/dummy/lib/assets/.keep +0 -0
  50. data/spec/dummy/log/.keep +0 -0
  51. data/spec/dummy/public/404.html +67 -0
  52. data/spec/dummy/public/422.html +67 -0
  53. data/spec/dummy/public/500.html +66 -0
  54. data/spec/dummy/public/favicon.ico +0 -0
  55. data/spec/iceburn/filters_spec.rb +34 -0
  56. data/spec/iceburn_spec.rb +7 -0
  57. data/spec/spec_helper.rb +17 -0
  58. metadata +198 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 15ec7d1bc64d11c601080c499f2dcc3e30996d7d
4
+ data.tar.gz: de5357cb6bf58044b1db1efcf0777662fe193631
5
+ SHA512:
6
+ metadata.gz: 651426c46b2296ab7a924c62ccf28c4a65b01496ad0d248167c1d1659412e440da5a7cf7790a0f8c6bcf5c0a25b34d6a172ac38a222501108600799451a16a36
7
+ data.tar.gz: 6d1e2a9351e5e0e2ece951c705c4e53b36d19ddb231148430d3ed46d4fa73ddc24a5509e8c978b4d4c77187ba72a6917575ef0a8897b41363c74b1b0084618a4
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
7
+ spec/dummy/.sass-cache
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in iceburn.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ iceburn (0.0.1)
5
+ rails
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.1.1)
11
+ actionpack (= 4.1.1)
12
+ actionview (= 4.1.1)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.1.1)
15
+ actionview (= 4.1.1)
16
+ activesupport (= 4.1.1)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ actionview (4.1.1)
20
+ activesupport (= 4.1.1)
21
+ builder (~> 3.1)
22
+ erubis (~> 2.7.0)
23
+ activemodel (4.1.1)
24
+ activesupport (= 4.1.1)
25
+ builder (~> 3.1)
26
+ activerecord (4.1.1)
27
+ activemodel (= 4.1.1)
28
+ activesupport (= 4.1.1)
29
+ arel (~> 5.0.0)
30
+ activesupport (4.1.1)
31
+ i18n (~> 0.6, >= 0.6.9)
32
+ json (~> 1.7, >= 1.7.7)
33
+ minitest (~> 5.1)
34
+ thread_safe (~> 0.1)
35
+ tzinfo (~> 1.1)
36
+ arel (5.0.1.20140414130214)
37
+ builder (3.2.2)
38
+ diff-lcs (1.2.5)
39
+ erubis (2.7.0)
40
+ hike (1.2.3)
41
+ i18n (0.6.9)
42
+ json (1.8.1)
43
+ mail (2.5.4)
44
+ mime-types (~> 1.16)
45
+ treetop (~> 1.4.8)
46
+ mime-types (1.25.1)
47
+ minitest (5.3.4)
48
+ multi_json (1.10.1)
49
+ pg (0.17.1)
50
+ polyglot (0.3.5)
51
+ rack (1.5.2)
52
+ rack-test (0.6.2)
53
+ rack (>= 1.0)
54
+ rails (4.1.1)
55
+ actionmailer (= 4.1.1)
56
+ actionpack (= 4.1.1)
57
+ actionview (= 4.1.1)
58
+ activemodel (= 4.1.1)
59
+ activerecord (= 4.1.1)
60
+ activesupport (= 4.1.1)
61
+ bundler (>= 1.3.0, < 2.0)
62
+ railties (= 4.1.1)
63
+ sprockets-rails (~> 2.0)
64
+ railties (4.1.1)
65
+ actionpack (= 4.1.1)
66
+ activesupport (= 4.1.1)
67
+ rake (>= 0.8.7)
68
+ thor (>= 0.18.1, < 2.0)
69
+ rake (10.3.2)
70
+ rspec (2.14.1)
71
+ rspec-core (~> 2.14.0)
72
+ rspec-expectations (~> 2.14.0)
73
+ rspec-mocks (~> 2.14.0)
74
+ rspec-core (2.14.8)
75
+ rspec-expectations (2.14.5)
76
+ diff-lcs (>= 1.1.3, < 2.0)
77
+ rspec-mocks (2.14.6)
78
+ rspec-rails (2.14.2)
79
+ actionpack (>= 3.0)
80
+ activemodel (>= 3.0)
81
+ activesupport (>= 3.0)
82
+ railties (>= 3.0)
83
+ rspec-core (~> 2.14.0)
84
+ rspec-expectations (~> 2.14.0)
85
+ rspec-mocks (~> 2.14.0)
86
+ sprockets (2.12.1)
87
+ hike (~> 1.2)
88
+ multi_json (~> 1.0)
89
+ rack (~> 1.0)
90
+ tilt (~> 1.1, != 1.3.0)
91
+ sprockets-rails (2.1.3)
92
+ actionpack (>= 3.0)
93
+ activesupport (>= 3.0)
94
+ sprockets (~> 2.8)
95
+ thor (0.19.1)
96
+ thread_safe (0.3.4)
97
+ tilt (1.4.1)
98
+ treetop (1.4.15)
99
+ polyglot
100
+ polyglot (>= 0.3.1)
101
+ tzinfo (1.2.0)
102
+ thread_safe (~> 0.1)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ iceburn!
109
+ pg
110
+ rspec
111
+ rspec-rails
@@ -0,0 +1,29 @@
1
+ University of Illinois/NCSA Open Source License
2
+
3
+ Copyright (c) 2014 Tom Scott
4
+ All rights reserved.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the "Software"),
8
+ to deal with the Software without restriction, including without limitation
9
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ and/or sell copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following conditions:
12
+
13
+ Redistributions of source code must retain the above copyright notice,
14
+ this list of conditions and the following disclaimers.
15
+
16
+ Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimers in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ None of the names of its contributors may be used to endorse or promote
21
+ products derived from this Software without specific prior written permission.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
24
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE
26
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
27
+ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28
+ DEALINGS WITH THE SOFTWARE.
29
+
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
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.
@@ -0,0 +1,67 @@
1
+ # Iceburn
2
+
3
+ A quick and dirty Rails plugin for client-side javascript apps. Adds
4
+ filters to your controller and routes to your router to allow a
5
+ client-side JS app to take over the entire page.
6
+
7
+ ## Setup
8
+
9
+ Install the gem with Bundler:
10
+
11
+ ```ruby
12
+ gem 'iceburn'
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ Add this mixin to **app/controllers/application_controller.rb**:
18
+
19
+ ```ruby
20
+ class ApplicationController < ActionController::Base
21
+ include Iceburn::Filters
22
+ end
23
+ ```
24
+
25
+ And this one to your **config/routes.rb**:
26
+
27
+ ```ruby
28
+ Rails.application.routes.draw do
29
+ extend Iceburn::Routes
30
+ end
31
+ ```
32
+
33
+ And you'll get a free route that points to 'application#index' and just
34
+ returns an empty string, allowing your JS app to take over the layout.
35
+
36
+ ## License
37
+
38
+ [University of Illinois/NCSA Open Source License][ncsa]
39
+
40
+ Copyright (c) 2014 Tom Scott
41
+ All rights reserved.
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining
44
+ a copy of this software and associated documentation files (the "Software"),
45
+ to deal with the Software without restriction, including without limitation
46
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
47
+ and/or sell copies of the Software, and to permit persons to whom the
48
+ Software is furnished to do so, subject to the following conditions:
49
+
50
+ Redistributions of source code must retain the above copyright notice,
51
+ this list of conditions and the following disclaimers.
52
+
53
+ Redistributions in binary form must reproduce the above copyright notice,
54
+ this list of conditions and the following disclaimers in the documentation
55
+ and/or other materials provided with the distribution.
56
+
57
+ None of the names of its contributors may be used to endorse or promote
58
+ products derived from this Software without specific prior written permission.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
61
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
62
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE
63
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
64
+ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
65
+ DEALINGS WITH THE SOFTWARE.
66
+
67
+ [ncsa]: http://opensource.org/licenses/NCSA
@@ -0,0 +1,18 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_helper'
3
+ require 'rspec/core/rake_task'
4
+ require 'rdoc/task'
5
+
6
+ RDoc::Task.new(:docs) do |rdoc|
7
+ rdoc.rdoc_dir = 'doc'
8
+ rdoc.title = 'Iceburn'
9
+ rdoc.options << '--line-numbers'
10
+ rdoc.rdoc_files.include('README.md')
11
+ rdoc.rdoc_files.include('lib/**/*.rb')
12
+ end
13
+
14
+ Bundler::GemHelper.install_tasks
15
+
16
+ RSpec::Core::RakeTask.new :test
17
+
18
+ task :default => %w(test docs build)
@@ -0,0 +1,3 @@
1
+ Rails.application.config.generators do |g|
2
+ g.test_framework :rspec, fixtures: true, fixture_location: "spec/fixtures"
3
+ end
@@ -0,0 +1,25 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "iceburn/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "iceburn"
9
+ s.version = Iceburn::VERSION
10
+ s.authors = ["Tom Scott"]
11
+ s.email = ["tubbo@psychedeli.ca"]
12
+ s.homepage = "http://github.com/tubbo/iceburn"
13
+ s.summary = "HTTP request hijacker for ActionController and API-driven Rails apps"
14
+ s.description = s.summary
15
+ s.license = "NCSA"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = s.files.grep(/\Aspec/)
19
+
20
+ s.add_dependency "rails"
21
+
22
+ s.add_development_dependency "pg"
23
+ s.add_development_dependency "rspec"
24
+ s.add_development_dependency "rspec-rails"
25
+ end
@@ -0,0 +1,13 @@
1
+ require 'iceburn/version'
2
+ require 'iceburn/filters'
3
+ require 'iceburn/routes'
4
+
5
+ # A library for defining "blank" routes that are returned whenever HTML
6
+ # is requested from the Rails router.
7
+
8
+ module Iceburn
9
+ # Logging util that defaults to the Rails logger.
10
+ def self.logger
11
+ Rails.logger
12
+ end
13
+ end
@@ -0,0 +1,39 @@
1
+ require 'active_support/concern'
2
+
3
+ # The before_filter used to handle HTML requests that aren't caught by
4
+ # the main application routes.
5
+
6
+ module Iceburn
7
+ module Filters
8
+ extend ActiveSupport::Concern
9
+
10
+ included { before_filter :handle_html_requests }
11
+
12
+ # Return blank on all requests to the root path.
13
+ def index
14
+ handle_html_requests
15
+ end
16
+
17
+ # Define this method to enable controllers that have been
18
+ # whitelisted so users can access their HTML view responses.
19
+ def whitelisted_controllers
20
+ []
21
+ end
22
+
23
+ protected
24
+ def handle_html_requests
25
+ return if json_request? || whitelisted?
26
+ return if request.xhr?
27
+ render text: '', layout: 'application' and return # block the rest of the chain
28
+ end
29
+
30
+ private
31
+ def whitelisted?
32
+ whitelisted_controllers.include? params[:controller]
33
+ end
34
+
35
+ def json_request?
36
+ "#{params[:format]}" == 'json'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ module Iceburn
2
+ # Extend your `config/routes.rb` file with these to ensure that the
3
+ # root path is defined and all HTML requests are proxied to Iceburn.
4
+ module Routes
5
+ def iceburn_html!
6
+ get '/*path' => 'application#index'
7
+ #put '/*path' => 'application#index'
8
+ #post '/*path' => 'application#index'
9
+ #delete '/*path' => 'application#index'
10
+ root to: 'application#index'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Iceburn
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :iceburn do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .