chromembed_rails 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +66 -0
- data/Rakefile +4 -1
- data/VERSION +1 -1
- data/chromembed_rails.gemspec +39 -2
- data/lib/chromembed_rails/generators/templates/chrome_extension_caches.yml +0 -3
- data/lib/chromembed_rails/generators/templates/chrome_extension_controller_test.rb +6 -5
- data/lib/chromembed_rails/generators/templates/chrome_extension_initializer.rb +4 -0
- data/lib/chromembed_rails/model.rb +6 -12
- data/lib/chromembed_rails.rb +11 -0
- data/test/chrome_extension_cache_test.rb +23 -0
- data/test/chrome_extension_controller_test.rb +28 -0
- data/test/helpers/application_controller.rb +4 -0
- data/test/helpers/chrome_extension.pem +15 -0
- data/test/helpers/db_setup.rb +23 -0
- data/test/helpers/initializers.rb +11 -0
- data/test/helpers/routes.rb +13 -0
- data/test/routes_test.rb +15 -0
- data/test/test_helper.rb +16 -0
- metadata +131 -19
data/Gemfile
CHANGED
@@ -2,11 +2,14 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
gem "crxmake", ">= 2.0.3"
|
5
|
+
gem "rails", ">= 3.0.0"
|
5
6
|
|
6
7
|
# Add dependencies to develop your gem here.
|
7
8
|
# Include everything needed to run rake, tests, features, etc.
|
8
9
|
group :development do
|
9
10
|
gem "bundler", "~> 1.0.0"
|
10
11
|
gem "jeweler", "~> 1.5.2"
|
12
|
+
gem "mocha", ">= 0.9.12"
|
11
13
|
gem "rcov", ">= 0"
|
14
|
+
gem "sqlite3", ">= 1.3.3"
|
12
15
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,78 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.5)
|
6
|
+
actionpack (= 3.0.5)
|
7
|
+
mail (~> 2.2.15)
|
8
|
+
actionpack (3.0.5)
|
9
|
+
activemodel (= 3.0.5)
|
10
|
+
activesupport (= 3.0.5)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.4)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.13)
|
16
|
+
rack-test (~> 0.5.7)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.5)
|
19
|
+
activesupport (= 3.0.5)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.4)
|
22
|
+
activerecord (3.0.5)
|
23
|
+
activemodel (= 3.0.5)
|
24
|
+
activesupport (= 3.0.5)
|
25
|
+
arel (~> 2.0.2)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.5)
|
28
|
+
activemodel (= 3.0.5)
|
29
|
+
activesupport (= 3.0.5)
|
30
|
+
activesupport (3.0.5)
|
31
|
+
arel (2.0.9)
|
32
|
+
builder (2.1.2)
|
4
33
|
crxmake (2.0.3)
|
5
34
|
zipruby (>= 0.3.2)
|
35
|
+
erubis (2.6.6)
|
36
|
+
abstract (>= 1.0.0)
|
6
37
|
git (1.2.5)
|
38
|
+
i18n (0.5.0)
|
7
39
|
jeweler (1.5.2)
|
8
40
|
bundler (~> 1.0.0)
|
9
41
|
git (>= 1.2.5)
|
10
42
|
rake
|
43
|
+
mail (2.2.15)
|
44
|
+
activesupport (>= 2.3.6)
|
45
|
+
i18n (>= 0.4.0)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.16)
|
49
|
+
mocha (0.9.12)
|
50
|
+
polyglot (0.3.1)
|
51
|
+
rack (1.2.2)
|
52
|
+
rack-mount (0.6.14)
|
53
|
+
rack (>= 1.0.0)
|
54
|
+
rack-test (0.5.7)
|
55
|
+
rack (>= 1.0)
|
56
|
+
rails (3.0.5)
|
57
|
+
actionmailer (= 3.0.5)
|
58
|
+
actionpack (= 3.0.5)
|
59
|
+
activerecord (= 3.0.5)
|
60
|
+
activeresource (= 3.0.5)
|
61
|
+
activesupport (= 3.0.5)
|
62
|
+
bundler (~> 1.0)
|
63
|
+
railties (= 3.0.5)
|
64
|
+
railties (3.0.5)
|
65
|
+
actionpack (= 3.0.5)
|
66
|
+
activesupport (= 3.0.5)
|
67
|
+
rake (>= 0.8.7)
|
68
|
+
thor (~> 0.14.4)
|
11
69
|
rake (0.8.7)
|
12
70
|
rcov (0.9.9)
|
71
|
+
sqlite3 (1.3.3)
|
72
|
+
thor (0.14.6)
|
73
|
+
treetop (1.4.9)
|
74
|
+
polyglot (>= 0.3.1)
|
75
|
+
tzinfo (0.3.25)
|
13
76
|
zipruby (0.3.6)
|
14
77
|
|
15
78
|
PLATFORMS
|
@@ -19,4 +82,7 @@ DEPENDENCIES
|
|
19
82
|
bundler (~> 1.0.0)
|
20
83
|
crxmake (>= 2.0.3)
|
21
84
|
jeweler (~> 1.5.2)
|
85
|
+
mocha (>= 0.9.12)
|
86
|
+
rails (>= 3.0.0)
|
22
87
|
rcov
|
88
|
+
sqlite3 (>= 1.3.3)
|
data/Rakefile
CHANGED
@@ -22,9 +22,12 @@ Jeweler::Tasks.new do |gem|
|
|
22
22
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
23
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
24
|
gem.add_runtime_dependency 'crxmake', '>= 2.0.3'
|
25
|
+
gem.add_runtime_dependency 'rails', '>= 3.0.0'
|
25
26
|
gem.add_development_dependency 'bundler', '~> 1.0.0'
|
26
27
|
gem.add_development_dependency 'jeweler', '~> 1.5.2'
|
28
|
+
gem.add_development_dependency 'mocha', '~> 0.9.12'
|
27
29
|
gem.add_development_dependency 'rcov', '>= 0'
|
30
|
+
gem.add_development_dependency 'sqlite3', '>= 1.3.3'
|
28
31
|
end
|
29
32
|
Jeweler::RubygemsDotOrgTasks.new
|
30
33
|
|
@@ -42,7 +45,7 @@ Rake::RDocTask.new do |rdoc|
|
|
42
45
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
43
46
|
|
44
47
|
rdoc.rdoc_dir = 'rdoc'
|
45
|
-
rdoc.title = "
|
48
|
+
rdoc.title = "chromembed_rails #{version}"
|
46
49
|
rdoc.rdoc_files.include('README*')
|
47
50
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
51
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/chromembed_rails.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chromembed_rails}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Victor Costan"]
|
@@ -41,45 +41,82 @@ Gem::Specification.new do |s|
|
|
41
41
|
"lib/chromembed_rails/generators/templates/desktop/chrome_extension/images/ruby19.png",
|
42
42
|
"lib/chromembed_rails/generators/templates/desktop/chrome_extension/manifest.json",
|
43
43
|
"lib/chromembed_rails/model.rb",
|
44
|
-
"lib/chromembed_rails/routes.rb"
|
44
|
+
"lib/chromembed_rails/routes.rb",
|
45
|
+
"test/chrome_extension_cache_test.rb",
|
46
|
+
"test/chrome_extension_controller_test.rb",
|
47
|
+
"test/helpers/application_controller.rb",
|
48
|
+
"test/helpers/chrome_extension.pem",
|
49
|
+
"test/helpers/db_setup.rb",
|
50
|
+
"test/helpers/initializers.rb",
|
51
|
+
"test/helpers/routes.rb",
|
52
|
+
"test/routes_test.rb",
|
53
|
+
"test/test_helper.rb"
|
45
54
|
]
|
46
55
|
s.homepage = %q{http://github.com/pwnall/chromembed_rails}
|
47
56
|
s.licenses = ["MIT"]
|
48
57
|
s.require_paths = ["lib"]
|
49
58
|
s.rubygems_version = %q{1.5.3}
|
50
59
|
s.summary = %q{Serves a Chrome extension embedded in a Rails application}
|
60
|
+
s.test_files = [
|
61
|
+
"test/chrome_extension_cache_test.rb",
|
62
|
+
"test/chrome_extension_controller_test.rb",
|
63
|
+
"test/helpers/application_controller.rb",
|
64
|
+
"test/helpers/db_setup.rb",
|
65
|
+
"test/helpers/initializers.rb",
|
66
|
+
"test/helpers/routes.rb",
|
67
|
+
"test/routes_test.rb",
|
68
|
+
"test/test_helper.rb"
|
69
|
+
]
|
51
70
|
|
52
71
|
if s.respond_to? :specification_version then
|
53
72
|
s.specification_version = 3
|
54
73
|
|
55
74
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
75
|
s.add_runtime_dependency(%q<crxmake>, [">= 2.0.3"])
|
76
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
57
77
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
78
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
79
|
+
s.add_development_dependency(%q<mocha>, [">= 0.9.12"])
|
59
80
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
81
|
+
s.add_development_dependency(%q<sqlite3>, [">= 1.3.3"])
|
60
82
|
s.add_runtime_dependency(%q<crxmake>, [">= 2.0.3"])
|
83
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
61
84
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
85
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
86
|
+
s.add_development_dependency(%q<mocha>, ["~> 0.9.12"])
|
63
87
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
88
|
+
s.add_development_dependency(%q<sqlite3>, [">= 1.3.3"])
|
64
89
|
else
|
65
90
|
s.add_dependency(%q<crxmake>, [">= 2.0.3"])
|
91
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
66
92
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
93
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
94
|
+
s.add_dependency(%q<mocha>, [">= 0.9.12"])
|
68
95
|
s.add_dependency(%q<rcov>, [">= 0"])
|
96
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
69
97
|
s.add_dependency(%q<crxmake>, [">= 2.0.3"])
|
98
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
70
99
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
100
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
101
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.12"])
|
72
102
|
s.add_dependency(%q<rcov>, [">= 0"])
|
103
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
73
104
|
end
|
74
105
|
else
|
75
106
|
s.add_dependency(%q<crxmake>, [">= 2.0.3"])
|
107
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
76
108
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
77
109
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
110
|
+
s.add_dependency(%q<mocha>, [">= 0.9.12"])
|
78
111
|
s.add_dependency(%q<rcov>, [">= 0"])
|
112
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
79
113
|
s.add_dependency(%q<crxmake>, [">= 2.0.3"])
|
114
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
80
115
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
81
116
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
117
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.12"])
|
82
118
|
s.add_dependency(%q<rcov>, [">= 0"])
|
119
|
+
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
83
120
|
end
|
84
121
|
end
|
85
122
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class ChromeExtensionControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
|
4
|
+
test "should get the extension" do
|
5
|
+
get :show, :format => 'crx'
|
6
|
+
assert_response :success
|
6
7
|
end
|
7
8
|
|
8
|
-
test "
|
9
|
-
get :
|
10
|
-
assert_response :
|
9
|
+
test "should get the update file" do
|
10
|
+
get :update, :format => 'xml'
|
11
|
+
assert_response :success
|
11
12
|
end
|
12
13
|
end
|
@@ -26,6 +26,10 @@ module ModelClassMethods
|
|
26
26
|
|
27
27
|
# The extension version listed in manifest.json.
|
28
28
|
validates :version, :length => { :in => 0..64, :allow_nil => false }
|
29
|
+
|
30
|
+
# The CRX file contents.
|
31
|
+
validates :crx_bits,
|
32
|
+
:length => { :in => 0..(64.megabytes), :allow_nil => false }
|
29
33
|
|
30
34
|
extend ModelMetaclassMethods
|
31
35
|
include ModelInstanceMethods
|
@@ -40,16 +44,6 @@ module ModelMetaclassMethods
|
|
40
44
|
self.new.update_with_current_bits(
|
41
45
|
'update_url' => chrome_extension_update_url)
|
42
46
|
end
|
43
|
-
|
44
|
-
# Path to the extension files.
|
45
|
-
def extension_path
|
46
|
-
Rails.root.join 'desktop', 'chrome_extension'
|
47
|
-
end
|
48
|
-
|
49
|
-
# Path to the private key used to sign the extension.
|
50
|
-
def key_path
|
51
|
-
Rails.root.join 'desktop', 'chrome_extension.pem'
|
52
|
-
end
|
53
47
|
end # module ChromembedRails::Model::ModelMetaclassMethods
|
54
48
|
|
55
49
|
|
@@ -61,13 +55,13 @@ module ModelInstanceMethods
|
|
61
55
|
# manifest_changes:: hash to be merged into the extension's manifest JSON;
|
62
56
|
# 'update_url' and 'version' might be good keys to change
|
63
57
|
def update_with_current_bits(manifest_changes)
|
64
|
-
extension_path =
|
58
|
+
extension_path = ChromembedRails.extension_path
|
65
59
|
manifest_path = File.join extension_path, 'manifest.json'
|
66
60
|
manifest_json = ActiveSupport::JSON.decode File.read(manifest_path)
|
67
61
|
manifest_json.merge! manifest_changes
|
68
62
|
self.version = manifest_json['version']
|
69
63
|
|
70
|
-
key_path =
|
64
|
+
key_path = ChromembedRails.key_path
|
71
65
|
key = OpenSSL::PKey::RSA.new File.read(key_path)
|
72
66
|
# Source: http://supercollider.dk/2010/01/calculating-chrome-extension-id-from-your-private-key-233
|
73
67
|
alg = ["30819F300D06092A864886F70D010101050003818D00"].pack('H*')
|
data/lib/chromembed_rails.rb
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# :nodoc: namespace
|
2
2
|
module ChromembedRails
|
3
|
+
class <<self
|
4
|
+
# Path to the extension code.
|
5
|
+
#
|
6
|
+
# This should be set in an initializer.
|
7
|
+
attr_accessor :extension_path
|
8
|
+
|
9
|
+
# Path to the private key used to the sign the extension.
|
10
|
+
#
|
11
|
+
# This should be set in an initializer.
|
12
|
+
attr_accessor :key_path
|
13
|
+
end
|
3
14
|
end
|
4
15
|
|
5
16
|
require 'chromembed_rails/controller.rb'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
class ChromeExtensionCacheTest < ActiveSupport::TestCase
|
4
|
+
def setup
|
5
|
+
@entry = ChromeExtensionCache.new :appid => 'aabbcc', :version => '1.0.0',
|
6
|
+
:crx_bits => 'abcd' * 16
|
7
|
+
end
|
8
|
+
|
9
|
+
test "setup" do
|
10
|
+
assert @entry.valid?
|
11
|
+
end
|
12
|
+
|
13
|
+
test "update_with_current_bits" do
|
14
|
+
@entry.update_with_current_bits 'update_url' => 'http://url/update.xml'
|
15
|
+
|
16
|
+
assert_equal 'mmdhdbifokakcihplakafeifahobiijk', @entry.appid
|
17
|
+
assert_equal '1.0.0', @entry.version
|
18
|
+
assert_equal 'Cr24', @entry.crx_bits[0, 4]
|
19
|
+
|
20
|
+
assert @entry.crx_bits.include?("PK\x03\x04"), 'crx does not contain a ZIP'
|
21
|
+
assert @entry.crx_bits.length > 1.kilobyte, 'crx file is very small'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
require 'chromembed_rails/generators/templates/chrome_extension_controller.rb'
|
4
|
+
|
5
|
+
# Run the tests in the generator, to make sure they pass.
|
6
|
+
require 'chromembed_rails/generators/templates/chrome_extension_controller_test.rb'
|
7
|
+
|
8
|
+
# Tests the methods injected by config_vars_controller.
|
9
|
+
class ChromeExtensionControllerExtendedTest < ActionController::TestCase
|
10
|
+
tests ChromeExtensionController
|
11
|
+
|
12
|
+
test "should get the extension" do
|
13
|
+
get :show, :format => 'crx'
|
14
|
+
assert_response :success
|
15
|
+
assert_equal 'Cr24', response.body[0, 4]
|
16
|
+
assert response.body.include?("PK\x03\x04"), 'crx does not contain a ZIP'
|
17
|
+
end
|
18
|
+
|
19
|
+
test "should get the update file" do
|
20
|
+
get :update, :format => 'xml'
|
21
|
+
assert_response :success
|
22
|
+
assert_select 'gupdate' do
|
23
|
+
assert_select "app[appid=mmdhdbifokakcihplakafeifahobiijk]" do
|
24
|
+
assert_select 'updatecheck[codebase=http://test.host/chrome_extension.crx][version=1.0.0]'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIICXgIBAAKBgQCt33m4n5e6IktFf+pchtvc5tX+WhzXUn2vwILZiY0Emy6LppzH
|
3
|
+
60H8WRCvABvzQgz/CI6C24sWotnLWfwacdwHDfZ5qTvMLuBJlMCm5qkJJvi57g6g
|
4
|
+
RO3H5kKTCfiJtn+V65wyJOASB+Luh1TxYZWxLhvn6nah382+eSn6DJhcDwIDAQAB
|
5
|
+
AoGBAIR87vFBmonYq+aPa/OJR2tx8cnYvHVOhDsxxAMjDvNdlAARuxGTMDqrW00e
|
6
|
+
Fi4sPF7xFDaeN8PN34tWTAWSkQcET2Y2kNInK5uZnsmgAHwS/eQQb50AQXacofIH
|
7
|
+
yMqsZQ/UVaDGl5rGn0xD8OcRMQq/9nadgka09RngyQtpinJxAkEA5o9Sl9vl3dHC
|
8
|
+
CiwCqqypYRwDdan2N8U9WlM3tKhyl647HcsiqVWExvd/LUgWFUxrpWco9WQ3oeXY
|
9
|
+
o0o336wwCwJBAMEO56JvWMnIn1zCX1zgQCK93gDJZmo4SPBjYiHXC1/8QttSfsuP
|
10
|
+
y01GGFyD4A4FW6I6pLXj4HhD6V+K8nE3co0CQATdi2mm+0/WCFk8moXNhPmGpNAL
|
11
|
+
2SVOJUBNt0Q5tclbpOW5Dq8yHc4xFN74wXaLmU3xQl0DU2U4O30eqNUwhgcCQQCA
|
12
|
+
4NhVIYveOKXaII/UyodGKgXX9Jr/8c8PWukZuhsH2rku/KVUcwu+7Do7GHYsJfuE
|
13
|
+
Ey39lsA0yPE0LOeoGOHJAkEAg9rsC8SuTa5XI3AHeQJtfny2ttnR33An7nz9dPry
|
14
|
+
ZcEvB9KJQqMgvf97Tt/F7Cwx8Uf6x82bGCOTImOfw0VPiQ==
|
15
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,23 @@
|
|
1
|
+
ActiveRecord::Base.establish_connection :adapter => 'sqlite3',
|
2
|
+
:database => ':memory:'
|
3
|
+
ActiveRecord::Base.configurations = true
|
4
|
+
|
5
|
+
ActiveRecord::Migration.verbose = false
|
6
|
+
require 'chromembed_rails/generators/templates/001_create_chrome_extension_caches.rb'
|
7
|
+
CreateChromeExtensionCaches.up
|
8
|
+
|
9
|
+
require 'chromembed_rails/generators/templates/chrome_extension_cache.rb'
|
10
|
+
|
11
|
+
# :nodoc: open TestCase to setup fixtures
|
12
|
+
class ActiveSupport::TestCase
|
13
|
+
include ActiveRecord::TestFixtures
|
14
|
+
|
15
|
+
self.fixture_path =
|
16
|
+
File.expand_path '../../../lib/chromembed_rails/generators/templates',
|
17
|
+
__FILE__
|
18
|
+
|
19
|
+
self.use_transactional_fixtures = false
|
20
|
+
self.use_instantiated_fixtures = false
|
21
|
+
self.pre_loaded_fixtures = false
|
22
|
+
fixtures :all
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Mock Rails.root used in the chrome_extension initializer.
|
2
|
+
module Rails
|
3
|
+
def self.root
|
4
|
+
Pathname.new File.expand_path(
|
5
|
+
'../../../lib/chromembed_rails/generators/templates', __FILE__)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
require 'chromembed_rails/generators/templates/chrome_extension_initializer.rb'
|
9
|
+
|
10
|
+
# Point to the testing key.
|
11
|
+
ChromembedRails.key_path = File.expand_path '../chrome_extension.pem', __FILE__
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# :nodoc: the routes used in all tests
|
2
|
+
class ActionController::TestCase
|
3
|
+
def setup_routes
|
4
|
+
@routes = ActionController::Routing::RouteSet.new
|
5
|
+
@routes.draw do
|
6
|
+
# NOTE: this route should be kept in sync with the generator template.
|
7
|
+
chrome_extension
|
8
|
+
end
|
9
|
+
ApplicationController.send :include, @routes.url_helpers
|
10
|
+
end
|
11
|
+
|
12
|
+
setup :setup_routes
|
13
|
+
end
|
data/test/routes_test.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
require 'chromembed_rails/generators/templates/chrome_extension_controller.rb'
|
4
|
+
|
5
|
+
|
6
|
+
class RoutesTest < ActionController::TestCase
|
7
|
+
tests ChromeExtensionController
|
8
|
+
|
9
|
+
test "chrome_extension routes" do
|
10
|
+
assert_routing({:path => "/chrome_extension.crx", :method => :get},
|
11
|
+
{:controller => 'chrome_extension', :action => 'show'})
|
12
|
+
assert_routing({:path => "/chrome_extension/update.xml", :method => :get},
|
13
|
+
{:controller => 'chrome_extension', :action => 'update'})
|
14
|
+
end
|
15
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
require 'action_pack'
|
5
|
+
require 'active_record'
|
6
|
+
require 'active_support'
|
7
|
+
require 'active_support/core_ext'
|
8
|
+
|
9
|
+
require 'sqlite3'
|
10
|
+
|
11
|
+
require 'chromembed_rails'
|
12
|
+
|
13
|
+
require 'helpers/application_controller.rb'
|
14
|
+
require 'helpers/db_setup.rb'
|
15
|
+
require 'helpers/initializers.rb'
|
16
|
+
require 'helpers/routes.rb'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chromembed_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Costan
|
@@ -35,8 +35,24 @@ dependencies:
|
|
35
35
|
type: :runtime
|
36
36
|
requirement: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: rails
|
39
39
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 7
|
45
|
+
segments:
|
46
|
+
- 3
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
version: 3.0.0
|
50
|
+
prerelease: false
|
51
|
+
type: :runtime
|
52
|
+
requirement: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
56
|
none: false
|
41
57
|
requirements:
|
42
58
|
- - ~>
|
@@ -49,10 +65,10 @@ dependencies:
|
|
49
65
|
version: 1.0.0
|
50
66
|
prerelease: false
|
51
67
|
type: :development
|
52
|
-
requirement: *
|
68
|
+
requirement: *id003
|
53
69
|
- !ruby/object:Gem::Dependency
|
54
70
|
name: jeweler
|
55
|
-
version_requirements: &
|
71
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
56
72
|
none: false
|
57
73
|
requirements:
|
58
74
|
- - ~>
|
@@ -65,10 +81,26 @@ dependencies:
|
|
65
81
|
version: 1.5.2
|
66
82
|
prerelease: false
|
67
83
|
type: :development
|
68
|
-
requirement: *
|
84
|
+
requirement: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: mocha
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 35
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
- 9
|
96
|
+
- 12
|
97
|
+
version: 0.9.12
|
98
|
+
prerelease: false
|
99
|
+
type: :development
|
100
|
+
requirement: *id005
|
69
101
|
- !ruby/object:Gem::Dependency
|
70
102
|
name: rcov
|
71
|
-
version_requirements: &
|
103
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
72
104
|
none: false
|
73
105
|
requirements:
|
74
106
|
- - ">="
|
@@ -79,10 +111,26 @@ dependencies:
|
|
79
111
|
version: "0"
|
80
112
|
prerelease: false
|
81
113
|
type: :development
|
82
|
-
requirement: *
|
114
|
+
requirement: *id006
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: sqlite3
|
117
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 29
|
123
|
+
segments:
|
124
|
+
- 1
|
125
|
+
- 3
|
126
|
+
- 3
|
127
|
+
version: 1.3.3
|
128
|
+
prerelease: false
|
129
|
+
type: :development
|
130
|
+
requirement: *id007
|
83
131
|
- !ruby/object:Gem::Dependency
|
84
132
|
name: crxmake
|
85
|
-
version_requirements: &
|
133
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
86
134
|
none: false
|
87
135
|
requirements:
|
88
136
|
- - ">="
|
@@ -95,10 +143,26 @@ dependencies:
|
|
95
143
|
version: 2.0.3
|
96
144
|
prerelease: false
|
97
145
|
type: :runtime
|
98
|
-
requirement: *
|
146
|
+
requirement: *id008
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: rails
|
149
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 7
|
155
|
+
segments:
|
156
|
+
- 3
|
157
|
+
- 0
|
158
|
+
- 0
|
159
|
+
version: 3.0.0
|
160
|
+
prerelease: false
|
161
|
+
type: :runtime
|
162
|
+
requirement: *id009
|
99
163
|
- !ruby/object:Gem::Dependency
|
100
164
|
name: bundler
|
101
|
-
version_requirements: &
|
165
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
102
166
|
none: false
|
103
167
|
requirements:
|
104
168
|
- - ~>
|
@@ -111,10 +175,10 @@ dependencies:
|
|
111
175
|
version: 1.0.0
|
112
176
|
prerelease: false
|
113
177
|
type: :development
|
114
|
-
requirement: *
|
178
|
+
requirement: *id010
|
115
179
|
- !ruby/object:Gem::Dependency
|
116
180
|
name: jeweler
|
117
|
-
version_requirements: &
|
181
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
118
182
|
none: false
|
119
183
|
requirements:
|
120
184
|
- - ~>
|
@@ -127,10 +191,26 @@ dependencies:
|
|
127
191
|
version: 1.5.2
|
128
192
|
prerelease: false
|
129
193
|
type: :development
|
130
|
-
requirement: *
|
194
|
+
requirement: *id011
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: mocha
|
197
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
198
|
+
none: false
|
199
|
+
requirements:
|
200
|
+
- - ~>
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
hash: 35
|
203
|
+
segments:
|
204
|
+
- 0
|
205
|
+
- 9
|
206
|
+
- 12
|
207
|
+
version: 0.9.12
|
208
|
+
prerelease: false
|
209
|
+
type: :development
|
210
|
+
requirement: *id012
|
131
211
|
- !ruby/object:Gem::Dependency
|
132
212
|
name: rcov
|
133
|
-
version_requirements: &
|
213
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
134
214
|
none: false
|
135
215
|
requirements:
|
136
216
|
- - ">="
|
@@ -141,7 +221,23 @@ dependencies:
|
|
141
221
|
version: "0"
|
142
222
|
prerelease: false
|
143
223
|
type: :development
|
144
|
-
requirement: *
|
224
|
+
requirement: *id013
|
225
|
+
- !ruby/object:Gem::Dependency
|
226
|
+
name: sqlite3
|
227
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
228
|
+
none: false
|
229
|
+
requirements:
|
230
|
+
- - ">="
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
hash: 29
|
233
|
+
segments:
|
234
|
+
- 1
|
235
|
+
- 3
|
236
|
+
- 3
|
237
|
+
version: 1.3.3
|
238
|
+
prerelease: false
|
239
|
+
type: :development
|
240
|
+
requirement: *id014
|
145
241
|
description: Ruby on Rails engine for Web applications that are strongly coupled with Chrome extensions
|
146
242
|
email: costan@gmail.com
|
147
243
|
executables: []
|
@@ -177,6 +273,15 @@ files:
|
|
177
273
|
- lib/chromembed_rails/generators/templates/desktop/chrome_extension/manifest.json
|
178
274
|
- lib/chromembed_rails/model.rb
|
179
275
|
- lib/chromembed_rails/routes.rb
|
276
|
+
- test/chrome_extension_cache_test.rb
|
277
|
+
- test/chrome_extension_controller_test.rb
|
278
|
+
- test/helpers/application_controller.rb
|
279
|
+
- test/helpers/chrome_extension.pem
|
280
|
+
- test/helpers/db_setup.rb
|
281
|
+
- test/helpers/initializers.rb
|
282
|
+
- test/helpers/routes.rb
|
283
|
+
- test/routes_test.rb
|
284
|
+
- test/test_helper.rb
|
180
285
|
has_rdoc: true
|
181
286
|
homepage: http://github.com/pwnall/chromembed_rails
|
182
287
|
licenses:
|
@@ -211,5 +316,12 @@ rubygems_version: 1.5.3
|
|
211
316
|
signing_key:
|
212
317
|
specification_version: 3
|
213
318
|
summary: Serves a Chrome extension embedded in a Rails application
|
214
|
-
test_files:
|
215
|
-
|
319
|
+
test_files:
|
320
|
+
- test/chrome_extension_cache_test.rb
|
321
|
+
- test/chrome_extension_controller_test.rb
|
322
|
+
- test/helpers/application_controller.rb
|
323
|
+
- test/helpers/db_setup.rb
|
324
|
+
- test/helpers/initializers.rb
|
325
|
+
- test/helpers/routes.rb
|
326
|
+
- test/routes_test.rb
|
327
|
+
- test/test_helper.rb
|