prologue 0.3.11 → 0.4.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.lock +1 -1
- data/README.md +2 -1
- data/lib/prologue/version.rb +1 -1
- data/templates/admin.rb +7 -1
- data/templates/admin/layout.rb +3 -2
- data/templates/application_layout.rb +3 -2
- data/templates/bootstrap.rb +11 -6
- data/templates/evergreen.rb +174 -0
- data/templates/gemfile.rb +2 -1
- data/templates/js.rb +40 -27
- metadata +6 -5
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Generate a Rails 3 app with the application templates Quick Left uses to start t
|
|
8
8
|
Prologue provides a base Rails 3 application with Devise and Cancan for authentication and authorization. Roles are
|
9
9
|
stored in the database with a HABTM relationship between the role and user models. You also get a basic admin to manage
|
10
10
|
users. Prologue also rolls in all of the things we like to have setup in our apps like...
|
11
|
-
haml, sass, jquery, cucumber, capybara, mocha, factory_girl, rspec, timecop, autotest, will_paginate, friendly_id, and hoptoad_notifier
|
11
|
+
haml, sass, jquery, cucumber, capybara, mocha, factory_girl, rspec, timecop, autotest, evergreen, jasmine, will_paginate, friendly_id, and hoptoad_notifier
|
12
12
|
|
13
13
|
Everything is configured and ready to rock your next Rails 3 project. We hope it saves you a mess of time!
|
14
14
|
|
@@ -33,6 +33,7 @@ Everything is configured and ready to rock your next Rails 3 project. We hope i
|
|
33
33
|
|
34
34
|
rake spec
|
35
35
|
rake cucumber
|
36
|
+
rake spec:javascripts
|
36
37
|
bundle exec autotest
|
37
38
|
|
38
39
|
|
data/lib/prologue/version.rb
CHANGED
data/templates/admin.rb
CHANGED
@@ -11,6 +11,12 @@ create_file 'app/controllers/admin/base_controller.rb' do
|
|
11
11
|
class Admin::BaseController < ApplicationController
|
12
12
|
layout 'admin'
|
13
13
|
before_filter :authenticate_user!
|
14
|
+
before_filter :verify_admin
|
15
|
+
|
16
|
+
private
|
17
|
+
def verify_admin
|
18
|
+
redirect_to root_url unless current_user.role? :admin
|
19
|
+
end
|
14
20
|
end
|
15
21
|
RUBY
|
16
22
|
end
|
@@ -21,4 +27,4 @@ gsub_file 'app/controllers/admin/dashboard_controller.rb', /ApplicationControlle
|
|
21
27
|
apply File.expand_path("../admin/users.rb", __FILE__)
|
22
28
|
apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
|
23
29
|
apply File.expand_path("../admin/users_spec.rb", __FILE__)
|
24
|
-
apply File.expand_path("../admin/cucumber.rb", __FILE__)
|
30
|
+
apply File.expand_path("../admin/cucumber.rb", __FILE__)
|
data/templates/admin/layout.rb
CHANGED
@@ -53,7 +53,8 @@ create_file 'app/views/layouts/admin.html.haml' do
|
|
53
53
|
%title
|
54
54
|
#{app_name.humanize}
|
55
55
|
= yield(:title)
|
56
|
-
%meta{:name => 'viewport', :content => 'width=device-width
|
56
|
+
%meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
|
57
|
+
%meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
|
57
58
|
= csrf_meta_tag
|
58
59
|
%link{:rel => "shortcut icon", :href => "/images/favicon.ico", :type => "image/x-icon"}
|
59
60
|
/[if lt IE 9]
|
@@ -73,4 +74,4 @@ create_file 'app/views/layouts/admin.html.haml' do
|
|
73
74
|
= render :partial => "admin/shared/footer"
|
74
75
|
= render :partial => "admin/shared/end_scripts"
|
75
76
|
FILE
|
76
|
-
end
|
77
|
+
end
|
@@ -47,7 +47,8 @@ create_file 'app/views/layouts/application.html.haml' do
|
|
47
47
|
= yield(:title)
|
48
48
|
%meta{:name => 'description', :content => ''}
|
49
49
|
%meta{:name => 'author', :content => ''}
|
50
|
-
%meta{:name => 'viewport', :content => 'width=device-width
|
50
|
+
%meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
|
51
|
+
%meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
|
51
52
|
= csrf_meta_tag
|
52
53
|
%link{:rel => "shortcut icon", :href => "/images/favicon.ico", :type => "image/x-icon"}
|
53
54
|
%link{:rel => "apple-touch-icon", :href => "/images/ati.png"}
|
@@ -68,4 +69,4 @@ create_file 'app/views/layouts/application.html.haml' do
|
|
68
69
|
= render :partial => "shared/footer"
|
69
70
|
= render :partial => "shared/end_scripts"
|
70
71
|
FILE
|
71
|
-
end
|
72
|
+
end
|
data/templates/bootstrap.rb
CHANGED
@@ -24,6 +24,8 @@ append_file '.gitignore' do
|
|
24
24
|
'db/*.sqlite3'
|
25
25
|
'public/system/**/**/**/*'
|
26
26
|
'.idea/*'
|
27
|
+
'.sass-cache/**/*'
|
28
|
+
'*.swp'
|
27
29
|
end
|
28
30
|
|
29
31
|
git :init
|
@@ -43,16 +45,19 @@ apply File.expand_path("../rails_clean.rb", __FILE__)
|
|
43
45
|
# Apply js
|
44
46
|
apply File.expand_path("../js.rb", __FILE__)
|
45
47
|
|
48
|
+
# Apply evergreen and jasmin
|
49
|
+
apply File.expand_path("../evergreen.rb", __FILE__)
|
50
|
+
|
46
51
|
# Apply HTML5 Layout
|
47
52
|
apply File.expand_path("../application_layout.rb", __FILE__)
|
48
53
|
|
49
|
-
# Apply SASS
|
54
|
+
# Apply SASS
|
50
55
|
apply File.expand_path("../sass.rb", __FILE__)
|
51
56
|
|
52
|
-
# Apply Test Suite
|
57
|
+
# Apply Test Suite
|
53
58
|
apply File.expand_path("../test_suite.rb", __FILE__)
|
54
59
|
|
55
|
-
# Apply Friendly Id
|
60
|
+
# Apply Friendly Id
|
56
61
|
apply File.expand_path("../friendly_id.rb", __FILE__)
|
57
62
|
|
58
63
|
# Apply Devise?
|
@@ -61,10 +66,10 @@ apply File.expand_path("../devise.rb", __FILE__) if ENV['PROLOGUE_AUTH']
|
|
61
66
|
# Apply admin
|
62
67
|
apply File.expand_path("../admin.rb", __FILE__) if ENV['PROLOGUE_ADMIN']
|
63
68
|
|
64
|
-
# Apply cancan
|
69
|
+
# Apply cancan
|
65
70
|
apply File.expand_path("../cancan.rb", __FILE__) if ENV['PROLOGUE_ROLES']
|
66
71
|
|
67
|
-
# Apply db create and migrations
|
72
|
+
# Apply db create and migrations
|
68
73
|
apply File.expand_path("../db.rb", __FILE__)
|
69
74
|
|
70
75
|
# Apply db seeds
|
@@ -104,4 +109,4 @@ say <<-D
|
|
104
109
|
#{login_msg}
|
105
110
|
|
106
111
|
########################################################################
|
107
|
-
D
|
112
|
+
D
|
@@ -0,0 +1,174 @@
|
|
1
|
+
empty_directory "spec/javascripts"
|
2
|
+
create_file 'spec/javascripts/spec_helper.js' do
|
3
|
+
<<-FILE
|
4
|
+
beforeEach(function() {
|
5
|
+
this.addMatchers({
|
6
|
+
toBeTypeOf: function(expected) {
|
7
|
+
if(typeof this.actual == expected)
|
8
|
+
return true;
|
9
|
+
else return false;
|
10
|
+
}
|
11
|
+
})
|
12
|
+
|
13
|
+
if (typeof jQuery != 'undefined') {
|
14
|
+
spyOn(jQuery.ajaxSettings, 'xhr').andCallFake(function() {
|
15
|
+
var newXhr = new FakeXMLHttpRequest();
|
16
|
+
ajaxRequests.push(newXhr);
|
17
|
+
return newXhr;
|
18
|
+
});
|
19
|
+
}
|
20
|
+
|
21
|
+
if (typeof Prototype != 'undefined') {
|
22
|
+
spyOn(Ajax, "getTransport").andCallFake(function() {
|
23
|
+
return new FakeXMLHttpRequest();
|
24
|
+
});
|
25
|
+
}
|
26
|
+
|
27
|
+
clearAjaxRequests();
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
/*
|
32
|
+
Jasmine-Ajax : a set of helpers for testing AJAX requests under the Jasmine
|
33
|
+
BDD framework for JavaScript.
|
34
|
+
|
35
|
+
Supports both Prototype.js and jQuery.
|
36
|
+
|
37
|
+
http://github.com/pivotal/jasmine-ajax
|
38
|
+
|
39
|
+
Jasmine Home page: http://pivotal.github.com/jasmine
|
40
|
+
|
41
|
+
Copyright (c) 2008-2010 Pivotal Labs
|
42
|
+
|
43
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
44
|
+
a copy of this software and associated documentation files (the
|
45
|
+
"Software"), to deal in the Software without restriction, including
|
46
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
47
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
48
|
+
permit persons to whom the Software is furnished to do so, subject to
|
49
|
+
the following conditions:
|
50
|
+
|
51
|
+
The above copyright notice and this permission notice shall be
|
52
|
+
included in all copies or substantial portions of the Software.
|
53
|
+
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
55
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
56
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
57
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
58
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
59
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
60
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
61
|
+
|
62
|
+
*/
|
63
|
+
|
64
|
+
// Jasmine-Ajax interface
|
65
|
+
var ajaxRequests = [];
|
66
|
+
|
67
|
+
function mostRecentAjaxRequest() {
|
68
|
+
if (ajaxRequests.length > 0) {
|
69
|
+
return ajaxRequests[ajaxRequests.length - 1];
|
70
|
+
} else {
|
71
|
+
return null;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
function clearAjaxRequests() {
|
76
|
+
ajaxRequests = [];
|
77
|
+
}
|
78
|
+
|
79
|
+
// Fake XHR for mocking Ajax Requests & Responses
|
80
|
+
function FakeXMLHttpRequest() {
|
81
|
+
var xhr = {
|
82
|
+
requestHeaders: {},
|
83
|
+
|
84
|
+
open: function() {
|
85
|
+
xhr.method = arguments[0];
|
86
|
+
xhr.url = arguments[1];
|
87
|
+
xhr.readyState = 1;
|
88
|
+
},
|
89
|
+
|
90
|
+
setRequestHeader: function(header, value) {
|
91
|
+
xhr.requestHeaders[header] = value;
|
92
|
+
},
|
93
|
+
|
94
|
+
abort: function() {
|
95
|
+
xhr.readyState = 0;
|
96
|
+
},
|
97
|
+
|
98
|
+
readyState: 0,
|
99
|
+
|
100
|
+
onreadystatechange: function() {
|
101
|
+
},
|
102
|
+
|
103
|
+
status: null,
|
104
|
+
|
105
|
+
send: function(data) {
|
106
|
+
xhr.params = data;
|
107
|
+
xhr.readyState = 2;
|
108
|
+
},
|
109
|
+
|
110
|
+
getResponseHeader: function(name) {
|
111
|
+
return xhr.responseHeaders[name];
|
112
|
+
},
|
113
|
+
|
114
|
+
responseText: null,
|
115
|
+
|
116
|
+
response: function(response) {
|
117
|
+
xhr.status = response.status;
|
118
|
+
xhr.responseText = response.responseText || "";
|
119
|
+
xhr.readyState = 4;
|
120
|
+
xhr.responseHeaders = response.responseHeaders ||
|
121
|
+
{"Content-type": response.contentType || "application/json" };
|
122
|
+
|
123
|
+
// uncomment for jquery 1.3.x support
|
124
|
+
// jasmine.Clock.tick(20);
|
125
|
+
|
126
|
+
xhr.onreadystatechange();
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
return xhr;
|
131
|
+
}
|
132
|
+
|
133
|
+
// Jasmine-Ajax Glue code for Prototype.js
|
134
|
+
if (typeof Prototype != 'undefined' && Ajax && Ajax.Request) {
|
135
|
+
Ajax.Request.prototype.originalRequest = Ajax.Request.prototype.request;
|
136
|
+
Ajax.Request.prototype.request = function(url) {
|
137
|
+
this.originalRequest(url);
|
138
|
+
ajaxRequests.push(this);
|
139
|
+
};
|
140
|
+
|
141
|
+
Ajax.Request.prototype.response = function(responseOptions) {
|
142
|
+
return this.transport.response(responseOptions);
|
143
|
+
};
|
144
|
+
}
|
145
|
+
FILE
|
146
|
+
end
|
147
|
+
|
148
|
+
create_file 'spec/javascripts/core_spec.js' do
|
149
|
+
<<-FILE
|
150
|
+
require('/javascripts/jquery.js')
|
151
|
+
require('/javascripts/core.js')
|
152
|
+
|
153
|
+
describe('Ql core', function () {
|
154
|
+
it("should return a QL object" , function() {
|
155
|
+
expect(Ql).toBeTypeOf('object');
|
156
|
+
})
|
157
|
+
|
158
|
+
it("should be a Ql object" , function() {
|
159
|
+
expect(Ql).toBe(window.Ql);
|
160
|
+
})
|
161
|
+
|
162
|
+
describe('Ql helpers', function() {
|
163
|
+
var testArray = ['a','b','c'],
|
164
|
+
resultObject = {a:'',b:'',c:''};
|
165
|
+
|
166
|
+
it('should find the string in the array', function(){
|
167
|
+
expect(Ql.helpers.arraySearch(testArray)).toEqual(resultObject);
|
168
|
+
})
|
169
|
+
|
170
|
+
})
|
171
|
+
|
172
|
+
})
|
173
|
+
FILE
|
174
|
+
end
|
data/templates/gemfile.rb
CHANGED
@@ -31,6 +31,7 @@ gem "capybara", "~> 0.4.0", :group => [:cucumber]
|
|
31
31
|
gem "launchy", :group => [:cucumber]
|
32
32
|
gem "timecop", :group => [:test, :cucumber]
|
33
33
|
gem "pickle", :group => [:test, :cucumber]
|
34
|
+
gem "evergreen", :require => "evergreen/rails", :group => [:test, :development]
|
34
35
|
|
35
36
|
# for windows users
|
36
37
|
if ( (Config::CONFIG['host_os'] =~ /mswin|mingw/) && (Config::CONFIG["ruby_version"] =~ /1.8/) )
|
@@ -38,4 +39,4 @@ if ( (Config::CONFIG['host_os'] =~ /mswin|mingw/) && (Config::CONFIG["ruby_versi
|
|
38
39
|
gem "windows-pr", :group => [:test, :cucumber]
|
39
40
|
gem "win32-open3"
|
40
41
|
end
|
41
|
-
run 'bundle install'
|
42
|
+
run 'bundle install'
|
data/templates/js.rb
CHANGED
@@ -7,52 +7,65 @@ run 'rm public/javascripts/application.js'
|
|
7
7
|
create_file 'public/javascripts/core.js' do
|
8
8
|
<<-FILE
|
9
9
|
(function($){
|
10
|
-
var
|
10
|
+
var Ql = Ql || {};
|
11
11
|
|
12
|
-
|
13
|
-
init: function
|
12
|
+
Ql = {
|
13
|
+
init: function Ql_init(){
|
14
14
|
// some code that needs to be executed after doc ready
|
15
|
-
|
15
|
+
Ql.bindEvents();
|
16
16
|
},
|
17
|
-
bindEvents: function
|
17
|
+
bindEvents: function Ql_liveEvents(){
|
18
18
|
$('a[rel*=external]').live('click',function(){
|
19
19
|
window.open(this.href);
|
20
20
|
return false;
|
21
21
|
});
|
22
22
|
|
23
23
|
// more globally bound events
|
24
|
-
|
25
|
-
|
24
|
+
},
|
25
|
+
submit: function(ajax_url,ajax_data,ajax_type,callback){
|
26
|
+
$.ajax({
|
27
|
+
type: ajax_type,
|
28
|
+
url: ajax_url,
|
29
|
+
data: ajax_data,
|
30
|
+
success: function(data) {
|
31
|
+
if(typeof callback.onSuccess == 'function'){
|
32
|
+
callback.onSuccess.call(this, data);
|
33
|
+
}
|
34
|
+
},
|
35
|
+
error: function(data,status){
|
36
|
+
if(typeof callback.onError == 'function'){
|
37
|
+
if(data.status == '403') {
|
38
|
+
return callback.onDenied.call(this, data);
|
39
|
+
}
|
40
|
+
callback.onError.call(this, data);
|
41
|
+
}
|
42
|
+
},
|
43
|
+
complete: function(data){
|
44
|
+
if(typeof callback.onComplete == 'function'){
|
45
|
+
callback.onComplete.call(this, data);
|
46
|
+
}
|
47
|
+
},
|
48
|
+
denied: function(data){
|
49
|
+
if(typeof callback.onDenied == 'function'){
|
50
|
+
callback.onDenied.call(this, data);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
});
|
54
|
+
},
|
55
|
+
helpers: {
|
26
56
|
// helper for searching through arrays
|
27
|
-
|
57
|
+
arraySearch: function(a){
|
28
58
|
var o = {};
|
29
59
|
for(var i=0;i<a.length;i++){
|
30
60
|
o[a[i]]='';
|
31
61
|
}
|
32
62
|
return o;
|
33
|
-
};
|
34
|
-
//j. resigs array remove overload
|
35
|
-
Array.prototype.remove = function(from, to) {
|
36
|
-
var rest = this.slice((to || from) + 1 || this.length);
|
37
|
-
this.length = from < 0 ? this.length + from : from;
|
38
|
-
return this.push.apply(this, rest);
|
39
|
-
};
|
40
|
-
// duck punch Array.indexOf into IE browsers
|
41
|
-
if(!Array.indexOf){
|
42
|
-
Array.prototype.indexOf = function(obj){
|
43
|
-
for(var i=0; i<this.length; i++){
|
44
|
-
if(this[i]==obj){
|
45
|
-
return i;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
return -1;
|
49
63
|
}
|
50
64
|
}
|
51
65
|
}
|
52
|
-
};
|
53
66
|
|
54
|
-
window.
|
55
|
-
$(document).ready(
|
67
|
+
window.Ql = Ql;
|
68
|
+
$(document).ready(Ql.init);
|
56
69
|
|
57
70
|
})(jQuery);
|
58
71
|
FILE
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Quick Left
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-17 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- templates/devise.rb
|
141
141
|
- templates/devise/cucumber.rb
|
142
142
|
- templates/dynamic_form.rb
|
143
|
+
- templates/evergreen.rb
|
143
144
|
- templates/friendly_id.rb
|
144
145
|
- templates/gemfile.rb
|
145
146
|
- templates/haml_generator.rb
|
@@ -184,6 +185,6 @@ rubyforge_project: prologue
|
|
184
185
|
rubygems_version: 1.3.7
|
185
186
|
signing_key:
|
186
187
|
specification_version: 3
|
187
|
-
summary: prologue-0.
|
188
|
+
summary: prologue-0.4.0
|
188
189
|
test_files: []
|
189
190
|
|