mologue 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +110 -0
- data/LICENSE +21 -0
- data/README.md +69 -0
- data/Rakefile +2 -0
- data/bin/mologue +4 -0
- data/features/new.feature +40 -0
- data/features/support/setup.rb +1 -0
- data/lib/mologue.rb +7 -0
- data/lib/mologue/cli.rb +52 -0
- data/lib/mologue/version.rb +3 -0
- data/mologue.gemspec +27 -0
- data/templates/admin.rb +24 -0
- data/templates/admin/cucumber.rb +70 -0
- data/templates/admin/dashboard_spec.rb +23 -0
- data/templates/admin/layout.rb +76 -0
- data/templates/admin/sass.rb +80 -0
- data/templates/admin/users.rb +137 -0
- data/templates/admin/users_spec.rb +31 -0
- data/templates/application_layout.rb +71 -0
- data/templates/bootstrap.rb +117 -0
- data/templates/cancan.rb +112 -0
- data/templates/clean_routes.rb +8 -0
- data/templates/db.rb +2 -0
- data/templates/db_seed.rb +5 -0
- data/templates/devise.rb +215 -0
- data/templates/devise/cucumber.rb +111 -0
- data/templates/dynamic_form.rb +1 -0
- data/templates/friendly_id.rb +1 -0
- data/templates/gemfile.rb +46 -0
- data/templates/haml_generator.rb +7 -0
- data/templates/home_controller.rb +10 -0
- data/templates/initializers.rb +27 -0
- data/templates/jammit.rb +17 -0
- data/templates/js.rb +60 -0
- data/templates/mongoid.rb +46 -0
- data/templates/rails_clean.rb +7 -0
- data/templates/rspec_clean.rb +3 -0
- data/templates/rvm.rb +11 -0
- data/templates/sass.rb +152 -0
- data/templates/terminitor.rb +12 -0
- data/templates/test_suite.rb +92 -0
- metadata +192 -0
@@ -0,0 +1 @@
|
|
1
|
+
run 'rails plugin install git://github.com/rails/dynamic_form.git'
|
@@ -0,0 +1 @@
|
|
1
|
+
run 'rails generate friendly_id'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
run 'rm Gemfile'
|
2
|
+
create_file 'Gemfile', "source 'http://rubygems.org'\n"
|
3
|
+
gem "rails", "~> 3.0.0"
|
4
|
+
gem "dynamic_form", "~> 1.1.3"
|
5
|
+
if ENV['MOLOGUE_MONGOID']
|
6
|
+
gem "mongoid", "2.0.0.beta.20"
|
7
|
+
gem 'bson_ext', '1.1.2'
|
8
|
+
gem 'mongoid-rspec', :require => false, :group => [:test, :development]
|
9
|
+
else
|
10
|
+
gem "sqlite3-ruby", :require => "sqlite3"
|
11
|
+
gem "friendly_id", "~> 3.1"
|
12
|
+
end
|
13
|
+
if ENV['MOLOGUE_AUTH']
|
14
|
+
gem 'devise', "~> 1.1.3"
|
15
|
+
end
|
16
|
+
gem "hoptoad_notifier"
|
17
|
+
gem "jammit"
|
18
|
+
gem "will_paginate", "~> 3.0.pre2"
|
19
|
+
gem "haml", "~> 3.0.21"
|
20
|
+
gem "haml-rails"
|
21
|
+
gem "rails3-generators", :group => :development
|
22
|
+
gem "hpricot", :group => :development
|
23
|
+
gem "ruby_parser", :group => :development
|
24
|
+
gem "rspec-rails", "~> 2.0.0", :group => [:test, :development]
|
25
|
+
gem "mocha", :group => [:test]
|
26
|
+
gem "factory_girl_rails", :group => [:test, :cucumber]
|
27
|
+
gem "faker", :group => [:test]
|
28
|
+
gem "autotest", :group => [:test]
|
29
|
+
gem "autotest-rails", :group => [:test]
|
30
|
+
gem "thin", :group => [:test, :cucumber, :development]
|
31
|
+
gem "cucumber", :group => [:cucumber]
|
32
|
+
gem "database_cleaner", :group => [:test, :cucumber]
|
33
|
+
gem "cucumber-rails", :group => [:cucumber]
|
34
|
+
gem "capybara", "~> 0.4.0", :group => [:cucumber]
|
35
|
+
gem "launchy", :group => [:cucumber]
|
36
|
+
gem "timecop", :group => [:test, :cucumber]
|
37
|
+
gem "pickle", :group => [:test, :cucumber]
|
38
|
+
gem 'heroku', '1.13.7', :group => :development
|
39
|
+
|
40
|
+
# for windows users
|
41
|
+
if ( (Config::CONFIG['host_os'] =~ /mswin|mingw/) && (Config::CONFIG["ruby_version"] =~ /1.8/) )
|
42
|
+
gem "win32console", :group => [:test, :cucumber]
|
43
|
+
gem "windows-pr", :group => [:test, :cucumber]
|
44
|
+
gem "win32-open3"
|
45
|
+
end
|
46
|
+
run 'bundle install'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
unless ENV['MOLOGUE_MONGOID']
|
2
|
+
|
3
|
+
initializer('accessible_attributes.rb') do
|
4
|
+
<<-FILE
|
5
|
+
class ActiveRecord::Base
|
6
|
+
attr_accessible
|
7
|
+
attr_accessor :accessible
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def mass_assignment_authorizer
|
12
|
+
if accessible == :all
|
13
|
+
self.class.protected_attributes
|
14
|
+
else
|
15
|
+
super + (accessible || [])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
FILE
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
initializer('haml.rb') do
|
24
|
+
<<-'FILE'
|
25
|
+
Haml::Template.options[:format] = :html5
|
26
|
+
FILE
|
27
|
+
end
|
data/templates/jammit.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
create_file 'config/assets.yml' do
|
2
|
+
<<-FILE
|
3
|
+
embed_assets: on
|
4
|
+
|
5
|
+
javascripts:
|
6
|
+
common:
|
7
|
+
- public/javascripts/jquery.js
|
8
|
+
- public/javascripts/rails.js
|
9
|
+
- public/javascripts/core.js
|
10
|
+
|
11
|
+
stylesheets:
|
12
|
+
main:
|
13
|
+
- public/stylesheets/main.css
|
14
|
+
admin:
|
15
|
+
- public/stylesheets/admin.css
|
16
|
+
FILE
|
17
|
+
end
|
data/templates/js.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js", "public/javascripts/jquery.js"
|
3
|
+
get_remote_https_file "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
|
4
|
+
get "http://html5shiv.googlecode.com/svn/trunk/html5.js", "public/javascripts/shiv.js"
|
5
|
+
run 'rm public/javascripts/application.js'
|
6
|
+
|
7
|
+
create_file 'public/javascripts/core.js' do
|
8
|
+
<<-FILE
|
9
|
+
(function($){
|
10
|
+
var QL = QL || {};
|
11
|
+
|
12
|
+
QL = {
|
13
|
+
init: function QL_init(){
|
14
|
+
// some code that needs to be executed after doc ready
|
15
|
+
QL.bindEvents();
|
16
|
+
},
|
17
|
+
bindEvents: function QL_liveEvents(){
|
18
|
+
$('a[rel*=external]').live('click',function(){
|
19
|
+
window.open(this.href);
|
20
|
+
return false;
|
21
|
+
});
|
22
|
+
|
23
|
+
// more globally bound events
|
24
|
+
},
|
25
|
+
helpers: function QL_helpers(){
|
26
|
+
// helper for searching through arrays
|
27
|
+
QL.helpers.arraySearch = function(a){
|
28
|
+
var o = {};
|
29
|
+
for(var i=0;i<a.length;i++){
|
30
|
+
o[a[i]]='';
|
31
|
+
}
|
32
|
+
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
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
window.QL = QL;
|
55
|
+
$(document).ready(QL.init);
|
56
|
+
|
57
|
+
})(jQuery);
|
58
|
+
FILE
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#----------------------------------------------------------------------------
|
2
|
+
# Set up Mongoid
|
3
|
+
#----------------------------------------------------------------------------
|
4
|
+
puts "setting up Gemfile for Mongoid..."
|
5
|
+
|
6
|
+
puts "installing Mongoid gems (takes a few minutes!)..."
|
7
|
+
run 'bundle install'
|
8
|
+
|
9
|
+
puts "creating 'config/mongoid.yml' Mongoid configuration file..."
|
10
|
+
run 'rails generate mongoid:config'
|
11
|
+
|
12
|
+
puts "modifying 'config/application.rb' file for Mongoid..."
|
13
|
+
gsub_file 'config/application.rb', /require 'rails\/all'/ do
|
14
|
+
<<-RUBY
|
15
|
+
# If you are deploying to Heroku and MongoHQ,
|
16
|
+
# you supply connection information here.
|
17
|
+
require 'uri'
|
18
|
+
if ENV['MONGOHQ_URL']
|
19
|
+
mongo_uri = URI.parse(ENV['MONGOHQ_URL'])
|
20
|
+
ENV['MONGOID_HOST'] = mongo_uri.host
|
21
|
+
ENV['MONGOID_PORT'] = mongo_uri.port.to_s
|
22
|
+
ENV['MONGOID_USERNAME'] = mongo_uri.user
|
23
|
+
ENV['MONGOID_PASSWORD'] = mongo_uri.password
|
24
|
+
ENV['MONGOID_DATABASE'] = mongo_uri.path.gsub('/', '')
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'mongoid/railtie'
|
28
|
+
require 'action_controller/railtie'
|
29
|
+
require 'action_mailer/railtie'
|
30
|
+
require 'active_resource/railtie'
|
31
|
+
require 'rails/test_unit/railtie'
|
32
|
+
RUBY
|
33
|
+
end
|
34
|
+
|
35
|
+
#----------------------------------------------------------------------------
|
36
|
+
# Tweak config/application.rb for Mongoid
|
37
|
+
#----------------------------------------------------------------------------
|
38
|
+
gsub_file 'config/application.rb', /# Configure the default encoding used in templates for Ruby 1.9./ do
|
39
|
+
<<-RUBY
|
40
|
+
config.generators do |g|
|
41
|
+
g.orm :mongoid
|
42
|
+
end
|
43
|
+
|
44
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
45
|
+
RUBY
|
46
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
run 'rm public/index.html'
|
2
|
+
run 'rm public/images/rails.png'
|
3
|
+
run 'rm README'
|
4
|
+
run 'touch README'
|
5
|
+
run 'rm public/favicon.ico'
|
6
|
+
get "http://www.quickleft.com/favicon.ico", "public/images/favicon.ico"
|
7
|
+
# get "http://www.quickleft.com/ati.png", "public/images/ati.png"
|
data/templates/rvm.rb
ADDED
data/templates/sass.rb
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
run 'mkdir public/stylesheets/sass'
|
2
|
+
|
3
|
+
create_file 'public/stylesheets/sass/main.scss' do
|
4
|
+
<<-FILE
|
5
|
+
@import "reset";
|
6
|
+
@import "common";
|
7
|
+
@mixin layout_base {
|
8
|
+
@include reset;
|
9
|
+
@include container;
|
10
|
+
@include user_nav;
|
11
|
+
@include main_nav;
|
12
|
+
//uncomment for a handy layout guide
|
13
|
+
@include layout_guide;
|
14
|
+
}
|
15
|
+
|
16
|
+
@mixin container($container_size: 950px) {
|
17
|
+
#container {
|
18
|
+
width: $container_size;
|
19
|
+
clear:both;
|
20
|
+
padding: 0 20px;
|
21
|
+
min-height: 100%;
|
22
|
+
height: auto !important;
|
23
|
+
height: 100%;
|
24
|
+
margin: 0 auto -80px;
|
25
|
+
}
|
26
|
+
#main_header {
|
27
|
+
width: $container_size;
|
28
|
+
height: 60px;
|
29
|
+
@include clear_left;
|
30
|
+
h1 {
|
31
|
+
float: left;
|
32
|
+
padding: 20px 0 0 0;
|
33
|
+
font-size: 24px;
|
34
|
+
font-weight: bold;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
#content {
|
38
|
+
width: $container_size;
|
39
|
+
@include clear_left;
|
40
|
+
padding: 10px 0 20px 0;
|
41
|
+
}
|
42
|
+
#main_footer, #pusher {
|
43
|
+
height: 80px;
|
44
|
+
clear:both;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
@mixin user_nav {
|
49
|
+
#user_nav {
|
50
|
+
float: right;
|
51
|
+
padding: 20px 0 0 0;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
@mixin main_nav {
|
56
|
+
#main_nav {
|
57
|
+
width: 950px;
|
58
|
+
@include clear_left;
|
59
|
+
padding: 10px 0;
|
60
|
+
ul {
|
61
|
+
@include clear_left;
|
62
|
+
li {
|
63
|
+
float: left;
|
64
|
+
padding: 0 15px 0 0;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
@mixin layout_guide {
|
71
|
+
#container { background-color: #e8e6e6; }
|
72
|
+
#main_header { background-color: #f7dddd; }
|
73
|
+
#main_nav { background-color: #f4ddf7; }
|
74
|
+
#content { background-color: #f2f7dd; }
|
75
|
+
#main_footer .inner { background-color: #ddf7e7; }
|
76
|
+
}
|
77
|
+
|
78
|
+
@include layout_base;
|
79
|
+
FILE
|
80
|
+
end
|
81
|
+
|
82
|
+
create_file 'public/stylesheets/sass/reset.scss' do
|
83
|
+
<<-FILE
|
84
|
+
@mixin reset {
|
85
|
+
/*
|
86
|
+
html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
|
87
|
+
v1.4 2009-07-27 | Authors: Eric Meyer & Richard Clark
|
88
|
+
html5doctor.com/html-5-reset-stylesheet/
|
89
|
+
*/
|
90
|
+
|
91
|
+
html, body, div, span, object, iframe,
|
92
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
93
|
+
abbr, address, cite, code,
|
94
|
+
del, dfn, em, img, ins, kbd, q, samp,
|
95
|
+
small, strong, sub, sup, var,
|
96
|
+
b, i,
|
97
|
+
dl, dt, dd, ol, ul, li,
|
98
|
+
fieldset, form, label, legend,
|
99
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
100
|
+
article, aside, canvas, details, figcaption, figure,
|
101
|
+
footer, header, hgroup, menu, nav, section, summary,
|
102
|
+
time, mark, audio, video {
|
103
|
+
margin:0;
|
104
|
+
padding:0;
|
105
|
+
border:0;
|
106
|
+
outline:0;
|
107
|
+
font-size:100%;
|
108
|
+
vertical-align:baseline;
|
109
|
+
background:transparent;
|
110
|
+
}
|
111
|
+
|
112
|
+
article, aside, details, figcaption, figure,
|
113
|
+
footer, header, hgroup, menu, nav, section {
|
114
|
+
display:block;
|
115
|
+
}
|
116
|
+
|
117
|
+
nav ul { list-style:none; }
|
118
|
+
|
119
|
+
blockquote, q { quotes:none; }
|
120
|
+
|
121
|
+
blockquote:before, blockquote:after,
|
122
|
+
q:before, q:after { content:''; content:none; }
|
123
|
+
|
124
|
+
a { margin:0; padding:0; font-size:100%; vertical-align:baseline; background:transparent; }
|
125
|
+
|
126
|
+
ins { background-color:#ff9; color:#000; text-decoration:none; }
|
127
|
+
|
128
|
+
mark { background-color:#ff9; color:#000; font-style:italic; font-weight:bold; }
|
129
|
+
|
130
|
+
del { text-decoration: line-through; }
|
131
|
+
|
132
|
+
abbr[title], dfn[title] { border-bottom:1px dotted; cursor:help; }
|
133
|
+
|
134
|
+
/* tables still need cellspacing="0" in the markup */
|
135
|
+
table { border-collapse:collapse; border-spacing:0; }
|
136
|
+
|
137
|
+
hr { display:block; height:1px; border:0; border-top:1px solid #ccc; margin:1em 0; padding:0; }
|
138
|
+
|
139
|
+
input, select { vertical-align:middle; }
|
140
|
+
}
|
141
|
+
FILE
|
142
|
+
end
|
143
|
+
|
144
|
+
create_file 'public/stylesheets/sass/common.scss' do
|
145
|
+
<<-FILE
|
146
|
+
@mixin clear_left {
|
147
|
+
float: left; clear: both;
|
148
|
+
}
|
149
|
+
FILE
|
150
|
+
end
|
151
|
+
|
152
|
+
run 'sass public/stylesheets/sass/main.scss public/stylesheets/main.css'
|
@@ -0,0 +1,92 @@
|
|
1
|
+
run 'rails generate rspec:install'
|
2
|
+
|
3
|
+
if ENV['MOLOGUE_MONGOID']
|
4
|
+
gsub_file 'spec/spec_helper.rb', /config\.fixture_path/, '# config.fixture_path'
|
5
|
+
gsub_file 'spec/spec_helper.rb', /config\.use_transactional_fixtures/, '# config.use_transactional_fixtures'
|
6
|
+
gsub_file 'spec/spec_helper.rb', /end/ do
|
7
|
+
<<-RUBY
|
8
|
+
config.before :each do
|
9
|
+
Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
RUBY
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
cucumber_install = 'rails generate cucumber:install --capybara --rspec'
|
17
|
+
cucumber_install = "#{cucumber_install} --skip-database" if ENV['MOLOGUE_MONGOID']
|
18
|
+
run cucumber_install
|
19
|
+
|
20
|
+
if ENV['MOLOGUE_MONGOID']
|
21
|
+
append_file 'features/support/env.rb' do
|
22
|
+
<<-RUBY
|
23
|
+
|
24
|
+
# Clean MongoDB between tests
|
25
|
+
require 'database_cleaner'
|
26
|
+
DatabaseCleaner.strategy = :truncation
|
27
|
+
Before do
|
28
|
+
DatabaseCleaner.clean
|
29
|
+
end
|
30
|
+
|
31
|
+
RUBY
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
run 'rails generate pickle --email'
|
36
|
+
|
37
|
+
test_framework = "g.test_framework :rspec"
|
38
|
+
test_framework = "#{test_framework}, :fixture => false" if ENV['MOLOGUE_MONGOID']
|
39
|
+
inject_into_file 'config/application.rb', :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do
|
40
|
+
<<-RUBY
|
41
|
+
config.generators do |g|
|
42
|
+
#{test_framework}
|
43
|
+
end
|
44
|
+
RUBY
|
45
|
+
end
|
46
|
+
|
47
|
+
inject_into_file 'features/support/env.rb', :after => "ENV[\"RAILS_ENV\"] ||= \"test\"\n" do
|
48
|
+
<<-RUBY
|
49
|
+
$VERBOSE = nil
|
50
|
+
RUBY
|
51
|
+
end
|
52
|
+
|
53
|
+
gsub_file 'features/support/env.rb',/require 'cucumber\/rails\/capybara_javascript_emulation'/,'#require \'cucumber/rails/capybara_javascript_emulation\''
|
54
|
+
|
55
|
+
run 'mkdir spec/factories'
|
56
|
+
|
57
|
+
create_file 'features/step_definitions/web_steps_extended.rb' do
|
58
|
+
<<-'FILE'
|
59
|
+
When /^I confirm a js popup on the next step$/ do
|
60
|
+
page.evaluate_script("window.alert = function(msg) { return true; }")
|
61
|
+
page.evaluate_script("window.confirm = function(msg) { return true; }")
|
62
|
+
end
|
63
|
+
|
64
|
+
When /^I perform the following actions:$/ do |table|
|
65
|
+
table.hashes.each do |row|
|
66
|
+
case row['Action']
|
67
|
+
when 'Fill in'
|
68
|
+
Given "I fill in \"#{row['Field']}\" with \"#{row['Value']}\""
|
69
|
+
when 'Check'
|
70
|
+
if row['Value'] =~ /true/
|
71
|
+
Given "I check \"#{row['Field']}\""
|
72
|
+
else
|
73
|
+
Given "I uncheck \"#{row['Field']}\""
|
74
|
+
end
|
75
|
+
when 'Choose'
|
76
|
+
Given "I choose \"#{row['Field']}\""
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
FILE
|
81
|
+
end
|
82
|
+
|
83
|
+
create_file 'features/step_definitions/factory_steps.rb' do
|
84
|
+
<<-'FILE'
|
85
|
+
Given /^the following (.+) records?$/ do |factory, table|
|
86
|
+
table.hashes.each do |hash|
|
87
|
+
hash.each{|k,v| hash[k] = nil if v == "nil" } # FIXME: hack to make resend_email_verification.feature work
|
88
|
+
Factory(factory, hash)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
FILE
|
92
|
+
end
|