trackman 0.0.9 → 0.1.0
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.
- data/Gemfile +0 -2
- data/lib/trackman/assets/asset.rb +3 -5
- data/lib/trackman/assets/remote_asset.rb +14 -14
- data/lib/trackman/version.rb +1 -1
- data/rails_generators/trackman/templates/trackman.rake +1 -4
- data/spec/asset_all_spec.rb +2 -2
- data/spec/asset_spec.rb +2 -16
- data/spec/fixtures/rails2311/fully-loaded/public/503-error.html~ +24 -0
- data/spec/fixtures/rails2311/fully-loaded/public/503.html~ +275 -0
- data/spec/helpers/app_creator.rb +21 -11
- data/spec/helpers/fakable_pathman_tester.rb +2 -24
- data/spec/rails2311/first_push_spec.rb +6 -6
- data/spec/rails32/first_push_spec.rb +5 -6
- data/spec/remote_asset_spec.rb +22 -13
- data/trackman.gemspec +1 -0
- metadata +22 -34
data/Gemfile
CHANGED
@@ -21,8 +21,8 @@ module Trackman
|
|
21
21
|
|
22
22
|
def ==(other)
|
23
23
|
return false if other.nil?
|
24
|
-
other_path = other.path.is_a?(Pathname) ? other.path : Pathname.new(other.path)
|
25
|
-
other_path.to_s == path.to_s || path.
|
24
|
+
other_path = other.path.is_a?(Pathname) ? other.path : Pathname.new(other.path)
|
25
|
+
other_path.to_s == path.to_s || path.realpath == other_path.realpath
|
26
26
|
end
|
27
27
|
|
28
28
|
def <=>(another)
|
@@ -37,15 +37,13 @@ module Trackman
|
|
37
37
|
result += -1
|
38
38
|
elsif another.is_child_of(self)
|
39
39
|
result += 1
|
40
|
-
else
|
41
|
-
result = self.path.to_s <=> another.path.to_s
|
42
40
|
end
|
43
41
|
|
44
42
|
result
|
45
43
|
end
|
46
44
|
|
47
45
|
def is_child_of(parent)
|
48
|
-
parent.assets.include?
|
46
|
+
parent.is_a?(Components::CompositeAsset) && parent.assets.include?(self)
|
49
47
|
end
|
50
48
|
|
51
49
|
def self.all
|
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'json'
|
3
|
-
require 'uri'
|
4
3
|
|
5
4
|
module Trackman
|
6
5
|
module Assets
|
7
6
|
class RemoteAsset < Asset
|
8
|
-
@@
|
7
|
+
@@user = ENV['TRACKMAN_USER']
|
8
|
+
@@pass = ENV['TRACKMAN_PASSWORD']
|
9
|
+
@@app_id = ENV['TRACKMAN_APP_ID']
|
10
|
+
@@server = ENV['TRACKMAN_SERVER_URL']
|
9
11
|
|
10
|
-
@@site = "
|
12
|
+
@@site = "https://#{@@user}:#{@@pass}@#{@@server}/heroku/resources/#{@@app_id}/assets"
|
11
13
|
|
12
14
|
attr_reader :id
|
13
|
-
|
15
|
+
|
14
16
|
def initialize attributes = {}
|
15
17
|
ensure_config
|
16
18
|
super
|
@@ -28,17 +30,13 @@ module Trackman
|
|
28
30
|
end
|
29
31
|
|
30
32
|
def self.find id
|
31
|
-
puts "For #{@@site}"
|
32
|
-
puts RestClient.get "#{@@site}"
|
33
|
-
|
34
33
|
response = RestClient.get "#{@@site}/#{id}"
|
35
|
-
|
36
34
|
body = Hash[JSON.parse(response).map{ |k, v| [k.to_sym, v] }]
|
37
35
|
RemoteAsset.new(body)
|
38
36
|
end
|
39
37
|
|
40
38
|
def self.all
|
41
|
-
|
39
|
+
JSON.parse(RestClient.get @@site).map{|r| Hash[r.map{ |k, v| [k.to_sym, v] }] }.map { |r| RemoteAsset.new(r) }.sort
|
42
40
|
end
|
43
41
|
|
44
42
|
def create!
|
@@ -51,7 +49,7 @@ module Trackman
|
|
51
49
|
RestClient.put "#{@@site}/#{id}", :asset => {:path => path, :file => File.open(path)}, :content_type => :json, :accept => :json
|
52
50
|
end
|
53
51
|
def delete
|
54
|
-
|
52
|
+
response = RestClient.delete "#{@@site}/#{id}"
|
55
53
|
true
|
56
54
|
end
|
57
55
|
|
@@ -66,12 +64,14 @@ module Trackman
|
|
66
64
|
false
|
67
65
|
end
|
68
66
|
|
67
|
+
|
68
|
+
|
69
69
|
private
|
70
70
|
def ensure_config
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
if @@user.nil? || @@pass.nil? || @@app_id.nil? || @@server.nil?
|
72
|
+
config_missing = ['TRACKMAN_USER', 'TRACKMAN_PASSWORD', 'TRACKMAN_APP_ID', 'TRACKMAN_SERVER_URL'].first{|c| ENV[c].nil? }
|
73
|
+
raise Errors::ConfigNotFoundError, "The config '#{config_missing}' is missing."
|
74
|
+
end
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
data/lib/trackman/version.rb
CHANGED
@@ -6,10 +6,7 @@ namespace :trackman do
|
|
6
6
|
TRACKMAN_MAINTENANCE = 'TRACKMAN_MAINTENANCE_PAGE_URL'
|
7
7
|
|
8
8
|
desc "Syncs your assets with the server, this is what gets executed when you deploy to heroku."
|
9
|
-
task :sync
|
10
|
-
if args[:debug]
|
11
|
-
RestClient.log = Logger.new(STDOUT)
|
12
|
-
end
|
9
|
+
task :sync do
|
13
10
|
Trackman::Assets::Asset.sync
|
14
11
|
end
|
15
12
|
|
data/spec/asset_all_spec.rb
CHANGED
@@ -45,9 +45,9 @@ describe Trackman::Assets::Asset do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
expected = [
|
48
|
-
TestAsset.create(:path => 'spec/test_data/all/1.css'),
|
49
|
-
TestAsset.create(:path => 'spec/test_data/all/2.gif'),
|
50
48
|
TestAsset.create(:path => 'spec/test_data/all/3.js'),
|
49
|
+
TestAsset.create(:path => 'spec/test_data/all/2.gif'),
|
50
|
+
TestAsset.create(:path => 'spec/test_data/all/1.css'),
|
51
51
|
TestAsset.maintenance_page,
|
52
52
|
TestAsset.error_page
|
53
53
|
]
|
data/spec/asset_spec.rb
CHANGED
@@ -46,6 +46,8 @@ describe Trackman::Assets::Asset do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
|
50
|
+
|
49
51
|
describe "#remote" do
|
50
52
|
|
51
53
|
class TestAsset < Asset
|
@@ -94,20 +96,4 @@ describe Trackman::Assets::Asset do
|
|
94
96
|
(dependent <=> dependency).should == 1
|
95
97
|
(dependency <=> dependent).should == -1
|
96
98
|
end
|
97
|
-
|
98
|
-
it "fixes the bug with realpath" do
|
99
|
-
class MyAsset < Asset
|
100
|
-
def validate_path?
|
101
|
-
false
|
102
|
-
end
|
103
|
-
def file_hash
|
104
|
-
123
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
local = MyAsset.new(:path => 'public/test.html')
|
109
|
-
remote = MyAsset.new(:path => 'public/./test.html')
|
110
|
-
|
111
|
-
local.should == remote
|
112
|
-
end
|
113
99
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>HAPPY PATH FIXTURE</title>
|
5
|
+
|
6
|
+
<link rel="stylesheet" type="text/css" href="stylesheets/some-other-css.css" />
|
7
|
+
|
8
|
+
<style>
|
9
|
+
@import url('stylesheets/application.css');
|
10
|
+
|
11
|
+
p {
|
12
|
+
color:#09F;
|
13
|
+
text-indent: 20px;
|
14
|
+
}
|
15
|
+
</style>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div class="dialog">
|
20
|
+
<h1>503 - Error</h1>
|
21
|
+
<p>The website is down right now ...</p>
|
22
|
+
</div>
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -0,0 +1,275 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Ruby on Rails: Welcome aboard</title>
|
7
|
+
<style type="text/css" media="screen">
|
8
|
+
body {
|
9
|
+
margin: 0;
|
10
|
+
margin-bottom: 25px;
|
11
|
+
padding: 0;
|
12
|
+
background-color: #f0f0f0;
|
13
|
+
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
14
|
+
font-size: 13px;
|
15
|
+
color: #333;
|
16
|
+
}
|
17
|
+
|
18
|
+
h1 {
|
19
|
+
font-size: 28px;
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a {color: #03c}
|
24
|
+
a:hover {
|
25
|
+
background-color: #03c;
|
26
|
+
color: white;
|
27
|
+
text-decoration: none;
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
#page {
|
32
|
+
background-color: #f0f0f0;
|
33
|
+
width: 750px;
|
34
|
+
margin: 0;
|
35
|
+
margin-left: auto;
|
36
|
+
margin-right: auto;
|
37
|
+
}
|
38
|
+
|
39
|
+
#content {
|
40
|
+
float: left;
|
41
|
+
background-color: white;
|
42
|
+
border: 3px solid #aaa;
|
43
|
+
border-top: none;
|
44
|
+
padding: 25px;
|
45
|
+
width: 500px;
|
46
|
+
}
|
47
|
+
|
48
|
+
#sidebar {
|
49
|
+
float: right;
|
50
|
+
width: 175px;
|
51
|
+
}
|
52
|
+
|
53
|
+
#footer {
|
54
|
+
clear: both;
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
#header, #about, #getting-started {
|
59
|
+
padding-left: 75px;
|
60
|
+
padding-right: 30px;
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
#header {
|
65
|
+
background-image: url("images/rails.png");
|
66
|
+
background-repeat: no-repeat;
|
67
|
+
background-position: top left;
|
68
|
+
height: 64px;
|
69
|
+
}
|
70
|
+
#header h1, #header h2 {margin: 0}
|
71
|
+
#header h2 {
|
72
|
+
color: #888;
|
73
|
+
font-weight: normal;
|
74
|
+
font-size: 16px;
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
#about h3 {
|
79
|
+
margin: 0;
|
80
|
+
margin-bottom: 10px;
|
81
|
+
font-size: 14px;
|
82
|
+
}
|
83
|
+
|
84
|
+
#about-content {
|
85
|
+
background-color: #ffd;
|
86
|
+
border: 1px solid #fc0;
|
87
|
+
margin-left: -11px;
|
88
|
+
}
|
89
|
+
#about-content table {
|
90
|
+
margin-top: 10px;
|
91
|
+
margin-bottom: 10px;
|
92
|
+
font-size: 11px;
|
93
|
+
border-collapse: collapse;
|
94
|
+
}
|
95
|
+
#about-content td {
|
96
|
+
padding: 10px;
|
97
|
+
padding-top: 3px;
|
98
|
+
padding-bottom: 3px;
|
99
|
+
}
|
100
|
+
#about-content td.name {color: #555}
|
101
|
+
#about-content td.value {color: #000}
|
102
|
+
|
103
|
+
#about-content.failure {
|
104
|
+
background-color: #fcc;
|
105
|
+
border: 1px solid #f00;
|
106
|
+
}
|
107
|
+
#about-content.failure p {
|
108
|
+
margin: 0;
|
109
|
+
padding: 10px;
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
#getting-started {
|
114
|
+
border-top: 1px solid #ccc;
|
115
|
+
margin-top: 25px;
|
116
|
+
padding-top: 15px;
|
117
|
+
}
|
118
|
+
#getting-started h1 {
|
119
|
+
margin: 0;
|
120
|
+
font-size: 20px;
|
121
|
+
}
|
122
|
+
#getting-started h2 {
|
123
|
+
margin: 0;
|
124
|
+
font-size: 14px;
|
125
|
+
font-weight: normal;
|
126
|
+
color: #333;
|
127
|
+
margin-bottom: 25px;
|
128
|
+
}
|
129
|
+
#getting-started ol {
|
130
|
+
margin-left: 0;
|
131
|
+
padding-left: 0;
|
132
|
+
}
|
133
|
+
#getting-started li {
|
134
|
+
font-size: 18px;
|
135
|
+
color: #888;
|
136
|
+
margin-bottom: 25px;
|
137
|
+
}
|
138
|
+
#getting-started li h2 {
|
139
|
+
margin: 0;
|
140
|
+
font-weight: normal;
|
141
|
+
font-size: 18px;
|
142
|
+
color: #333;
|
143
|
+
}
|
144
|
+
#getting-started li p {
|
145
|
+
color: #555;
|
146
|
+
font-size: 13px;
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
#search {
|
151
|
+
margin: 0;
|
152
|
+
padding-top: 10px;
|
153
|
+
padding-bottom: 10px;
|
154
|
+
font-size: 11px;
|
155
|
+
}
|
156
|
+
#search input {
|
157
|
+
font-size: 11px;
|
158
|
+
margin: 2px;
|
159
|
+
}
|
160
|
+
#search-text {width: 170px}
|
161
|
+
|
162
|
+
|
163
|
+
#sidebar ul {
|
164
|
+
margin-left: 0;
|
165
|
+
padding-left: 0;
|
166
|
+
}
|
167
|
+
#sidebar ul h3 {
|
168
|
+
margin-top: 25px;
|
169
|
+
font-size: 16px;
|
170
|
+
padding-bottom: 10px;
|
171
|
+
border-bottom: 1px solid #ccc;
|
172
|
+
}
|
173
|
+
#sidebar li {
|
174
|
+
list-style-type: none;
|
175
|
+
}
|
176
|
+
#sidebar ul.links li {
|
177
|
+
margin-bottom: 5px;
|
178
|
+
}
|
179
|
+
|
180
|
+
</style>
|
181
|
+
<script type="text/javascript" src="javascripts/prototype.js"></script>
|
182
|
+
<script type="text/javascript" src="javascripts/effects.js"></script>
|
183
|
+
|
184
|
+
function about() {
|
185
|
+
if (Element.empty('about-content')) {
|
186
|
+
new Ajax.Updater('about-content', 'rails/info/properties', {
|
187
|
+
method: 'get',
|
188
|
+
onFailure: function() {Element.classNames('about-content').add('failure')},
|
189
|
+
onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
|
190
|
+
});
|
191
|
+
} else {
|
192
|
+
new Effect[Element.visible('about-content') ?
|
193
|
+
'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
window.onload = function() {
|
198
|
+
$('search-text').value = '';
|
199
|
+
$('search').onsubmit = function() {
|
200
|
+
$('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
|
201
|
+
}
|
202
|
+
}
|
203
|
+
</script>
|
204
|
+
</head>
|
205
|
+
<body>
|
206
|
+
<div id="page">
|
207
|
+
<div id="sidebar">
|
208
|
+
<ul id="sidebar-items">
|
209
|
+
<li>
|
210
|
+
<form id="search" action="http://www.google.com/search" method="get">
|
211
|
+
<input type="hidden" name="hl" value="en" />
|
212
|
+
<input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
|
213
|
+
<input type="submit" value="Search" /> the Rails site
|
214
|
+
</form>
|
215
|
+
</li>
|
216
|
+
|
217
|
+
<li>
|
218
|
+
<h3>Join the community</h3>
|
219
|
+
<ul class="links">
|
220
|
+
<li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
|
221
|
+
<li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
|
222
|
+
<li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
|
223
|
+
</ul>
|
224
|
+
</li>
|
225
|
+
|
226
|
+
<li>
|
227
|
+
<h3>Browse the documentation</h3>
|
228
|
+
<ul class="links">
|
229
|
+
<li><a href="http://api.rubyonrails.org/">Rails API</a></li>
|
230
|
+
<li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
|
231
|
+
<li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
|
232
|
+
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
|
233
|
+
</ul>
|
234
|
+
</li>
|
235
|
+
</ul>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
<div id="content">
|
239
|
+
<div id="header">
|
240
|
+
<h1>Welcome aboard</h1>
|
241
|
+
<h2>You’re riding Ruby on Rails!</h2>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
<div id="about">
|
245
|
+
<h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3>
|
246
|
+
<div id="about-content" style="display: none"></div>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div id="getting-started">
|
250
|
+
<h1>Getting started</h1>
|
251
|
+
<h2>Here’s how to get rolling:</h2>
|
252
|
+
|
253
|
+
<ol>
|
254
|
+
<li>
|
255
|
+
<h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
|
256
|
+
<p>To see all available options, run it without parameters.</p>
|
257
|
+
</li>
|
258
|
+
|
259
|
+
<li>
|
260
|
+
<h2>Set up a default route and remove or rename this file</h2>
|
261
|
+
<p>Routes are set up in config/routes.rb.</p>
|
262
|
+
</li>
|
263
|
+
|
264
|
+
<li>
|
265
|
+
<h2>Create your database</h2>
|
266
|
+
<p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
|
267
|
+
</li>
|
268
|
+
</ol>
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div id="footer"> </div>
|
273
|
+
</div>
|
274
|
+
</body>
|
275
|
+
</html>
|
data/spec/helpers/app_creator.rb
CHANGED
@@ -1,28 +1,38 @@
|
|
1
1
|
class AppCreator
|
2
|
-
def self.get_config
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
trackman_url = json['config']['TRACKMAN_URL'].gsub('https', 'http')
|
7
|
-
|
8
|
-
[[:@@server_url, trackman_url], [:@@site, "#{trackman_url}/assets"]]
|
2
|
+
def self.get_config
|
3
|
+
RemoteAsset.class_variables.inject({}) do |carry, e|
|
4
|
+
carry.merge!({e => RemoteAsset.send(:class_variable_get, e)})
|
5
|
+
end
|
9
6
|
end
|
10
7
|
|
11
8
|
def self.create
|
12
9
|
user = ENV['HEROKU_USERNAME']
|
13
10
|
pass = ENV['HEROKU_PASSWORD']
|
14
|
-
|
11
|
+
|
12
|
+
server = RemoteAsset.send(:class_variable_get, :@@server)
|
13
|
+
url = "http://#{user}:#{pass}@#{server}/heroku/resources"
|
15
14
|
|
16
|
-
|
15
|
+
response = RestClient.post url, :plan => 'test', :heroku_id => 123
|
16
|
+
json = JSON.parse response
|
17
|
+
|
18
|
+
user = json['config']['TRACKMAN_USER']
|
19
|
+
pass = json['config']['TRACKMAN_PASSWORD']
|
20
|
+
id = json['id']
|
21
|
+
site = "http://#{user}:#{pass}@#{server}/heroku/resources/#{id}/assets"
|
22
|
+
|
17
23
|
|
18
|
-
|
24
|
+
[[:@@user,user], [:@@pass, pass], [:@@app_id, id], [:@@site, site]].each do |s, v|
|
19
25
|
RemoteAsset.send(:class_variable_set, s, v)
|
20
26
|
end
|
27
|
+
|
28
|
+
get_config
|
21
29
|
end
|
22
30
|
|
23
31
|
def self.reset
|
24
|
-
@@
|
32
|
+
@@old_config.each do |k,v|
|
25
33
|
RemoteAsset.send(:class_variable_set, k, v)
|
26
34
|
end
|
27
35
|
end
|
36
|
+
|
37
|
+
@@old_config = get_config
|
28
38
|
end
|
@@ -21,21 +21,7 @@ class FakablePathManTester
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
RemoteAsset.class_eval do
|
26
|
-
singleton_class = class << self; self; end
|
27
|
-
singleton_class.instance_eval do
|
28
|
-
alias_method :old_get_attributes, :get_attributes
|
29
|
-
define_method :get_attributes do
|
30
|
-
old_get_attributes.map do |h|
|
31
|
-
my_hash = h.dup
|
32
|
-
my_hash[:path] = prepath + h[:path] unless h[:path].start_with? prepath
|
33
|
-
my_hash
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
24
|
+
|
39
25
|
Conventions.module_eval do
|
40
26
|
alias :real_maintenance_path :maintenance_path
|
41
27
|
alias :real_error_path :error_path
|
@@ -69,15 +55,7 @@ class FakablePathManTester
|
|
69
55
|
|
70
56
|
remove_method :real_maintenance_path
|
71
57
|
remove_method :real_error_path
|
72
|
-
end
|
73
|
-
|
74
|
-
RemoteAsset.class_eval do
|
75
|
-
singleton_class = class << self; self; end
|
76
|
-
singleton_class.instance_eval do
|
77
|
-
alias_method :get_attributes, :old_get_attributes
|
78
|
-
remove_method :old_get_attributes
|
79
|
-
end
|
80
|
-
end
|
58
|
+
end
|
81
59
|
end
|
82
60
|
end
|
83
61
|
|
@@ -18,12 +18,12 @@ describe 'full path' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "replaces all images" do
|
21
|
-
|
22
|
-
|
23
|
-
Asset.sync
|
24
|
-
remote = RemoteAsset.all
|
21
|
+
expected = Asset.all
|
25
22
|
|
26
|
-
|
27
|
-
|
23
|
+
Asset.sync
|
24
|
+
actual = RemoteAsset.all
|
25
|
+
|
26
|
+
actual.count.should == 8
|
27
|
+
actual.should == expected
|
28
28
|
end
|
29
29
|
end
|
@@ -65,13 +65,12 @@ describe 'full path' do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "replaces all images" do
|
68
|
-
|
68
|
+
expected = Asset.all
|
69
69
|
|
70
70
|
Asset.sync
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
local.each{|l| remote.should include(l) }
|
71
|
+
actual = RemoteAsset.all
|
72
|
+
|
73
|
+
actual.count.should == 7
|
74
|
+
actual.should == expected
|
76
75
|
end
|
77
76
|
end
|
data/spec/remote_asset_spec.rb
CHANGED
@@ -4,14 +4,16 @@ describe Trackman::Assets::RemoteAsset do
|
|
4
4
|
before :all do
|
5
5
|
user = ENV['HEROKU_USERNAME']
|
6
6
|
pass = ENV['HEROKU_PASSWORD']
|
7
|
-
server =
|
7
|
+
server = RemoteAsset.send(:class_variable_get, :@@server)
|
8
8
|
|
9
|
-
response = RestClient.post "
|
9
|
+
response = RestClient.post "https://#{user}:#{pass}@#{server}/heroku/resources", :plan => 'test', :heroku_id => 123
|
10
10
|
json = JSON.parse response
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
|
12
|
+
user = json['config']['TRACKMAN_USER']
|
13
|
+
pass = json['config']['TRACKMAN_PASSWORD']
|
14
|
+
app_id = json['id']
|
15
|
+
|
16
|
+
[[:@@app_id, app_id], [:@@user, user], [:@@pass, pass], [:@@site, "https://#{user}:#{pass}@#{server}/heroku/resources/#{app_id}/assets"]].each do |s, v|
|
15
17
|
RemoteAsset.send(:class_variable_set, s, v)
|
16
18
|
end
|
17
19
|
end
|
@@ -22,7 +24,7 @@ describe Trackman::Assets::RemoteAsset do
|
|
22
24
|
end
|
23
25
|
|
24
26
|
File.open('spec/test_data/y.css', 'w') {|f| f.write @old_file } unless @old_file.nil?
|
25
|
-
end
|
27
|
+
end
|
26
28
|
|
27
29
|
it "creates assets on the server" do
|
28
30
|
expected = RemoteAsset.new(:path => 'spec/test_data/test2.png')
|
@@ -43,9 +45,9 @@ describe Trackman::Assets::RemoteAsset do
|
|
43
45
|
end
|
44
46
|
|
45
47
|
it "returns all assets on the server" do
|
46
|
-
expected = ['spec/test_data/
|
48
|
+
expected = ['spec/test_data/y.css', 'spec/test_data/a.js', '/public/503-error.html', '/public/503.html', 'spec/test_data/sample.html']
|
47
49
|
|
48
|
-
assets = ['spec/test_data/
|
50
|
+
assets = ['spec/test_data/y.css', 'spec/test_data/a.js', 'spec/test_data/sample.html'].map { |f| RemoteAsset.new(:path => f) }
|
49
51
|
|
50
52
|
assets.each{|f| f.create! }
|
51
53
|
|
@@ -67,13 +69,20 @@ describe Trackman::Assets::RemoteAsset do
|
|
67
69
|
end
|
68
70
|
|
69
71
|
it "throws if a config is missing" do
|
72
|
+
configs = {
|
73
|
+
'@@server' => 'TRACKMAN_SERVER_URL',
|
74
|
+
'@@user' => 'TRACKMAN_USER',
|
75
|
+
'@@pass' => 'TRACKMAN_PASSWORD',
|
76
|
+
'@@app_id' => 'TRACKMAN_APP_ID'
|
77
|
+
}
|
70
78
|
begin
|
71
|
-
|
72
|
-
|
79
|
+
configs.each {|k,v| RemoteAsset.send(:class_variable_set, k, nil) }
|
80
|
+
configs.each do |k,v|
|
73
81
|
lambda { RemoteAsset.new(:path => 'spec/test_data/a.js') }.should raise_error(Trackman::Assets::Errors::ConfigNotFoundError)
|
82
|
+
RemoteAsset.send(:class_variable_set, k, ENV[v])
|
74
83
|
end
|
75
|
-
ensure
|
76
|
-
|
84
|
+
ensure
|
85
|
+
configs.each {|k,v| RemoteAsset.send(:class_variable_set, k, ENV[v]) }
|
77
86
|
end
|
78
87
|
end
|
79
88
|
end
|
data/trackman.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirement: &21774560 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,15 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ! '>='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '0'
|
25
|
+
version_requirements: *21774560
|
31
26
|
- !ruby/object:Gem::Dependency
|
32
27
|
name: json
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
28
|
+
requirement: &21774140 !ruby/object:Gem::Requirement
|
34
29
|
none: false
|
35
30
|
requirements:
|
36
31
|
- - ! '>='
|
@@ -38,15 +33,10 @@ dependencies:
|
|
38
33
|
version: '0'
|
39
34
|
type: :runtime
|
40
35
|
prerelease: false
|
41
|
-
version_requirements:
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
36
|
+
version_requirements: *21774140
|
47
37
|
- !ruby/object:Gem::Dependency
|
48
38
|
name: nokogiri
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirement: &21773700 !ruby/object:Gem::Requirement
|
50
40
|
none: false
|
51
41
|
requirements:
|
52
42
|
- - ! '>='
|
@@ -54,15 +44,10 @@ dependencies:
|
|
54
44
|
version: '0'
|
55
45
|
type: :runtime
|
56
46
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ! '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
47
|
+
version_requirements: *21773700
|
63
48
|
- !ruby/object:Gem::Dependency
|
64
49
|
name: rack
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirement: &21773260 !ruby/object:Gem::Requirement
|
66
51
|
none: false
|
67
52
|
requirements:
|
68
53
|
- - ! '>='
|
@@ -70,15 +55,21 @@ dependencies:
|
|
70
55
|
version: '0'
|
71
56
|
type: :runtime
|
72
57
|
prerelease: false
|
73
|
-
version_requirements:
|
58
|
+
version_requirements: *21773260
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: heroku
|
61
|
+
requirement: &21772740 !ruby/object:Gem::Requirement
|
74
62
|
none: false
|
75
63
|
requirements:
|
76
64
|
- - ! '>='
|
77
65
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
66
|
+
version: 2.26.2
|
67
|
+
type: :runtime
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *21772740
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: rspec
|
81
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirement: &21772300 !ruby/object:Gem::Requirement
|
82
73
|
none: false
|
83
74
|
requirements:
|
84
75
|
- - ! '>='
|
@@ -86,12 +77,7 @@ dependencies:
|
|
86
77
|
version: '0'
|
87
78
|
type: :development
|
88
79
|
prerelease: false
|
89
|
-
version_requirements:
|
90
|
-
none: false
|
91
|
-
requirements:
|
92
|
-
- - ! '>='
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '0'
|
80
|
+
version_requirements: *21772300
|
95
81
|
description: Trackman hosts your maintenances and app-down pages (503s) and lets you
|
96
82
|
keep them in your current development environment so that you can focus on delivering
|
97
83
|
and not configuring.
|
@@ -169,7 +155,9 @@ files:
|
|
169
155
|
- spec/fixtures/rails2311/fully-loaded/public/422.html
|
170
156
|
- spec/fixtures/rails2311/fully-loaded/public/500.html
|
171
157
|
- spec/fixtures/rails2311/fully-loaded/public/503-error.html
|
158
|
+
- spec/fixtures/rails2311/fully-loaded/public/503-error.html~
|
172
159
|
- spec/fixtures/rails2311/fully-loaded/public/503.html
|
160
|
+
- spec/fixtures/rails2311/fully-loaded/public/503.html~
|
173
161
|
- spec/fixtures/rails2311/fully-loaded/public/favicon.ico
|
174
162
|
- spec/fixtures/rails2311/fully-loaded/public/images/rails.png
|
175
163
|
- spec/fixtures/rails2311/fully-loaded/public/index.html
|
@@ -428,7 +416,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
428
416
|
version: '0'
|
429
417
|
requirements: []
|
430
418
|
rubyforge_project:
|
431
|
-
rubygems_version: 1.8.
|
419
|
+
rubygems_version: 1.8.10
|
432
420
|
signing_key:
|
433
421
|
specification_version: 3
|
434
422
|
summary: Client version of the Trackman addon on Heroku
|