prologue 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +38 -37
  4. data/LICENSE +2 -2
  5. data/README.md +22 -8
  6. data/Rakefile +17 -0
  7. data/bin/prologue +17 -3
  8. data/features/support/env.rb +2 -0
  9. data/lib/prologue.rb +7 -3
  10. data/lib/prologue/cli.rb +14 -40
  11. data/lib/prologue/errors.rb +11 -0
  12. data/lib/prologue/template_runner.rb +30 -0
  13. data/lib/prologue/version.rb +1 -1
  14. data/prologue.gemspec +12 -8
  15. data/spec/prologue_cli_spec.rb +13 -0
  16. data/spec/prologue_template_runner_spec.rb +27 -0
  17. data/spec/spec_helper.rb +3 -0
  18. data/templates/async/async.rb +18 -0
  19. data/templates/async/bootstrap.rb +54 -0
  20. data/templates/async/lib/gemfile.rb +6 -0
  21. data/templates/async/lib/mysql2_db.rb +24 -0
  22. data/templates/async/lib/rack-fiber_pool.rb +15 -0
  23. data/templates/async/lib/test_suite.rb +8 -0
  24. data/templates/async/lib/thin.rb +3 -0
  25. data/templates/{bootstrap.rb → default/bootstrap.rb} +24 -22
  26. data/templates/default/default.rb +59 -0
  27. data/templates/{admin.rb → default/lib/admin.rb} +0 -0
  28. data/templates/{admin → default/lib/admin}/cucumber.rb +0 -0
  29. data/templates/{admin → default/lib/admin}/dashboard_spec.rb +0 -0
  30. data/templates/{admin → default/lib/admin}/layout.rb +0 -0
  31. data/templates/{admin → default/lib/admin}/sass.rb +0 -0
  32. data/templates/{admin → default/lib/admin}/users.rb +0 -0
  33. data/templates/{admin → default/lib/admin}/users_spec.rb +0 -0
  34. data/templates/{application_layout.rb → default/lib/application_layout.rb} +0 -0
  35. data/templates/{cancan.rb → default/lib/cancan.rb} +0 -0
  36. data/templates/{clean_routes.rb → default/lib/clean_routes.rb} +0 -0
  37. data/templates/{css.rb → default/lib/css.rb} +0 -0
  38. data/templates/{db.rb → default/lib/db.rb} +0 -0
  39. data/templates/{db_seed.rb → default/lib/db_seed.rb} +0 -0
  40. data/templates/{devise.rb → default/lib/devise.rb} +0 -0
  41. data/templates/{devise → default/lib/devise}/cucumber.rb +0 -0
  42. data/templates/{dynamic_form.rb → default/lib/dynamic_form.rb} +0 -0
  43. data/templates/{evergreen.rb → default/lib/evergreen.rb} +0 -0
  44. data/templates/{friendly_id.rb → default/lib/friendly_id.rb} +0 -0
  45. data/templates/{gemfile.rb → default/lib/gemfile.rb} +0 -0
  46. data/templates/{haml_generator.rb → default/lib/haml_generator.rb} +0 -0
  47. data/templates/{home_controller.rb → default/lib/home_controller.rb} +0 -0
  48. data/templates/{initializers.rb → default/lib/initializers.rb} +0 -0
  49. data/templates/{jammit.rb → default/lib/jammit.rb} +0 -0
  50. data/templates/{js.rb → default/lib/js.rb} +0 -0
  51. data/templates/{rails_clean.rb → default/lib/rails_clean.rb} +0 -0
  52. data/templates/{rspec_clean.rb → default/lib/rspec_clean.rb} +0 -0
  53. data/templates/{sass.rb → default/lib/sass.rb} +0 -0
  54. data/templates/{test_suite.rb → default/lib/test_suite.rb} +0 -0
  55. data/templates/{yard.rb → default/lib/yard.rb} +0 -0
  56. metadata +82 -93
  57. data/features/support/setup.rb +0 -1
File without changes
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ pkg/*
4
4
  tmp
5
5
  .idea
6
6
  .DS_Store
7
+ .rvmrc
@@ -1,40 +1,41 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prologue (0.5.5)
5
- rails (~> 3.0.0)
6
- thor
4
+ prologue (0.6.0)
5
+ activesupport (~> 3.0.7)
6
+ rails (~> 3.0.7)
7
+ thor (~> 0.14.6)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
12
  abstract (1.0.0)
12
- actionmailer (3.0.5)
13
- actionpack (= 3.0.5)
13
+ actionmailer (3.0.7)
14
+ actionpack (= 3.0.7)
14
15
  mail (~> 2.2.15)
15
- actionpack (3.0.5)
16
- activemodel (= 3.0.5)
17
- activesupport (= 3.0.5)
16
+ actionpack (3.0.7)
17
+ activemodel (= 3.0.7)
18
+ activesupport (= 3.0.7)
18
19
  builder (~> 2.1.2)
19
20
  erubis (~> 2.6.6)
20
- i18n (~> 0.4)
21
+ i18n (~> 0.5.0)
21
22
  rack (~> 1.2.1)
22
- rack-mount (~> 0.6.13)
23
+ rack-mount (~> 0.6.14)
23
24
  rack-test (~> 0.5.7)
24
25
  tzinfo (~> 0.3.23)
25
- activemodel (3.0.5)
26
- activesupport (= 3.0.5)
26
+ activemodel (3.0.7)
27
+ activesupport (= 3.0.7)
27
28
  builder (~> 2.1.2)
28
- i18n (~> 0.4)
29
- activerecord (3.0.5)
30
- activemodel (= 3.0.5)
31
- activesupport (= 3.0.5)
29
+ i18n (~> 0.5.0)
30
+ activerecord (3.0.7)
31
+ activemodel (= 3.0.7)
32
+ activesupport (= 3.0.7)
32
33
  arel (~> 2.0.2)
33
34
  tzinfo (~> 0.3.23)
34
- activeresource (3.0.5)
35
- activemodel (= 3.0.5)
36
- activesupport (= 3.0.5)
37
- activesupport (3.0.5)
35
+ activeresource (3.0.7)
36
+ activemodel (= 3.0.7)
37
+ activesupport (= 3.0.7)
38
+ activesupport (3.0.7)
38
39
  arel (2.0.9)
39
40
  aruba (0.2.3)
40
41
  background_process
@@ -55,29 +56,29 @@ GEM
55
56
  term-ansicolor (~> 1.0.5)
56
57
  i18n (0.5.0)
57
58
  json (1.4.6)
58
- mail (2.2.15)
59
+ mail (2.2.19)
59
60
  activesupport (>= 2.3.6)
60
61
  i18n (>= 0.4.0)
61
62
  mime-types (~> 1.16)
62
63
  treetop (~> 1.4.8)
63
64
  mime-types (1.16)
64
65
  polyglot (0.3.1)
65
- rack (1.2.1)
66
- rack-mount (0.6.13)
66
+ rack (1.2.2)
67
+ rack-mount (0.6.14)
67
68
  rack (>= 1.0.0)
68
69
  rack-test (0.5.7)
69
70
  rack (>= 1.0)
70
- rails (3.0.5)
71
- actionmailer (= 3.0.5)
72
- actionpack (= 3.0.5)
73
- activerecord (= 3.0.5)
74
- activeresource (= 3.0.5)
75
- activesupport (= 3.0.5)
71
+ rails (3.0.7)
72
+ actionmailer (= 3.0.7)
73
+ actionpack (= 3.0.7)
74
+ activerecord (= 3.0.7)
75
+ activeresource (= 3.0.7)
76
+ activesupport (= 3.0.7)
76
77
  bundler (~> 1.0)
77
- railties (= 3.0.5)
78
- railties (3.0.5)
79
- actionpack (= 3.0.5)
80
- activesupport (= 3.0.5)
78
+ railties (= 3.0.7)
79
+ railties (3.0.7)
80
+ actionpack (= 3.0.7)
81
+ activesupport (= 3.0.7)
81
82
  rake (>= 0.8.7)
82
83
  thor (~> 0.14.4)
83
84
  rake (0.8.7)
@@ -95,14 +96,14 @@ GEM
95
96
  thor (0.14.6)
96
97
  treetop (1.4.9)
97
98
  polyglot (>= 0.3.1)
98
- tzinfo (0.3.24)
99
+ tzinfo (0.3.27)
99
100
 
100
101
  PLATFORMS
101
102
  ruby
102
103
 
103
104
  DEPENDENCIES
104
- aruba
105
- bundler (~> 1.0.0)
106
- cucumber
105
+ aruba (~> 0.2.3)
106
+ bundler (~> 1.0.12)
107
+ cucumber (~> 0.9.3)
107
108
  prologue!
108
109
  rspec (~> 2.0.0)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2010 Quick Left
3
+ Copyright (c) 2010-2011 Quick Left
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -5,12 +5,26 @@ Generate a Rails 3 app with the application templates Quick Left uses to start t
5
5
 
6
6
  ### What you get
7
7
 
8
- Prologue provides a base Rails 3 application with Devise and Cancan for authentication and authorization. Roles are
9
- stored in the database with a HABTM relationship between the role and user models. You also get a basic admin to manage
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, evergreen, jasmine, will_paginate, friendly_id, and hoptoad_notifier
8
+ Prologue provides a set of templates to generate Rails 3 applications.
9
+ Everything is configured and ready to rock your next Rails 3 project.
10
+ We hope it saves you a mess of time!
12
11
 
13
- Everything is configured and ready to rock your next Rails 3 project. We hope it saves you a mess of time!
12
+ * Default: A base Rails 3 application with Devise and Cancan for
13
+ authentication and authorization. Roles are stored in the database
14
+ with a HABTM relationship between the role and user models. You also get
15
+ a basic admin to manage users. Prologue also rolls in all of the things
16
+ we like to have setup in our apps like: haml, sass, jquery, cucumber,
17
+ capybara, mocha, factory_girl, rspec, timecop, autotest, evergreen,
18
+ jasmine, will_paginate, friendly_id and hoptoad_notifier.
19
+
20
+ prologue new my_app
21
+ prologue new my_app default
22
+
23
+ * Async: A Rails 3 application with the basic setup complete for running
24
+ fully async on the Thin web server. Included gems are thin,
25
+ rack-fiber_pool, mysql2, and rspec.
26
+
27
+ prologue new my_app async
14
28
 
15
29
 
16
30
  ### Quick Start
@@ -20,7 +34,7 @@ Everything is configured and ready to rock your next Rails 3 project. We hope i
20
34
  prologue new my_app
21
35
 
22
36
 
23
- ### Options
37
+ ### Options ( in default template )
24
38
 
25
39
  prologue new my_app --no-auth
26
40
 
@@ -29,7 +43,7 @@ Everything is configured and ready to rock your next Rails 3 project. We hope i
29
43
  prologue new my_app --no-admin
30
44
 
31
45
 
32
- ### Testing generated app
46
+ ### Testing generated default app
33
47
 
34
48
  rake spec
35
49
  rake cucumber
@@ -69,5 +83,5 @@ templates into a gem in the first place.
69
83
 
70
84
  ### Copyright
71
85
 
72
- Copyright (c) 2010 Collin Schaafsma & Quick Left. See LICENSE for details.
86
+ Copyright (c) 2010-2011 Collin Schaafsma & Quick Left. See LICENSE for details.
73
87
 
data/Rakefile CHANGED
@@ -1,2 +1,19 @@
1
+ # encoding: utf-8
1
2
  require 'bundler'
3
+ Bundler.setup
2
4
  Bundler::GemHelper.install_tasks
5
+
6
+ # Add our cucumber rake task
7
+ require 'cucumber/rake/task'
8
+ desc "Run all cucumber examples"
9
+ Cucumber::Rake::Task.new(:cucumber) do |t|
10
+ t.cucumber_opts = "features --format pretty"
11
+ end
12
+
13
+ # Add our rspec rake task
14
+ require 'rspec/core/rake_task'
15
+ RSpec::Core::RakeTask.new(:spec)
16
+ RSpec::Core::RakeTask.new(:test)
17
+
18
+ task :default => :spec
19
+
@@ -1,4 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
3
- require 'prologue/cli'
4
- Prologue::CLI.start
2
+ # -*- mode: ruby -*-
3
+
4
+ # Requires
5
+ begin
6
+ require 'prologue'
7
+ rescue LoadError
8
+ $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
9
+ require 'rubygems'
10
+ require 'prologue'
11
+ end
12
+
13
+ # Setup Constants
14
+ Prologue::GEM_ROOT = File.expand_path( File.dirname( __FILE__ ) + '/../' )
15
+
16
+ # Run
17
+ Prologue::CLI.start
18
+
@@ -0,0 +1,2 @@
1
+ require 'aruba/cucumber'
2
+
@@ -1,7 +1,11 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
2
- require 'prologue/version'
3
1
  require 'prologue/cli'
2
+ require 'prologue/version'
4
3
 
5
4
  module Prologue
6
-
5
+
6
+ # Autoloads
7
+ autoload :Errors , 'prologue/errors'
8
+ autoload :TemplateRunner , 'prologue/template_runner'
9
+
7
10
  end
11
+
@@ -1,9 +1,12 @@
1
+ require 'active_support/secure_random'
1
2
  require 'thor'
2
3
  require 'thor/actions'
3
- require 'active_support/secure_random'
4
4
 
5
5
  module Prologue
6
+
6
7
  class CLI < Thor
8
+
9
+ # Includes
7
10
  include Thor::Actions
8
11
 
9
12
  desc "new [app]", "Create a new Rails 3 application"
@@ -11,35 +14,22 @@ module Prologue
11
14
  Prologue will ask you a few questions to determine what features you
12
15
  would like to generate. Based on your answers it will setup a new Rails 3 application.
13
16
  D
14
- method_option :auth, :type => :boolean, :default => true, :banner =>
15
- "Sets up devise for authentication."
16
- method_option :roles, :type => :boolean, :default => true, :banner =>
17
- "Sets up cancan for authorization with roles."
18
- method_option :admin, :type => :boolean, :default => true, :banner =>
19
- "Sets up very basic admin"
20
- def new(project)
21
- opts = options.dup
17
+ def new( project , template_name = "default" )
22
18
 
23
- # Can't build an admin or roles without devise
24
- if !opts[:auth]
25
- opts[:admin] = false;
26
- opts[:roles] = false;
27
- end
19
+ # Require the template runner
20
+ require "#{Prologue::GEM_ROOT}/templates/#{template_name}/#{template_name}.rb"
28
21
 
29
- # Env vars used in our template
30
- ENV['PROLOGUE_AUTH'] = "true" if opts[:auth]
31
- ENV['PROLOGUE_ADMIN'] = "true" if opts[:admin]
32
- ENV['PROLOGUE_ROLES'] = "true" if opts[:roles]
33
- ENV['PROLOGUE_USER_NAME'] = git_user_name if opts[:admin]
34
- ENV['PROLOGUE_USER_EMAIL'] = git_user_email if opts[:admin]
35
- ENV['PROLOGUE_USER_PASSWORD'] = user_password if opts[:admin]
22
+ # Invoke the template runner
23
+ invoke "prologue:templates:#{template_name}:on_invocation"
36
24
 
25
+ # Execute the template
37
26
  exec(<<-COMMAND)
38
27
  rails new #{project} \
39
- --template=#{template} \
28
+ --template=#{Prologue::GEM_ROOT}/templates/#{template_name}/bootstrap.rb \
40
29
  --skip-test-unit \
41
30
  --skip-prototype
42
31
  COMMAND
32
+
43
33
  end
44
34
 
45
35
  desc "version", "Prints Prologue's version information"
@@ -48,23 +38,7 @@ module Prologue
48
38
  end
49
39
  map %w(-v --version) => :version
50
40
 
51
- private
52
-
53
- def template
54
- File.expand_path(File.dirname(__FILE__) + "/../../templates/bootstrap.rb")
55
- end
56
-
57
- def git_user_name
58
- `git config --global user.name`.chomp.gsub('"', '\"') || "Quick Left"
59
- end
60
-
61
- def git_user_email
62
- `git config --global user.email`.chomp || "me@me.com"
63
- end
64
-
65
- def user_password
66
- ActiveSupport::SecureRandom.base64(8)
67
- end
68
-
69
41
  end
42
+
70
43
  end
44
+
@@ -0,0 +1,11 @@
1
+ module Prologue
2
+
3
+ module Errors
4
+
5
+ class TemplateRunnerNotImplementedError < StandardError; end
6
+ class TemplateRunnerInvocationNotImplementedError < StandardError; end
7
+
8
+ end
9
+
10
+ end
11
+
@@ -0,0 +1,30 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ require 'thor/group'
4
+
5
+ module Prologue
6
+
7
+ class TemplateRunner < Thor::Group
8
+
9
+ # Define the Standard Arguments in any base template class
10
+ def self.extended(base)
11
+ base.class_eval do
12
+ argument :project , :type => :string
13
+ end
14
+ end
15
+
16
+ # Includes
17
+ include Thor::Actions
18
+
19
+ # The method to run when the template is invoked. This is used to
20
+ # parse custom options from the command line or complete any other
21
+ # setup prior to invoking the system command that will construct
22
+ # the project.
23
+ def on_invocation
24
+ raise Prologue::Errors::TemplateRunnerInvocationNotImplementedError.new("Template did not define an on_invocation method!")
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
@@ -1,3 +1,3 @@
1
1
  module Prologue
2
- VERSION = "0.5.5"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -12,17 +12,21 @@ Gem::Specification.new do |s|
12
12
  s.description = "Generate a Rails 3 app with application templates Quick Left uses to start their projects off right!"
13
13
 
14
14
  s.rubyforge_project = "prologue"
15
-
16
15
  s.required_rubygems_version = "> 1.3.6"
17
16
 
18
- s.add_dependency "thor"
19
- s.add_dependency('rails', '~> 3.0.0')
20
- s.add_development_dependency "bundler", "~> 1.0.0"
21
- s.add_development_dependency "cucumber"
22
- s.add_development_dependency "aruba"
23
- s.add_development_dependency "rspec", "~> 2.0.0"
17
+ # Runtime Dependencies
18
+ s.add_dependency "activesupport" , "~> 3.0.7"
19
+ s.add_dependency "rails" , "~> 3.0.7"
20
+ s.add_dependency "thor" , "~> 0.14.6"
21
+
22
+ # Development Dependencies
23
+ s.add_development_dependency "aruba" , "~> 0.2.3"
24
+ s.add_development_dependency "bundler" , "~> 1.0.12"
25
+ s.add_development_dependency "cucumber" , "~> 0.9.3"
26
+ s.add_development_dependency "rspec" , "~> 2.0.0"
24
27
 
25
28
  s.files = `git ls-files`.split("\n")
26
29
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
27
- s.require_path = 'lib'
30
+ s.require_path = "lib"
28
31
  end
32
+
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Prologue::CLI do
4
+
5
+ it "should raise an error if a bad template name is passed in" do
6
+ lambda {
7
+ instance = Prologue::CLI.new
8
+ instance.new( "app" , "bogus" )
9
+ }.should raise_error
10
+ end
11
+
12
+ end
13
+
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ class TestTemplate1 < ::Prologue::TemplateRunner
4
+ def on_invocation
5
+ return "hi"
6
+ end
7
+ end
8
+
9
+ class TestTemplate2 < ::Prologue::TemplateRunner
10
+ end
11
+
12
+ describe Prologue::TemplateRunner do
13
+
14
+ it "should not raise an error if the on_invocation method is implemented" do
15
+ lambda {
16
+ TestTemplate1.new.on_invocation
17
+ }.should_not raise_error
18
+ end
19
+
20
+ it "should raise an error if the on_invocation method isn't implemented" do
21
+ lambda {
22
+ TestTemplate2.new.on_invocation
23
+ }.should raise_error
24
+ end
25
+
26
+ end
27
+
@@ -0,0 +1,3 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
+ require 'prologue'
3
+ Prologue::GEM_ROOT = File.expand_path( File.dirname( __FILE__ ) + '/../' )
@@ -0,0 +1,18 @@
1
+ module Prologue
2
+
3
+ module Templates
4
+
5
+ class Async < Prologue::TemplateRunner
6
+
7
+ # Descriptions
8
+ desc "Installs an async Rails 3 stack"
9
+
10
+ # The method to run when the template is invoked
11
+ def on_invocation; end
12
+
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+
@@ -0,0 +1,54 @@
1
+ say "Building Application with Prologue..."
2
+
3
+ # Some git setup
4
+ git :init
5
+ run 'rm .gitignore'
6
+ create_file '.gitignore' do
7
+ <<-FILE
8
+ .bundle
9
+ .DS_Store
10
+ log/*.log
11
+ tmp/**/*
12
+ config/database.yml
13
+ db/*.sqlite3
14
+ public/system/**/**/**/*
15
+ *.swp
16
+ FILE
17
+ end
18
+
19
+ # Apply Gemfile
20
+ apply File.expand_path("../lib/gemfile.rb", __FILE__)
21
+
22
+ # Apply db create and migrations
23
+ apply File.expand_path("../lib/mysql2_db.rb", __FILE__)
24
+
25
+ # Add the thin gem
26
+ apply File.expand_path("../lib/thin.rb", __FILE__)
27
+
28
+ # Make initializers
29
+ apply File.expand_path("../lib/rack-fiber_pool.rb", __FILE__)
30
+
31
+ run 'bundle install'
32
+
33
+ # Apply Test Suite
34
+ apply File.expand_path("../lib/test_suite.rb", __FILE__)
35
+
36
+ say <<-D
37
+
38
+
39
+
40
+
41
+ ########################################################################
42
+
43
+ Prologue just added like 6 hours to your life. And it's async too!
44
+
45
+ Template Installed :: Rails 3 Async
46
+
47
+ Make sure you're using MRI Ruby 1.9
48
+
49
+ Next run...
50
+ rails s thin
51
+
52
+ ########################################################################
53
+ D
54
+
@@ -0,0 +1,6 @@
1
+ run 'rm Gemfile'
2
+ create_file 'Gemfile', "source 'http://rubygems.org'\n"
3
+ gem "rails" , "~> 3.0.0"
4
+ gem "database_cleaner", :group => :test
5
+ gem "rspec-rails", "~> 2.0.0", :group => :test
6
+ gem "sqlite3-ruby", :require => "sqlite3", :group => [:test, :development]
@@ -0,0 +1,24 @@
1
+ # Add the mysql2 gem
2
+ gem "mysql2" , "~> 0.2.7"
3
+
4
+ # Redefine our database.yml using the async adapters
5
+ run 'rm config/database.yml'
6
+ create_file 'config/database.yml' do
7
+ <<-FILE
8
+ development:
9
+ adapter: em_mysql2
10
+ database: rails_async_development
11
+ username: root
12
+ pool: 250
13
+ timeout: 5000
14
+
15
+ test:
16
+ adapter: em_mysql2
17
+ database: rails_async_test
18
+ username: root
19
+ pool: 5
20
+ timeout: 5000
21
+
22
+ FILE
23
+ end
24
+
@@ -0,0 +1,15 @@
1
+ # Add the rack fiber pool gem
2
+ gem "rack-fiber_pool", :require => "rack/fiber_pool"
3
+
4
+ # Add Our Initializer
5
+ initializer('rack_fiber_pool_middleware.rb') do
6
+ <<-'FILE'
7
+ # Add in our rack fiber pool middleware
8
+ Rails.configuration.middleware.insert_before ActionDispatch::Static , Rack::FiberPool
9
+
10
+ # Remove the rack lock middleware
11
+ Rails.configuration.threadsafe!
12
+
13
+ FILE
14
+ end
15
+
@@ -0,0 +1,8 @@
1
+ run 'rails generate rspec:install'
2
+ inject_into_file 'config/application.rb', :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do
3
+ <<-RUBY
4
+ config.generators do |g|
5
+ g.test_framework :rspec
6
+ end
7
+ RUBY
8
+ end
@@ -0,0 +1,3 @@
1
+ # Add the thin gem
2
+ gem "thin"
3
+
@@ -35,70 +35,70 @@ FILE
35
35
  end
36
36
 
37
37
  # Apply Gemfile
38
- apply File.expand_path("../gemfile.rb", __FILE__)
38
+ apply File.expand_path("../lib/gemfile.rb", __FILE__)
39
39
 
40
40
  # Apply Jammit
41
- apply File.expand_path("../jammit.rb", __FILE__)
41
+ apply File.expand_path("../lib/jammit.rb", __FILE__)
42
42
 
43
43
  # Apply HAML generator
44
- apply File.expand_path("../haml_generator.rb", __FILE__)
44
+ apply File.expand_path("../lib/haml_generator.rb", __FILE__)
45
45
 
46
46
  # Apply rails clean up
47
- apply File.expand_path("../rails_clean.rb", __FILE__)
47
+ apply File.expand_path("../lib/rails_clean.rb", __FILE__)
48
48
 
49
49
  # Apply js
50
- apply File.expand_path("../js.rb", __FILE__)
50
+ apply File.expand_path("../lib/js.rb", __FILE__)
51
51
 
52
52
  # Apply css
53
- apply File.expand_path("../css.rb", __FILE__)
53
+ apply File.expand_path("../lib/css.rb", __FILE__)
54
54
 
55
55
  # Apply evergreen and jasmin
56
- apply File.expand_path("../evergreen.rb", __FILE__)
56
+ apply File.expand_path("../lib/evergreen.rb", __FILE__)
57
57
 
58
58
  # Apply HTML5 Layout
59
- apply File.expand_path("../application_layout.rb", __FILE__)
59
+ apply File.expand_path("../lib/application_layout.rb", __FILE__)
60
60
 
61
61
  # Apply SASS
62
- apply File.expand_path("../sass.rb", __FILE__)
62
+ apply File.expand_path("../lib/sass.rb", __FILE__)
63
63
 
64
64
  # Apply Test Suite
65
- apply File.expand_path("../test_suite.rb", __FILE__)
65
+ apply File.expand_path("../lib/test_suite.rb", __FILE__)
66
66
 
67
67
  # Apply Friendly Id
68
- apply File.expand_path("../friendly_id.rb", __FILE__)
68
+ apply File.expand_path("../lib/friendly_id.rb", __FILE__)
69
69
 
70
70
  # Apply Devise?
71
- apply File.expand_path("../devise.rb", __FILE__) if ENV['PROLOGUE_AUTH']
71
+ apply File.expand_path("../lib/devise.rb", __FILE__) if ENV['PROLOGUE_AUTH']
72
72
 
73
73
  # Apply admin
74
- apply File.expand_path("../admin.rb", __FILE__) if ENV['PROLOGUE_ADMIN']
74
+ apply File.expand_path("../lib/admin.rb", __FILE__) if ENV['PROLOGUE_ADMIN']
75
75
 
76
76
  # Apply cancan
77
- apply File.expand_path("../cancan.rb", __FILE__) if ENV['PROLOGUE_ROLES']
77
+ apply File.expand_path("../lib/cancan.rb", __FILE__) if ENV['PROLOGUE_ROLES']
78
78
 
79
79
  # Apply db create and migrations
80
- apply File.expand_path("../db.rb", __FILE__)
80
+ apply File.expand_path("../lib/db.rb", __FILE__)
81
81
 
82
82
  # Apply db seeds
83
- apply File.expand_path("../db_seed.rb", __FILE__)
83
+ apply File.expand_path("../lib/db_seed.rb", __FILE__)
84
84
 
85
85
  # Make a home controller
86
- apply File.expand_path("../home_controller.rb", __FILE__)
86
+ apply File.expand_path("../lib/home_controller.rb", __FILE__)
87
87
 
88
88
  # Make initializers
89
- apply File.expand_path("../initializers.rb", __FILE__)
89
+ apply File.expand_path("../lib/initializers.rb", __FILE__)
90
90
 
91
91
  # Clean up generated routes
92
- apply File.expand_path("../clean_routes.rb", __FILE__)
92
+ apply File.expand_path("../lib/clean_routes.rb", __FILE__)
93
93
 
94
94
  # Setup yard
95
- apply File.expand_path("../yard.rb", __FILE__)
95
+ apply File.expand_path("../lib/yard.rb", __FILE__)
96
96
 
97
97
  # Remove RSpec stuff we are not gonna use right away
98
- apply File.expand_path("../rspec_clean.rb", __FILE__)
98
+ apply File.expand_path("../lib/rspec_clean.rb", __FILE__)
99
99
 
100
100
  # Make the form errors work like they did in 2.3.8
101
- apply File.expand_path("../dynamic_form.rb", __FILE__)
101
+ apply File.expand_path("../lib/dynamic_form.rb", __FILE__)
102
102
 
103
103
  login_msg = (ENV['PROLOGUE_ADMIN']) ? "Login to admin with email #{ENV['PROLOGUE_USER_EMAIL']} and password #{ENV['PROLOGUE_USER_PASSWORD']}" : ""
104
104
 
@@ -111,6 +111,8 @@ say <<-D
111
111
 
112
112
  Prologue just added like 6 hours to your life.
113
113
 
114
+ Template Installed :: Quick Left Rails 3 Prologue Default
115
+
114
116
  Next run...
115
117
  rake spec
116
118
  rake cucumber
@@ -0,0 +1,59 @@
1
+ require 'active_support/secure_random'
2
+
3
+ module Prologue
4
+
5
+ module Templates
6
+
7
+ class Default < Prologue::TemplateRunner
8
+
9
+ # Class Options
10
+ # @see https://github.com/wycats/thor/wiki/Groups
11
+ class_option :auth , :type => :boolean , :default => true , :banner => "Sets up devise for authentication."
12
+ class_option :roles , :type => :boolean , :default => true , :banner => "Sets up cancan for authorization with roles."
13
+ class_option :admin , :type => :boolean , :default => true , :banner => "Sets up very basic admin"
14
+
15
+ # Descriptions
16
+ desc "Runs the default prologue Rails 3 stack task"
17
+
18
+ # The method to run when the template is invoked
19
+ def on_invocation
20
+
21
+ # Dup our options so we can modify them
22
+ opts = options.dup
23
+
24
+ # Can't build an admin or roles without devise
25
+ if !opts[:auth]
26
+ opts[:admin] = false;
27
+ opts[:roles] = false;
28
+ end
29
+
30
+ # Env vars used in our template
31
+ ENV['PROLOGUE_AUTH'] = "true" if opts[:auth]
32
+ ENV['PROLOGUE_ADMIN'] = "true" if opts[:admin]
33
+ ENV['PROLOGUE_ROLES'] = "true" if opts[:roles]
34
+ ENV['PROLOGUE_USER_NAME'] = git_user_name if opts[:admin]
35
+ ENV['PROLOGUE_USER_EMAIL'] = git_user_email if opts[:admin]
36
+ ENV['PROLOGUE_USER_PASSWORD'] = user_password if opts[:admin]
37
+
38
+ end
39
+
40
+ private
41
+
42
+ def git_user_name
43
+ `git config --global user.name`.chomp.gsub('"', '\"') || "Quick Left"
44
+ end
45
+
46
+ def git_user_email
47
+ `git config --global user.email`.chomp || "me@me.com"
48
+ end
49
+
50
+ def user_password
51
+ ActiveSupport::SecureRandom.base64(8)
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+
58
+ end
59
+
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prologue
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 5
10
- version: 0.5.5
5
+ version: 0.6.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Quick Left
@@ -15,99 +10,85 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-08 00:00:00 -07:00
19
- default_executable:
13
+ date: 2011-05-06 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
- name: thor
23
- prerelease: false
16
+ name: activesupport
24
17
  requirement: &id001 !ruby/object:Gem::Requirement
25
18
  none: false
26
19
  requirements:
27
- - - ">="
20
+ - - ~>
28
21
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
22
+ version: 3.0.7
33
23
  type: :runtime
24
+ prerelease: false
34
25
  version_requirements: *id001
35
26
  - !ruby/object:Gem::Dependency
36
27
  name: rails
37
- prerelease: false
38
28
  requirement: &id002 !ruby/object:Gem::Requirement
39
29
  none: false
40
30
  requirements:
41
31
  - - ~>
42
32
  - !ruby/object:Gem::Version
43
- hash: 7
44
- segments:
45
- - 3
46
- - 0
47
- - 0
48
- version: 3.0.0
33
+ version: 3.0.7
49
34
  type: :runtime
35
+ prerelease: false
50
36
  version_requirements: *id002
51
37
  - !ruby/object:Gem::Dependency
52
- name: bundler
53
- prerelease: false
38
+ name: thor
54
39
  requirement: &id003 !ruby/object:Gem::Requirement
55
40
  none: false
56
41
  requirements:
57
42
  - - ~>
58
43
  - !ruby/object:Gem::Version
59
- hash: 23
60
- segments:
61
- - 1
62
- - 0
63
- - 0
64
- version: 1.0.0
65
- type: :development
44
+ version: 0.14.6
45
+ type: :runtime
46
+ prerelease: false
66
47
  version_requirements: *id003
67
48
  - !ruby/object:Gem::Dependency
68
- name: cucumber
69
- prerelease: false
49
+ name: aruba
70
50
  requirement: &id004 !ruby/object:Gem::Requirement
71
51
  none: false
72
52
  requirements:
73
- - - ">="
53
+ - - ~>
74
54
  - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
55
+ version: 0.2.3
79
56
  type: :development
57
+ prerelease: false
80
58
  version_requirements: *id004
81
59
  - !ruby/object:Gem::Dependency
82
- name: aruba
83
- prerelease: false
60
+ name: bundler
84
61
  requirement: &id005 !ruby/object:Gem::Requirement
85
62
  none: false
86
63
  requirements:
87
- - - ">="
64
+ - - ~>
88
65
  - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
66
+ version: 1.0.12
93
67
  type: :development
68
+ prerelease: false
94
69
  version_requirements: *id005
95
70
  - !ruby/object:Gem::Dependency
96
- name: rspec
97
- prerelease: false
71
+ name: cucumber
98
72
  requirement: &id006 !ruby/object:Gem::Requirement
99
73
  none: false
100
74
  requirements:
101
75
  - - ~>
102
76
  - !ruby/object:Gem::Version
103
- hash: 15
104
- segments:
105
- - 2
106
- - 0
107
- - 0
108
- version: 2.0.0
77
+ version: 0.9.3
109
78
  type: :development
79
+ prerelease: false
110
80
  version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: &id007 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 2.0.0
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *id007
111
92
  description: Generate a Rails 3 app with application templates Quick Left uses to start their projects off right!
112
93
  email:
113
94
  - info@quickleft.com
@@ -118,6 +99,7 @@ extensions: []
118
99
  extra_rdoc_files: []
119
100
 
120
101
  files:
102
+ - .gemtest
121
103
  - .gitignore
122
104
  - Gemfile
123
105
  - Gemfile.lock
@@ -126,42 +108,54 @@ files:
126
108
  - Rakefile
127
109
  - bin/prologue
128
110
  - features/new.feature
129
- - features/support/setup.rb
111
+ - features/support/env.rb
130
112
  - lib/prologue.rb
131
113
  - lib/prologue/cli.rb
114
+ - lib/prologue/errors.rb
115
+ - lib/prologue/template_runner.rb
132
116
  - lib/prologue/version.rb
133
117
  - prologue.gemspec
134
- - templates/admin.rb
135
- - templates/admin/cucumber.rb
136
- - templates/admin/dashboard_spec.rb
137
- - templates/admin/layout.rb
138
- - templates/admin/sass.rb
139
- - templates/admin/users.rb
140
- - templates/admin/users_spec.rb
141
- - templates/application_layout.rb
142
- - templates/bootstrap.rb
143
- - templates/cancan.rb
144
- - templates/clean_routes.rb
145
- - templates/css.rb
146
- - templates/db.rb
147
- - templates/db_seed.rb
148
- - templates/devise.rb
149
- - templates/devise/cucumber.rb
150
- - templates/dynamic_form.rb
151
- - templates/evergreen.rb
152
- - templates/friendly_id.rb
153
- - templates/gemfile.rb
154
- - templates/haml_generator.rb
155
- - templates/home_controller.rb
156
- - templates/initializers.rb
157
- - templates/jammit.rb
158
- - templates/js.rb
159
- - templates/rails_clean.rb
160
- - templates/rspec_clean.rb
161
- - templates/sass.rb
162
- - templates/test_suite.rb
163
- - templates/yard.rb
164
- has_rdoc: true
118
+ - spec/prologue_cli_spec.rb
119
+ - spec/prologue_template_runner_spec.rb
120
+ - spec/spec_helper.rb
121
+ - templates/async/async.rb
122
+ - templates/async/bootstrap.rb
123
+ - templates/async/lib/gemfile.rb
124
+ - templates/async/lib/mysql2_db.rb
125
+ - templates/async/lib/rack-fiber_pool.rb
126
+ - templates/async/lib/test_suite.rb
127
+ - templates/async/lib/thin.rb
128
+ - templates/default/bootstrap.rb
129
+ - templates/default/default.rb
130
+ - templates/default/lib/admin.rb
131
+ - templates/default/lib/admin/cucumber.rb
132
+ - templates/default/lib/admin/dashboard_spec.rb
133
+ - templates/default/lib/admin/layout.rb
134
+ - templates/default/lib/admin/sass.rb
135
+ - templates/default/lib/admin/users.rb
136
+ - templates/default/lib/admin/users_spec.rb
137
+ - templates/default/lib/application_layout.rb
138
+ - templates/default/lib/cancan.rb
139
+ - templates/default/lib/clean_routes.rb
140
+ - templates/default/lib/css.rb
141
+ - templates/default/lib/db.rb
142
+ - templates/default/lib/db_seed.rb
143
+ - templates/default/lib/devise.rb
144
+ - templates/default/lib/devise/cucumber.rb
145
+ - templates/default/lib/dynamic_form.rb
146
+ - templates/default/lib/evergreen.rb
147
+ - templates/default/lib/friendly_id.rb
148
+ - templates/default/lib/gemfile.rb
149
+ - templates/default/lib/haml_generator.rb
150
+ - templates/default/lib/home_controller.rb
151
+ - templates/default/lib/initializers.rb
152
+ - templates/default/lib/jammit.rb
153
+ - templates/default/lib/js.rb
154
+ - templates/default/lib/rails_clean.rb
155
+ - templates/default/lib/rspec_clean.rb
156
+ - templates/default/lib/sass.rb
157
+ - templates/default/lib/test_suite.rb
158
+ - templates/default/lib/yard.rb
165
159
  homepage: http://github.com/quickleft/prologue
166
160
  licenses: []
167
161
 
@@ -175,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
169
  requirements:
176
170
  - - ">="
177
171
  - !ruby/object:Gem::Version
178
- hash: 3
172
+ hash: 1566382483237015345
179
173
  segments:
180
174
  - 0
181
175
  version: "0"
@@ -184,18 +178,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
178
  requirements:
185
179
  - - ">"
186
180
  - !ruby/object:Gem::Version
187
- hash: 23
188
- segments:
189
- - 1
190
- - 3
191
- - 6
192
181
  version: 1.3.6
193
182
  requirements: []
194
183
 
195
184
  rubyforge_project: prologue
196
- rubygems_version: 1.6.1
185
+ rubygems_version: 1.7.2
197
186
  signing_key:
198
187
  specification_version: 3
199
- summary: prologue-0.5.5
188
+ summary: prologue-0.6.0
200
189
  test_files: []
201
190
 
@@ -1 +0,0 @@
1
- require 'aruba'