torquebox-stompbox 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,23 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  addressable (2.2.5)
5
+ akephalos (0.2.5-java)
6
+ capybara (~> 0.4.0)
5
7
  backports (2.1.0)
6
8
  bcrypt-ruby (2.1.4-java)
9
+ capybara (0.4.1.2)
10
+ celerity (>= 0.7.9)
11
+ culerity (>= 0.2.4)
12
+ mime-types (>= 1.16)
13
+ nokogiri (>= 1.3.3)
14
+ rack (>= 1.0.0)
15
+ rack-test (>= 0.5.4)
16
+ selenium-webdriver (>= 0.0.27)
17
+ xpath (~> 0.1.3)
18
+ celerity (0.8.9)
19
+ childprocess (0.1.8)
20
+ ffi (~> 1.0.6)
21
+ culerity (0.2.15)
7
22
  data_mapper (1.1.0)
8
23
  dm-aggregates (= 1.1.0)
9
24
  dm-constraints (= 1.1.0)
@@ -14,7 +29,7 @@ GEM
14
29
  dm-transactions (= 1.1.0)
15
30
  dm-types (= 1.1.0)
16
31
  dm-validations (= 1.1.0)
17
- data_objects (0.10.4)
32
+ data_objects (0.10.5)
18
33
  addressable (~> 2.1)
19
34
  diff-lcs (1.1.2)
20
35
  dm-aggregates (1.1.0)
@@ -53,45 +68,55 @@ GEM
53
68
  uuidtools (~> 2.1.2)
54
69
  dm-validations (1.1.0)
55
70
  dm-core (~> 1.1.0)
56
- do_jdbc (0.10.4-java)
57
- data_objects (= 0.10.4)
58
- do_postgres (0.10.4-java)
59
- data_objects (= 0.10.4)
60
- do_jdbc (= 0.10.4)
71
+ do_jdbc (0.10.5-java)
72
+ data_objects (= 0.10.5)
73
+ do_postgres (0.10.5-java)
74
+ data_objects (= 0.10.5)
75
+ do_jdbc (= 0.10.5)
61
76
  jdbc-postgres (>= 8.2)
62
- do_sqlite3 (0.10.4-java)
63
- data_objects (= 0.10.4)
64
- do_jdbc (= 0.10.4)
77
+ do_sqlite3 (0.10.5-java)
78
+ data_objects (= 0.10.5)
79
+ do_jdbc (= 0.10.5)
65
80
  jdbc-sqlite3 (>= 3.5.8)
66
81
  extlib (0.9.15)
67
82
  fastercsv (1.5.4)
83
+ ffi (1.0.7-java)
68
84
  git (1.2.5)
69
85
  haml (3.1.1)
70
86
  jdbc-postgres (9.0.801)
71
87
  jdbc-sqlite3 (3.6.14.2.056-java)
72
- jeweler (1.5.2)
88
+ jeweler (1.6.0)
73
89
  bundler (~> 1.0.0)
74
90
  git (>= 1.2.5)
75
91
  rake
76
92
  json (1.4.6-java)
77
93
  json_pure (1.5.1)
94
+ mime-types (1.16)
78
95
  monkey-lib (0.5.4)
79
96
  backports
97
+ nokogiri (1.4.4.2-java)
98
+ weakling (>= 0.0.3)
80
99
  rack (1.2.2)
81
100
  rack-flash (0.1.1)
82
101
  rack
83
- rack-test (0.5.7)
102
+ rack-test (0.6.0)
84
103
  rack (>= 1.0)
85
104
  rake (0.8.7)
86
105
  rspec (2.5.0)
87
106
  rspec-core (~> 2.5.0)
88
107
  rspec-expectations (~> 2.5.0)
89
108
  rspec-mocks (~> 2.5.0)
90
- rspec-core (2.5.1)
109
+ rspec-core (2.5.2)
91
110
  rspec-expectations (2.5.0)
92
111
  diff-lcs (~> 1.1.2)
93
112
  rspec-mocks (2.5.0)
113
+ rubyzip (0.9.4)
94
114
  sass (3.1.1)
115
+ selenium-webdriver (0.2.0)
116
+ childprocess (>= 0.1.7)
117
+ ffi (>= 1.0.7)
118
+ json_pure
119
+ rubyzip
95
120
  sinatra (1.1.2)
96
121
  rack (~> 1.1)
97
122
  tilt (~> 1.2)
@@ -102,7 +127,7 @@ GEM
102
127
  sinatra-reloader (0.5.0)
103
128
  sinatra (~> 1.0)
104
129
  sinatra-advanced-routes (~> 0.5.0)
105
- sinatra-sugar (0.5.0)
130
+ sinatra-sugar (0.5.1)
106
131
  monkey-lib (~> 0.5.0)
107
132
  sinatra (~> 1.0)
108
133
  sqlite3 (1.3.3)
@@ -125,13 +150,20 @@ GEM
125
150
  torquebox-rake-support (1.0.0)
126
151
  torquebox-vfs (1.0.0-java)
127
152
  torquebox-web (1.0.0-java)
153
+ torquespec (0.0.6)
154
+ rspec
128
155
  uuidtools (2.1.2)
156
+ weakling (0.0.4-java)
157
+ xpath (0.1.4)
158
+ nokogiri (~> 1.3)
129
159
 
130
160
  PLATFORMS
131
161
  java
132
162
 
133
163
  DEPENDENCIES
164
+ akephalos
134
165
  bundler
166
+ capybara
135
167
  data_mapper (~> 1.1)
136
168
  dm-core (~> 1.1)
137
169
  dm-migrations (~> 1.1)
@@ -155,3 +187,4 @@ DEPENDENCIES
155
187
  state_machine
156
188
  thor
157
189
  torquebox (= 1.0.0)
190
+ torquespec
@@ -5,8 +5,8 @@
5
5
  %input{:type=>:text, :name=>'repository[branch]', :value=>repository.branch}
6
6
  %label{:for=>'repository[branch]'} Branch
7
7
  %p
8
- %label{:for=>'repository[environment]'} TorqueBox configuration as YAML
8
+ %label{:for=>'repository[config]'} TorqueBox configuration as YAML
9
9
  %br
10
- %textarea{:name=>'repository[environment]'}
11
- =repository.environment
10
+ %textarea{:name=>'repository[config]'}
11
+ =repository.config
12
12
 
@@ -0,0 +1,13 @@
1
+ application:
2
+ rackup: config.ru
3
+
4
+ web:
5
+ context: /stompbox
6
+
7
+ environment:
8
+ # Sample configuration options
9
+ # AUTO_MIGRATE: true
10
+ # DATABASE_URL: postgres://stompbox:stompbox@localhost/stompbox
11
+ # DEPLOYMENTS: /opt/deployments
12
+ # API_KEY: 3821A95D456134214FAD6FA91A2BAFE574D47151
13
+
@@ -0,0 +1,80 @@
1
+ #facebox {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ z-index: 100;
6
+ text-align: left;
7
+ }
8
+
9
+
10
+ #facebox .popup{
11
+ position:relative;
12
+ border:3px solid rgba(0,0,0,0);
13
+ -webkit-border-radius:5px;
14
+ -moz-border-radius:5px;
15
+ border-radius:5px;
16
+ -webkit-box-shadow:0 0 18px rgba(0,0,0,0.4);
17
+ -moz-box-shadow:0 0 18px rgba(0,0,0,0.4);
18
+ box-shadow:0 0 18px rgba(0,0,0,0.4);
19
+ }
20
+
21
+ #facebox .content {
22
+ display:table;
23
+ width: 370px;
24
+ padding: 10px;
25
+ background: #fff;
26
+ -webkit-border-radius:4px;
27
+ -moz-border-radius:4px;
28
+ border-radius:4px;
29
+ }
30
+
31
+ #facebox .content > p:first-child{
32
+ margin-top:0;
33
+ }
34
+ #facebox .content > p:last-child{
35
+ margin-bottom:0;
36
+ }
37
+
38
+ #facebox .close{
39
+ position:absolute;
40
+ top:5px;
41
+ right:5px;
42
+ padding:2px;
43
+ background:#fff;
44
+ }
45
+ #facebox .close img{
46
+ opacity:0.3;
47
+ }
48
+ #facebox .close:hover img{
49
+ opacity:1.0;
50
+ }
51
+
52
+ #facebox .loading {
53
+ text-align: center;
54
+ }
55
+
56
+ #facebox .image {
57
+ text-align: center;
58
+ }
59
+
60
+ #facebox img {
61
+ border: 0;
62
+ margin: 0;
63
+ }
64
+
65
+ #facebox_overlay {
66
+ position: fixed;
67
+ top: 0px;
68
+ left: 0px;
69
+ height:100%;
70
+ width:100%;
71
+ }
72
+
73
+ .facebox_hide {
74
+ z-index:-100;
75
+ }
76
+
77
+ .facebox_overlayBG {
78
+ background-color: #000;
79
+ z-index: 99;
80
+ }
Binary file
@@ -0,0 +1,309 @@
1
+ /*
2
+ * Facebox (for jQuery)
3
+ * version: 1.3
4
+ * @requires jQuery v1.2 or later
5
+ * @homepage https://github.com/defunkt/facebox
6
+ *
7
+ * Licensed under the MIT:
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * Copyright Forever Chris Wanstrath, Kyle Neath
11
+ *
12
+ * Usage:
13
+ *
14
+ * jQuery(document).ready(function() {
15
+ * jQuery('a[rel*=facebox]').facebox()
16
+ * })
17
+ *
18
+ * <a href="#terms" rel="facebox">Terms</a>
19
+ * Loads the #terms div in the box
20
+ *
21
+ * <a href="terms.html" rel="facebox">Terms</a>
22
+ * Loads the terms.html page in the box
23
+ *
24
+ * <a href="terms.png" rel="facebox">Terms</a>
25
+ * Loads the terms.png image in the box
26
+ *
27
+ *
28
+ * You can also use it programmatically:
29
+ *
30
+ * jQuery.facebox('some html')
31
+ * jQuery.facebox('some html', 'my-groovy-style')
32
+ *
33
+ * The above will open a facebox with "some html" as the content.
34
+ *
35
+ * jQuery.facebox(function($) {
36
+ * $.get('blah.html', function(data) { $.facebox(data) })
37
+ * })
38
+ *
39
+ * The above will show a loading screen before the passed function is called,
40
+ * allowing for a better ajaxy experience.
41
+ *
42
+ * The facebox function can also display an ajax page, an image, or the contents of a div:
43
+ *
44
+ * jQuery.facebox({ ajax: 'remote.html' })
45
+ * jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')
46
+ * jQuery.facebox({ image: 'stairs.jpg' })
47
+ * jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')
48
+ * jQuery.facebox({ div: '#box' })
49
+ * jQuery.facebox({ div: '#box' }, 'my-groovy-style')
50
+ *
51
+ * Want to close the facebox? Trigger the 'close.facebox' document event:
52
+ *
53
+ * jQuery(document).trigger('close.facebox')
54
+ *
55
+ * Facebox also has a bunch of other hooks:
56
+ *
57
+ * loading.facebox
58
+ * beforeReveal.facebox
59
+ * reveal.facebox (aliased as 'afterReveal.facebox')
60
+ * init.facebox
61
+ * afterClose.facebox
62
+ *
63
+ * Simply bind a function to any of these hooks:
64
+ *
65
+ * $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
66
+ *
67
+ */
68
+ (function($) {
69
+ $.facebox = function(data, klass) {
70
+ $.facebox.loading()
71
+
72
+ if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)
73
+ else if (data.image) fillFaceboxFromImage(data.image, klass)
74
+ else if (data.div) fillFaceboxFromHref(data.div, klass)
75
+ else if ($.isFunction(data)) data.call($)
76
+ else $.facebox.reveal(data, klass)
77
+ }
78
+
79
+ /*
80
+ * Public, $.facebox methods
81
+ */
82
+
83
+ $.extend($.facebox, {
84
+ settings: {
85
+ opacity : 0.2,
86
+ overlay : true,
87
+ loadingImage : '/facebox/loading.gif',
88
+ closeImage : '/facebox/closelabel.png',
89
+ imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
90
+ faceboxHtml : '\
91
+ <div id="facebox" style="display:none;"> \
92
+ <div class="popup"> \
93
+ <div class="content"> \
94
+ </div> \
95
+ <a href="#" class="close"></a> \
96
+ </div> \
97
+ </div>'
98
+ },
99
+
100
+ loading: function() {
101
+ init()
102
+ if ($('#facebox .loading').length == 1) return true
103
+ showOverlay()
104
+
105
+ $('#facebox .content').empty().
106
+ append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')
107
+
108
+ $('#facebox').show().css({
109
+ top: getPageScroll()[1] + (getPageHeight() / 10),
110
+ left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)
111
+ })
112
+
113
+ $(document).bind('keydown.facebox', function(e) {
114
+ if (e.keyCode == 27) $.facebox.close()
115
+ return true
116
+ })
117
+ $(document).trigger('loading.facebox')
118
+ },
119
+
120
+ reveal: function(data, klass) {
121
+ $(document).trigger('beforeReveal.facebox')
122
+ if (klass) $('#facebox .content').addClass(klass)
123
+ $('#facebox .content').empty().append(data)
124
+ $('#facebox .popup').children().fadeIn('normal')
125
+ $('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))
126
+ $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
127
+ },
128
+
129
+ close: function() {
130
+ $(document).trigger('close.facebox')
131
+ return false
132
+ }
133
+ })
134
+
135
+ /*
136
+ * Public, $.fn methods
137
+ */
138
+
139
+ $.fn.facebox = function(settings) {
140
+ if ($(this).length == 0) return
141
+
142
+ init(settings)
143
+
144
+ function clickHandler() {
145
+ $.facebox.loading(true)
146
+
147
+ // support for rel="facebox.inline_popup" syntax, to add a class
148
+ // also supports deprecated "facebox[.inline_popup]" syntax
149
+ var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
150
+ if (klass) klass = klass[1]
151
+
152
+ fillFaceboxFromHref(this.href, klass)
153
+ return false
154
+ }
155
+
156
+ return this.bind('click.facebox', clickHandler)
157
+ }
158
+
159
+ /*
160
+ * Private methods
161
+ */
162
+
163
+ // called one time to setup facebox on this page
164
+ function init(settings) {
165
+ if ($.facebox.settings.inited) return true
166
+ else $.facebox.settings.inited = true
167
+
168
+ $(document).trigger('init.facebox')
169
+ makeCompatible()
170
+
171
+ var imageTypes = $.facebox.settings.imageTypes.join('|')
172
+ $.facebox.settings.imageTypesRegexp = new RegExp('\\.(' + imageTypes + ')(\\?.*)?$', 'i')
173
+
174
+ if (settings) $.extend($.facebox.settings, settings)
175
+ $('body').append($.facebox.settings.faceboxHtml)
176
+
177
+ var preload = [ new Image(), new Image() ]
178
+ preload[0].src = $.facebox.settings.closeImage
179
+ preload[1].src = $.facebox.settings.loadingImage
180
+
181
+ $('#facebox').find('.b:first, .bl').each(function() {
182
+ preload.push(new Image())
183
+ preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
184
+ })
185
+
186
+ $('#facebox .close')
187
+ .click($.facebox.close)
188
+ .append('<img src="'
189
+ + $.facebox.settings.closeImage
190
+ + '" class="close_image" title="close">')
191
+ }
192
+
193
+ // getPageScroll() by quirksmode.com
194
+ function getPageScroll() {
195
+ var xScroll, yScroll;
196
+ if (self.pageYOffset) {
197
+ yScroll = self.pageYOffset;
198
+ xScroll = self.pageXOffset;
199
+ } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
200
+ yScroll = document.documentElement.scrollTop;
201
+ xScroll = document.documentElement.scrollLeft;
202
+ } else if (document.body) {// all other Explorers
203
+ yScroll = document.body.scrollTop;
204
+ xScroll = document.body.scrollLeft;
205
+ }
206
+ return new Array(xScroll,yScroll)
207
+ }
208
+
209
+ // Adapted from getPageSize() by quirksmode.com
210
+ function getPageHeight() {
211
+ var windowHeight
212
+ if (self.innerHeight) { // all except Explorer
213
+ windowHeight = self.innerHeight;
214
+ } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
215
+ windowHeight = document.documentElement.clientHeight;
216
+ } else if (document.body) { // other Explorers
217
+ windowHeight = document.body.clientHeight;
218
+ }
219
+ return windowHeight
220
+ }
221
+
222
+ // Backwards compatibility
223
+ function makeCompatible() {
224
+ var $s = $.facebox.settings
225
+
226
+ $s.loadingImage = $s.loading_image || $s.loadingImage
227
+ $s.closeImage = $s.close_image || $s.closeImage
228
+ $s.imageTypes = $s.image_types || $s.imageTypes
229
+ $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
230
+ }
231
+
232
+ // Figures out what you want to display and displays it
233
+ // formats are:
234
+ // div: #id
235
+ // image: blah.extension
236
+ // ajax: anything else
237
+ function fillFaceboxFromHref(href, klass) {
238
+ // div
239
+ if (href.match(/#/)) {
240
+ var url = window.location.href.split('#')[0]
241
+ var target = href.replace(url,'')
242
+ if (target == '#') return
243
+ $.facebox.reveal($(target).html(), klass)
244
+
245
+ // image
246
+ } else if (href.match($.facebox.settings.imageTypesRegexp)) {
247
+ fillFaceboxFromImage(href, klass)
248
+ // ajax
249
+ } else {
250
+ fillFaceboxFromAjax(href, klass)
251
+ }
252
+ }
253
+
254
+ function fillFaceboxFromImage(href, klass) {
255
+ var image = new Image()
256
+ image.onload = function() {
257
+ $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
258
+ }
259
+ image.src = href
260
+ }
261
+
262
+ function fillFaceboxFromAjax(href, klass) {
263
+ $.get(href, function(data) { $.facebox.reveal(data, klass) })
264
+ }
265
+
266
+ function skipOverlay() {
267
+ return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
268
+ }
269
+
270
+ function showOverlay() {
271
+ if (skipOverlay()) return
272
+
273
+ if ($('#facebox_overlay').length == 0)
274
+ $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')
275
+
276
+ $('#facebox_overlay').hide().addClass("facebox_overlayBG")
277
+ .css('opacity', $.facebox.settings.opacity)
278
+ .click(function() { $(document).trigger('close.facebox') })
279
+ .fadeIn(200)
280
+ return false
281
+ }
282
+
283
+ function hideOverlay() {
284
+ if (skipOverlay()) return
285
+
286
+ $('#facebox_overlay').fadeOut(200, function(){
287
+ $("#facebox_overlay").removeClass("facebox_overlayBG")
288
+ $("#facebox_overlay").addClass("facebox_hide")
289
+ $("#facebox_overlay").remove()
290
+ })
291
+
292
+ return false
293
+ }
294
+
295
+ /*
296
+ * Bindings
297
+ */
298
+
299
+ $(document).bind('close.facebox', function() {
300
+ $(document).unbind('keydown.facebox')
301
+ $('#facebox').fadeOut(function() {
302
+ $('#facebox .content').removeClass().addClass('content')
303
+ $('#facebox .loading').remove()
304
+ $(document).trigger('afterClose.facebox')
305
+ })
306
+ hideOverlay()
307
+ })
308
+
309
+ })(jQuery);
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torquebox-stompbox
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Lance Ball
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-06 00:00:00 -04:00
13
+ date: 2011-05-09 00:00:00 -04:00
14
14
  default_executable: stompbox
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -294,12 +294,12 @@ files:
294
294
  - bin/dbsetup
295
295
  - bin/stompbox
296
296
  - config.ru
297
+ - config/torquebox.yml
298
+ - public/css/facebox.css
299
+ - public/images/closelabel.png
300
+ - public/images/loading.gif
301
+ - public/javascript/facebox.js
297
302
  - stompbox.rb
298
- - spec/auth_spec.rb
299
- - spec/deployer_spec.rb
300
- - spec/repository_spec.rb
301
- - spec/spec_helper.rb
302
- - spec/stompbox_spec.rb
303
303
  has_rdoc: true
304
304
  homepage: http://github.com/torquebox/stompbox
305
305
  licenses:
@@ -331,9 +331,5 @@ rubygems_version: 1.5.1
331
331
  signing_key:
332
332
  specification_version: 3
333
333
  summary: StompBox - Git-based deployment console for TorqueBox
334
- test_files:
335
- - spec/auth_spec.rb
336
- - spec/deployer_spec.rb
337
- - spec/repository_spec.rb
338
- - spec/spec_helper.rb
339
- - spec/stompbox_spec.rb
334
+ test_files: []
335
+
@@ -1,50 +0,0 @@
1
- #
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- ENV['REQUIRE_AUTHENTICATION'] = 'true'
18
- ENV['RACK_ENV'] = 'test'
19
-
20
- require 'spec_helper'
21
-
22
- module StompBox
23
-
24
- describe 'application with authentication' do
25
-
26
- it "should redirect to login if credentials are not supplied" do
27
- get '/'
28
- last_response.should be_redirect
29
- end
30
-
31
- it "should redirect to login if credentials are incorrect" do
32
- authenticator = Object.new
33
- TorqueBox::Authentication.stub!(:default).and_return(authenticator)
34
- authenticator.stub!(:authenticate).and_return(false)
35
- post '/login', {:user=>:foo, :password=>:bar}
36
- last_response.should be_redirect
37
- end
38
-
39
- it "should allow access when authorized" do
40
- rack_mock_session.stub!('authenticated?').and_return(true)
41
- get "/"
42
- # last_response.should be_ok
43
- puts "TODO: This test is incorrect"
44
- end
45
-
46
- end
47
-
48
- end
49
-
50
-
@@ -1,92 +0,0 @@
1
- #
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require 'spec_helper'
18
-
19
- module StompBox
20
- describe Deployer do
21
-
22
- ENV['TORQUEBOX_HOME'] = './.apps'
23
-
24
- it "should write a YAML file" do
25
- config = {
26
- 'environment' => { 'oauth_key' => '123456789', 'oauth_secret' => '987654321' }
27
- }
28
- repo = Repository.create(:name=>'github', :branch=>'master', :config=>config)
29
- push = Push.new(:payload=>payload)
30
- push.stub!(:find_repository).and_return(repo)
31
- deployer = Deployer.new(push)
32
- deployer.write_descriptor
33
- end
34
-
35
- it "should fail gracefully if the repository can't be found" do
36
- config = {
37
- 'environment' => { 'oauth_key' => '123456789', 'oauth_secret' => '987654321' }
38
- }
39
- push = Push.new(:payload=>payload)
40
- deployer = Deployer.new(push)
41
- deployer.write_descriptor.should be_false
42
- end
43
- end
44
-
45
-
46
- end
47
-
48
-
49
- def payload
50
- <<END
51
- {"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
52
- "repository": {
53
- "url": "http://github.com/defunkt/github",
54
- "name": "github",
55
- "description": "You are looking at it.",
56
- "watchers": "5",
57
- "forks": "2",
58
- "private": "1",
59
- "owner": {
60
- "email": "chris@ozmm.org",
61
- "name": "defunkt"
62
- }
63
- },
64
-
65
- "commits": [
66
- {
67
- "id": "41a212ee83ca127e3c8cf465891ab7216a705f59",
68
- "url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
69
- "author": {
70
- "email": "chris@ozmm.org",
71
- "name": "Chris Wanstrath"
72
- },
73
- "message": "okay i give in",
74
- "timestamp": "2008-02-15T14:57:17-08:00",
75
- "added": ["filepath.rb"]
76
- },
77
- {
78
- "id": "de8251ff97ee194a289832576287d6f8ad74e3d0",
79
- "url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
80
- "author": {
81
- "email": "chris@ozmm.org",
82
- "name": "Chris Wanstrath"
83
- },
84
- "message": "update pricing a tad",
85
- "timestamp": "2008-02-15T14:36:34-08:00"
86
- }
87
- ],
88
- "after": "de8251ff97ee194a289832576287d6f8ad74e3d0",
89
- "ref": "refs/heads/master"
90
- }
91
- END
92
- end
@@ -1,31 +0,0 @@
1
- #
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require 'spec_helper'
18
-
19
- module StompBox
20
-
21
- describe Repository do
22
-
23
- it "should store config variables" do
24
- config = {:oauth_key=>'123', :oauth_secret=>'456'}
25
- repository = Repository.new(:name=>'chirpr', :branch=>'master', :config=>config)
26
- repository.config.should == config
27
- end
28
- end
29
-
30
- end
31
-
@@ -1,38 +0,0 @@
1
- #
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require 'rack/test'
18
- require 'stompbox'
19
-
20
- # set test environment
21
- Sinatra::Base.set :environment, :test
22
- Sinatra::Base.set :run, false
23
- Sinatra::Base.set :raise_errors, true
24
- Sinatra::Base.set :logging, false
25
-
26
- DataMapper.setup(:default, "sqlite3::memory:")
27
-
28
- def app
29
- @app ||= StompBox::Application.new
30
- end
31
-
32
- RSpec.configure do |conf|
33
- conf.include Rack::Test::Methods
34
- # reset database before each example is run
35
- conf.before(:each) { DataMapper.auto_migrate! }
36
- end
37
-
38
-
@@ -1,54 +0,0 @@
1
- #
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require 'spec_helper'
18
-
19
- module StompBox
20
-
21
- describe 'routes' do
22
-
23
- before(:each) do
24
- app.stub!(:require_authentication).and_return(true)
25
- end
26
-
27
- it "should respond to GET /"# do
28
- # get '/'
29
- # last_response.should be_ok
30
- # end
31
-
32
- it "should respond to GET /repositories" #do
33
- # get '/repositories'
34
- # last_response.should be_ok
35
- # end
36
-
37
- it "should respond to POST /repositories" do
38
- post '/repositories'
39
- last_response.should be_redirect
40
- end
41
-
42
- it "should respond to PUT /repositories" do
43
- put '/repositories/1'
44
- last_response.should be_redirect
45
- end
46
-
47
- it "should respond to DELETE /repositories/:id" do
48
- delete '/repositories/1'
49
- last_response.should be_redirect
50
- end
51
-
52
- end
53
-
54
- end