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
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mologue (0.3.10)
|
5
|
+
rails (~> 3.0.0)
|
6
|
+
thor
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
abstract (1.0.0)
|
12
|
+
actionmailer (3.0.1)
|
13
|
+
actionpack (= 3.0.1)
|
14
|
+
mail (~> 2.2.5)
|
15
|
+
actionpack (3.0.1)
|
16
|
+
activemodel (= 3.0.1)
|
17
|
+
activesupport (= 3.0.1)
|
18
|
+
builder (~> 2.1.2)
|
19
|
+
erubis (~> 2.6.6)
|
20
|
+
i18n (~> 0.4.1)
|
21
|
+
rack (~> 1.2.1)
|
22
|
+
rack-mount (~> 0.6.12)
|
23
|
+
rack-test (~> 0.5.4)
|
24
|
+
tzinfo (~> 0.3.23)
|
25
|
+
activemodel (3.0.1)
|
26
|
+
activesupport (= 3.0.1)
|
27
|
+
builder (~> 2.1.2)
|
28
|
+
i18n (~> 0.4.1)
|
29
|
+
activerecord (3.0.1)
|
30
|
+
activemodel (= 3.0.1)
|
31
|
+
activesupport (= 3.0.1)
|
32
|
+
arel (~> 1.0.0)
|
33
|
+
tzinfo (~> 0.3.23)
|
34
|
+
activeresource (3.0.1)
|
35
|
+
activemodel (= 3.0.1)
|
36
|
+
activesupport (= 3.0.1)
|
37
|
+
activesupport (3.0.1)
|
38
|
+
arel (1.0.1)
|
39
|
+
activesupport (~> 3.0.0)
|
40
|
+
aruba (0.2.3)
|
41
|
+
background_process
|
42
|
+
cucumber (~> 0.9.0)
|
43
|
+
background_process (1.2)
|
44
|
+
builder (2.1.2)
|
45
|
+
cucumber (0.9.3)
|
46
|
+
builder (~> 2.1.2)
|
47
|
+
diff-lcs (~> 1.1.2)
|
48
|
+
gherkin (~> 2.2.9)
|
49
|
+
json (~> 1.4.6)
|
50
|
+
term-ansicolor (~> 1.0.5)
|
51
|
+
diff-lcs (1.1.2)
|
52
|
+
erubis (2.6.6)
|
53
|
+
abstract (>= 1.0.0)
|
54
|
+
gherkin (2.2.9)
|
55
|
+
json (~> 1.4.6)
|
56
|
+
term-ansicolor (~> 1.0.5)
|
57
|
+
i18n (0.4.1)
|
58
|
+
json (1.4.6)
|
59
|
+
mail (2.2.7)
|
60
|
+
activesupport (>= 2.3.6)
|
61
|
+
mime-types
|
62
|
+
treetop (>= 1.4.5)
|
63
|
+
mime-types (1.16)
|
64
|
+
polyglot (0.3.1)
|
65
|
+
rack (1.2.1)
|
66
|
+
rack-mount (0.6.13)
|
67
|
+
rack (>= 1.0.0)
|
68
|
+
rack-test (0.5.6)
|
69
|
+
rack (>= 1.0)
|
70
|
+
rails (3.0.1)
|
71
|
+
actionmailer (= 3.0.1)
|
72
|
+
actionpack (= 3.0.1)
|
73
|
+
activerecord (= 3.0.1)
|
74
|
+
activeresource (= 3.0.1)
|
75
|
+
activesupport (= 3.0.1)
|
76
|
+
bundler (~> 1.0.0)
|
77
|
+
railties (= 3.0.1)
|
78
|
+
railties (3.0.1)
|
79
|
+
actionpack (= 3.0.1)
|
80
|
+
activesupport (= 3.0.1)
|
81
|
+
rake (>= 0.8.4)
|
82
|
+
thor (~> 0.14.0)
|
83
|
+
rake (0.8.7)
|
84
|
+
rspec (2.0.1)
|
85
|
+
rspec-core (~> 2.0.1)
|
86
|
+
rspec-expectations (~> 2.0.1)
|
87
|
+
rspec-mocks (~> 2.0.1)
|
88
|
+
rspec-core (2.0.1)
|
89
|
+
rspec-expectations (2.0.1)
|
90
|
+
diff-lcs (>= 1.1.2)
|
91
|
+
rspec-mocks (2.0.1)
|
92
|
+
rspec-core (~> 2.0.1)
|
93
|
+
rspec-expectations (~> 2.0.1)
|
94
|
+
term-ansicolor (1.0.5)
|
95
|
+
thor (0.14.3)
|
96
|
+
treetop (1.4.8)
|
97
|
+
polyglot (>= 0.3.1)
|
98
|
+
tzinfo (0.3.23)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
ruby
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
aruba
|
105
|
+
bundler (~> 1.0.0)
|
106
|
+
cucumber
|
107
|
+
mologue!
|
108
|
+
rails (~> 3.0.0)
|
109
|
+
rspec (~> 2.0.0)
|
110
|
+
thor
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010 Quick Left
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
Mologue
|
2
|
+
===========
|
3
|
+
Generate a Rails 3 app with all the right stuff.
|
4
|
+
|
5
|
+
|
6
|
+
### What you get
|
7
|
+
|
8
|
+
Mologue provides a base Rails 3 application with Devise for authentication. You also get a basic admin to manage
|
9
|
+
users. Mologue also rolls in all of the things we like to have setup in our apps like...
|
10
|
+
haml, sass, jquery, cucumber, capybara, mocha, factory_girl, rspec, timecop, autotest, will_paginate, friendly_id, and hoptoad_notifier
|
11
|
+
|
12
|
+
Everything is configured and ready to rock your next Rails 3 project. We hope it saves you a mess of time!
|
13
|
+
|
14
|
+
|
15
|
+
### Quick Start
|
16
|
+
|
17
|
+
gem install mologue
|
18
|
+
|
19
|
+
mologue new my_app
|
20
|
+
|
21
|
+
|
22
|
+
### Options
|
23
|
+
|
24
|
+
mologue new my_app --no-auth
|
25
|
+
|
26
|
+
mologue new my_app --no-admin
|
27
|
+
|
28
|
+
|
29
|
+
### Testing generated app
|
30
|
+
|
31
|
+
rake spec
|
32
|
+
rake cucumber
|
33
|
+
bundle exec autotest
|
34
|
+
|
35
|
+
|
36
|
+
### Issues
|
37
|
+
|
38
|
+
Please report issues to the [Mologue issue tracker](http://github.com/quickleft/mologue/issues/).
|
39
|
+
|
40
|
+
|
41
|
+
### Development
|
42
|
+
|
43
|
+
bundle install
|
44
|
+
bundle exec cucumber
|
45
|
+
|
46
|
+
Running `bundle exec cucumber` will take some time. It runs the CLI tool with different option combinations and tests
|
47
|
+
those outputs with aruba.
|
48
|
+
|
49
|
+
|
50
|
+
### Patches/Pull Requests
|
51
|
+
|
52
|
+
* Fork it.
|
53
|
+
* Add tests for it.
|
54
|
+
* Make your changes.
|
55
|
+
* Commit.
|
56
|
+
* Send a pull request.
|
57
|
+
|
58
|
+
|
59
|
+
### Thanks
|
60
|
+
|
61
|
+
All of the contributors to the many awesome open source projects that make up mologue and allow us to do our job everyday.
|
62
|
+
Also, thanks go out to the crew at thoughtbot for writing suspenders. It's what gave us the idea to package up our
|
63
|
+
templates into a gem in the first place.
|
64
|
+
|
65
|
+
|
66
|
+
### Copyright
|
67
|
+
|
68
|
+
Copyright (c) 2010 Quick Left. See LICENSE for details.
|
69
|
+
|
data/Rakefile
ADDED
data/bin/mologue
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
@disable-bundler
|
2
|
+
Feature: Generate new mologue app
|
3
|
+
In order to start a new project with mologue
|
4
|
+
As a CLI
|
5
|
+
I want to generate a rails3 app with mologue
|
6
|
+
|
7
|
+
Scenario: Run mologue new my_app
|
8
|
+
When I run "mologue new my_app"
|
9
|
+
Then the output should contain "Building authentication"
|
10
|
+
And the output should contain "Building roles"
|
11
|
+
And the output should contain "Building admin"
|
12
|
+
And the output should contain "Mologue just added like 6 hours to your life."
|
13
|
+
|
14
|
+
Scenario: Run mologue new my_app --no-auth
|
15
|
+
When I run "mologue new my_app --no-auth"
|
16
|
+
Then the output should not contain "Building authentication"
|
17
|
+
And the output should not contain "Building roles"
|
18
|
+
And the output should not contain "Building admin"
|
19
|
+
And the output should contain "Mologue just added like 6 hours to your life."
|
20
|
+
|
21
|
+
Scenario: Run mologue new my_app --no-roles
|
22
|
+
When I run "mologue new my_app --no-roles"
|
23
|
+
Then the output should contain "Building authentication"
|
24
|
+
And the output should not contain "Building roles"
|
25
|
+
And the output should contain "Building admin"
|
26
|
+
And the output should contain "Mologue just added like 6 hours to your life."
|
27
|
+
|
28
|
+
Scenario: Run mologue new my_app --no-admin
|
29
|
+
When I run "mologue new my_app --no-admin"
|
30
|
+
Then the output should contain "Building authentication"
|
31
|
+
And the output should contain "Building roles"
|
32
|
+
And the output should not contain "Building admin"
|
33
|
+
And the output should contain "Mologue just added like 6 hours to your life."
|
34
|
+
|
35
|
+
Scenario: Run mologue new my_app --no-admin --no-roles
|
36
|
+
When I run "mologue new my_app --no-admin --no-roles"
|
37
|
+
Then the output should contain "Building authentication"
|
38
|
+
And the output should not contain "Building roles"
|
39
|
+
And the output should not contain "Building admin"
|
40
|
+
And the output should contain "Mologue just added like 6 hours to your life."
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'aruba'
|
data/lib/mologue.rb
ADDED
data/lib/mologue/cli.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'thor/actions'
|
3
|
+
require 'active_support/secure_random'
|
4
|
+
|
5
|
+
module Mologue
|
6
|
+
class CLI < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
desc "new [app]", "Create a new Rails 3 application"
|
10
|
+
long_desc <<-D
|
11
|
+
Mologue will ask you a few questions to determine what features you
|
12
|
+
would like to generate. Based on your answers it will setup a new Rails 3 application.
|
13
|
+
D
|
14
|
+
method_option :mongoid, :type => :boolean, :default => true, :banner =>
|
15
|
+
"Sets up mongoid as the ORM (with MongoDB)."
|
16
|
+
method_option :auth, :type => :boolean, :default => true, :banner =>
|
17
|
+
"Sets up devise for authentication."
|
18
|
+
method_option :admin, :type => :boolean, :default => true, :banner =>
|
19
|
+
"Sets up very basic admin"
|
20
|
+
def new(project)
|
21
|
+
opts = options.dup
|
22
|
+
|
23
|
+
# Can't build an admin without devise
|
24
|
+
if !opts[:auth]
|
25
|
+
opts[:admin] = false;
|
26
|
+
end
|
27
|
+
|
28
|
+
# Env vars used in our template
|
29
|
+
ENV['MOLOGUE_MONGOID'] = "true" if opts[:mongoid]
|
30
|
+
ENV['MOLOGUE_AUTH'] = "true" if opts[:auth]
|
31
|
+
ENV['MOLOGUE_ADMIN'] = "true" if opts[:admin]
|
32
|
+
|
33
|
+
command = "rails new #{project} --template=#{template} --skip-test-unit --skip-prototype"
|
34
|
+
command = "#{command} --skip-active-record" if ENV['MOLOGUE_MONGOID']
|
35
|
+
puts "Creating new Rails 3 project with: #{command}"
|
36
|
+
exec(command)
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "version", "Prints Mologue's version information"
|
40
|
+
def version
|
41
|
+
say "Mologue version #{Mologue::VERSION}"
|
42
|
+
end
|
43
|
+
map %w(-v --version) => :version
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def template
|
48
|
+
File.expand_path(File.dirname(__FILE__) + "/../../templates/bootstrap.rb")
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
data/mologue.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path("../lib/mologue/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "mologue"
|
6
|
+
s.version = Mologue::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Mark Dillon"]
|
9
|
+
s.email = ["mark@markdillon.ca"]
|
10
|
+
s.homepage = "http://github.com/markdillon/mologue"
|
11
|
+
s.summary = "mologue-#{s.version}"
|
12
|
+
s.description = "Generate a Rails 3 starter app with all the right stuff."
|
13
|
+
|
14
|
+
s.required_rubygems_version = "~> 1.3.6"
|
15
|
+
s.rubyforge_project = "mologue"
|
16
|
+
|
17
|
+
s.add_dependency "thor"
|
18
|
+
s.add_dependency('rails', '~> 3.0.0')
|
19
|
+
s.add_development_dependency "bundler", "~> 1.0.0"
|
20
|
+
s.add_development_dependency "cucumber"
|
21
|
+
s.add_development_dependency "aruba"
|
22
|
+
s.add_development_dependency "rspec", "~> 2.0.0"
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
26
|
+
s.require_path = 'lib'
|
27
|
+
end
|
data/templates/admin.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
say "Building admin"
|
2
|
+
generate(:controller, "admin/dashboard index")
|
3
|
+
route("match 'admin' => 'admin/dashboard#index'")
|
4
|
+
|
5
|
+
# Do layout and SASS stuff
|
6
|
+
apply File.expand_path("../admin/sass.rb", __FILE__)
|
7
|
+
apply File.expand_path("../admin/layout.rb", __FILE__)
|
8
|
+
|
9
|
+
create_file 'app/controllers/admin/base_controller.rb' do
|
10
|
+
<<-RUBY
|
11
|
+
class Admin::BaseController < ApplicationController
|
12
|
+
layout 'admin'
|
13
|
+
before_filter :authenticate_user!
|
14
|
+
end
|
15
|
+
RUBY
|
16
|
+
end
|
17
|
+
|
18
|
+
gsub_file 'app/controllers/admin/dashboard_controller.rb', /ApplicationController/, 'Admin::BaseController'
|
19
|
+
|
20
|
+
# make a user admin
|
21
|
+
apply File.expand_path("../admin/users.rb", __FILE__)
|
22
|
+
apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
|
23
|
+
apply File.expand_path("../admin/users_spec.rb", __FILE__)
|
24
|
+
apply File.expand_path("../admin/cucumber.rb", __FILE__)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
inject_into_file 'features/support/paths.rb', :after => "case page_name\n" do
|
2
|
+
<<-'FILE'
|
3
|
+
|
4
|
+
when /the admin/
|
5
|
+
'/admin'
|
6
|
+
|
7
|
+
when /the add user page/
|
8
|
+
'/admin/users/new'
|
9
|
+
FILE
|
10
|
+
end
|
11
|
+
|
12
|
+
create_file 'features/admin.feature' do
|
13
|
+
<<-'FILE'
|
14
|
+
Feature: Admin dashboard
|
15
|
+
As an administrator
|
16
|
+
I want to manage the application
|
17
|
+
So that I can have full control over the site
|
18
|
+
|
19
|
+
Scenario: Login as an admin
|
20
|
+
Given a logged in admin
|
21
|
+
When I am on the admin
|
22
|
+
Then I should see "Admin"
|
23
|
+
FILE
|
24
|
+
end
|
25
|
+
|
26
|
+
create_file 'features/user_admin.feature' do
|
27
|
+
<<-'FILE'
|
28
|
+
Feature: Administer users
|
29
|
+
As an administrator
|
30
|
+
I want to manage the users
|
31
|
+
So that I can provide support for them
|
32
|
+
|
33
|
+
Background:
|
34
|
+
Given a logged in admin
|
35
|
+
|
36
|
+
Scenario: Create, update, delete a user in the admin
|
37
|
+
When I am on the add user page
|
38
|
+
And I fill in the following:
|
39
|
+
| Email | big@sirluciousleftfoot.com |
|
40
|
+
| Username | bigboi |
|
41
|
+
| Password | Ch!coDusty$ |
|
42
|
+
| Password confirmation | Ch!coDusty$ |
|
43
|
+
And I press "Save"
|
44
|
+
Then I should see "User created!"
|
45
|
+
And I should see "bigboi"
|
46
|
+
|
47
|
+
When I follow "bigboi"
|
48
|
+
Then the "Username" field should contain "bigboi"
|
49
|
+
And the "Email" field should contain "big@sirluciousleftfoot.com"
|
50
|
+
And the "Admin" checkbox should not be checked
|
51
|
+
|
52
|
+
Then I fill in "Username" with "biggerboi"
|
53
|
+
And I fill in "Email" with "bigger@sirluciousleftfoot.com"
|
54
|
+
And I check "Admin"
|
55
|
+
And I press "Save"
|
56
|
+
Then I should see "Successfully updated biggerboi."
|
57
|
+
|
58
|
+
When I follow "biggerboi"
|
59
|
+
Then the "Username" field should contain "biggerboi"
|
60
|
+
And the "Email" field should contain "bigger@sirluciousleftfoot.com"
|
61
|
+
And the "Admin" checkbox should be checked
|
62
|
+
Then I press "Save"
|
63
|
+
|
64
|
+
Then I follow "Delete"
|
65
|
+
Then I should see "User deleted."
|
66
|
+
And I should not see "biggerboi"
|
67
|
+
|
68
|
+
|
69
|
+
FILE
|
70
|
+
end
|