gypsum 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ tmp
5
+ .idea
6
+ .DS_Store
7
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in gypsum.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,109 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gypsum (0.6.0)
5
+ activesupport (= 3.1.0.rc6)
6
+ rails (= 3.1.0.rc6)
7
+ thor (~> 0.14.6)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.1.0.rc6)
13
+ actionpack (= 3.1.0.rc6)
14
+ mail (~> 2.3.0)
15
+ actionpack (3.1.0.rc6)
16
+ activemodel (= 3.1.0.rc6)
17
+ activesupport (= 3.1.0.rc6)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ i18n (~> 0.6)
21
+ rack (~> 1.3.2)
22
+ rack-cache (~> 1.0.2)
23
+ rack-mount (~> 0.8.1)
24
+ rack-test (~> 0.6.0)
25
+ sprockets (~> 2.0.0.beta.12)
26
+ activemodel (3.1.0.rc6)
27
+ activesupport (= 3.1.0.rc6)
28
+ bcrypt-ruby (~> 2.1.4)
29
+ builder (~> 3.0.0)
30
+ i18n (~> 0.6)
31
+ activerecord (3.1.0.rc6)
32
+ activemodel (= 3.1.0.rc6)
33
+ activesupport (= 3.1.0.rc6)
34
+ arel (~> 2.2.1)
35
+ tzinfo (~> 0.3.29)
36
+ activeresource (3.1.0.rc6)
37
+ activemodel (= 3.1.0.rc6)
38
+ activesupport (= 3.1.0.rc6)
39
+ activesupport (3.1.0.rc6)
40
+ multi_json (~> 1.0)
41
+ arel (2.2.1)
42
+ bcrypt-ruby (2.1.4)
43
+ builder (3.0.0)
44
+ diff-lcs (1.1.2)
45
+ erubis (2.7.0)
46
+ hike (1.2.1)
47
+ i18n (0.6.0)
48
+ mail (2.3.0)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mime-types (1.16)
53
+ multi_json (1.0.3)
54
+ polyglot (0.3.2)
55
+ rack (1.3.2)
56
+ rack-cache (1.0.2)
57
+ rack (>= 0.4)
58
+ rack-mount (0.8.2)
59
+ rack (>= 1.0.0)
60
+ rack-ssl (1.3.2)
61
+ rack
62
+ rack-test (0.6.1)
63
+ rack (>= 1.0)
64
+ rails (3.1.0.rc6)
65
+ actionmailer (= 3.1.0.rc6)
66
+ actionpack (= 3.1.0.rc6)
67
+ activerecord (= 3.1.0.rc6)
68
+ activeresource (= 3.1.0.rc6)
69
+ activesupport (= 3.1.0.rc6)
70
+ bundler (~> 1.0)
71
+ railties (= 3.1.0.rc6)
72
+ railties (3.1.0.rc6)
73
+ actionpack (= 3.1.0.rc6)
74
+ activesupport (= 3.1.0.rc6)
75
+ rack-ssl (~> 1.3.2)
76
+ rake (>= 0.8.7)
77
+ rdoc (~> 3.4)
78
+ thor (~> 0.14.6)
79
+ rake (0.9.2)
80
+ rdoc (3.9.2)
81
+ rspec (2.0.1)
82
+ rspec-core (~> 2.0.1)
83
+ rspec-expectations (~> 2.0.1)
84
+ rspec-mocks (~> 2.0.1)
85
+ rspec-core (2.0.1)
86
+ rspec-expectations (2.0.1)
87
+ diff-lcs (>= 1.1.2)
88
+ rspec-mocks (2.0.1)
89
+ rspec-core (~> 2.0.1)
90
+ rspec-expectations (~> 2.0.1)
91
+ sprockets (2.0.0.beta.14)
92
+ hike (~> 1.2)
93
+ rack (~> 1.0)
94
+ tilt (!= 1.3.0, ~> 1.1)
95
+ thor (0.14.6)
96
+ tilt (1.3.2)
97
+ treetop (1.4.10)
98
+ polyglot
99
+ polyglot (>= 0.3.1)
100
+ tzinfo (0.3.29)
101
+
102
+ PLATFORMS
103
+ ruby
104
+
105
+ DEPENDENCIES
106
+ bundler (~> 1.0.12)
107
+ gypsum!
108
+ rspec (~> 2.0.0)
109
+ thor
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010-2011 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/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/gypsum.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/gypsum/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "gypsum"
6
+ s.version = Gypsum::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["We Are Titans"]
9
+ s.email = ["question@wearetitans.net"]
10
+ s.homepage = "http://www.wearetitans.net"
11
+ s.summary = "gypsum-0.5"
12
+ s.description = "Generate a Rails 3.1 app with application templates."
13
+
14
+ s.rubyforge_project = "gypsum"
15
+ s.required_rubygems_version = "> 1.3.6"
16
+
17
+ # Runtime Dependencies
18
+ s.add_dependency "activesupport" , "3.1.0.rc6"
19
+ s.add_dependency "thor" , "~> 0.14.6"
20
+ s.add_dependency "rails" , '3.1.0.rc6'
21
+
22
+ # Development Dependencies
23
+ s.add_development_dependency "bundler" , "~> 1.0.12"
24
+ s.add_development_dependency "rspec" , "~> 2.0.0"
25
+ s.add_development_dependency "thor"
26
+
27
+ s.files = `git ls-files`.split("\n")
28
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
29
+ s.require_path = "lib"
30
+ end
data/lib/gypsum/cli.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+
4
+ module Gypsum
5
+
6
+ class CLI < Thor
7
+
8
+ # Includes
9
+ include Thor::Actions
10
+
11
+ desc "new [app]", "Create a new Rails 3.1 application"
12
+ long_desc <<-D
13
+ Gypsum will ask you a few questions to determine what features you
14
+ would like to generate. Based on your answers it will setup a new Rails 3 application.
15
+ D
16
+ def new( project , template_name = "default" )
17
+
18
+ # Require the template runner
19
+ require "#{Gypsum::GEM_ROOT}/templates/#{template_name}/#{template_name}.rb"
20
+
21
+ # Invoke the template runner
22
+ invoke "gypsum:templates:#{template_name}:on_invocation"
23
+
24
+ # Execute the template
25
+ exec(<<-COMMAND)
26
+ rails new #{project} \
27
+ --template=#{Gypsum::GEM_ROOT}/templates/#{template_name}/bootstrap.rb \
28
+ --skip-test-unit \
29
+ --skip-prototype
30
+ COMMAND
31
+
32
+ end
33
+
34
+ desc "version", "Prints Gypsum's version information"
35
+ def version
36
+ say "Gypsum version #{Gypsum::VERSION}"
37
+ end
38
+ map %w(-v --version) => :version
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,6 @@
1
+ module Prologue
2
+ module Errors
3
+ class TemplateRunnerNotImplementedError < StandardError; end
4
+ class TemplateRunnerInvocationNotImplementedError < StandardError; end
5
+ end
6
+ end
@@ -0,0 +1,29 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ require 'thor/group'
4
+
5
+ module Gypsum
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 Gypsum::Errors::TemplateRunnerInvocationNotImplementedError.new("Template did not define an on_invocation method!")
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,3 @@
1
+ module Gypsum
2
+ VERSION = "0.8.0"
3
+ end
data/lib/gypsum.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'gypsum/cli'
2
+ require 'gypsum/version'
3
+
4
+ module Gypsum
5
+ autoload :Errors , 'gypsum/errors'
6
+ autoload :TemplateRunner , 'gypsum/template_runner'
7
+ end
@@ -0,0 +1,91 @@
1
+ require "net/http"
2
+ require "net/https"
3
+ require "uri"
4
+ require 'rbconfig'
5
+
6
+ say "Building Application with Gypsum..."
7
+
8
+ def get_remote_https_file(source, destination)
9
+ uri = URI.parse(source)
10
+ http = Net::HTTP.new(uri.host, uri.port)
11
+ http.use_ssl = true
12
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
+ request = Net::HTTP::Get.new(uri.request_uri)
14
+ response = http.request(request)
15
+ path = File.join(destination_root, destination)
16
+ File.open(path, "w") { |file| file.write(response.body) }
17
+ end
18
+
19
+ git :init
20
+
21
+ run 'rm .gitignore'
22
+ create_file '.gitignore' do
23
+ <<-FILE
24
+ .bundle
25
+ .DS_Store
26
+ log/*.log
27
+ tmp/**/*
28
+ config/database.yml
29
+ db/*.sqlite3
30
+ public/system/**/**/**/*
31
+ .idea/*
32
+ .sass-cache/**/*
33
+ *.swp
34
+ FILE
35
+ end
36
+
37
+ # Apply Gemfile
38
+ apply File.expand_path("../lib/gemfile.rb", __FILE__)
39
+
40
+ # Apply HAML generator
41
+ apply File.expand_path("../lib/haml_generator.rb", __FILE__)
42
+
43
+ # Apply rails clean up
44
+ apply File.expand_path("../lib/rails_clean.rb", __FILE__)
45
+
46
+ # Apply Test Suite
47
+ apply File.expand_path("../lib/test_suite.rb", __FILE__)
48
+
49
+ # Apply Friendly Id
50
+ apply File.expand_path("../lib/friendly_id.rb", __FILE__)
51
+
52
+ # Apply Devise?
53
+ apply File.expand_path("../lib/devise.rb", __FILE__)
54
+
55
+ # Apply cancan
56
+ apply File.expand_path("../lib/cancan.rb", __FILE__) if ENV['PROLOGUE_ROLES']
57
+
58
+ # Apply db create and migrations
59
+ apply File.expand_path("../lib/db.rb", __FILE__)
60
+
61
+ # Apply db seeds
62
+ apply File.expand_path("../lib/db_seed.rb", __FILE__)
63
+
64
+ # Make a home controller
65
+ apply File.expand_path("../lib/home_controller.rb", __FILE__)
66
+
67
+ # Make initializers
68
+ apply File.expand_path("../lib/initializers.rb", __FILE__)
69
+
70
+ # Clean up generated routes
71
+ apply File.expand_path("../lib/clean_routes.rb", __FILE__)
72
+
73
+ # Remove RSpec stuff we are not gonna use right away
74
+ apply File.expand_path("../lib/rspec_clean.rb", __FILE__)
75
+
76
+
77
+ say <<-D
78
+
79
+
80
+ <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
81
+
82
+ Gypsum just added like 15 minutes to your life.
83
+
84
+ Template Installed :: Gypsum default
85
+
86
+ Next run...
87
+
88
+ rm -rf /
89
+
90
+ <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
91
+ D
@@ -0,0 +1,36 @@
1
+ module Gypsum
2
+
3
+ module Templates
4
+
5
+ class Default < Gypsum::TemplateRunner
6
+
7
+ # Descriptions
8
+ desc "Runs the default gypsum Rails 3.1 stack task"
9
+
10
+ # The method to run when the template is invoked
11
+ def on_invocation
12
+
13
+ # Dup our options so we can modify them
14
+ opts = options.dup
15
+
16
+ end
17
+
18
+ private
19
+
20
+ def git_user_name
21
+ `git config --global user.name`.chomp.gsub('"', '\"') || "zsiec"
22
+ end
23
+
24
+ def git_user_email
25
+ `git config --global user.email`.chomp || "thomas.symborski@gmail.com"
26
+ end
27
+
28
+ def user_password
29
+ 'asdoajsndokasodnaosdjn'
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,86 @@
1
+ say "Building roles"
2
+ generate(:model, "role name:string")
3
+ generate(:migration, "UsersHaveAndBelongToManyRoles")
4
+ habtm_roles = Dir['db/migrate/*_users_have_and_belong_to_many_roles.rb'].first
5
+ inject_into_file habtm_roles, :after => "def self.up\n" do
6
+ <<-RUBY
7
+ create_table :roles_users, :id => false do |t|
8
+ t.references :role, :user
9
+ end
10
+ RUBY
11
+ end
12
+
13
+ inject_into_file habtm_roles, :after => "def self.down\n" do
14
+ <<-RUBY
15
+ drop_table :roles_users
16
+ RUBY
17
+ end
18
+
19
+ inject_into_file 'app/models/user.rb', :after => "class User < ActiveRecord::Base\n" do
20
+ <<-RUBY
21
+ has_and_belongs_to_many :roles
22
+ RUBY
23
+ end
24
+
25
+ inject_into_file 'app/models/role.rb', :after => "class Role < ActiveRecord::Base\n" do
26
+ <<-RUBY
27
+ has_and_belongs_to_many :users
28
+
29
+ def self.sanitize role
30
+ role.to_s.humanize.split(' ').each{ |word| word.capitalize! }.join(' ')
31
+ end
32
+ RUBY
33
+ end
34
+
35
+ create_file 'app/models/ability.rb' do
36
+ <<-RUBY
37
+ class Ability
38
+ include CanCan::Ability
39
+
40
+ def initialize(user)
41
+ user ||= User.new # guest user
42
+
43
+ if user.role? :admin
44
+ can :manage, :all
45
+ end
46
+ end
47
+ end
48
+ RUBY
49
+ end
50
+
51
+ inject_into_file 'app/models/user.rb', :before => "def destroy\n" do
52
+ <<-RUBY
53
+
54
+ def role?(role)
55
+ return !!self.roles.find_by_name( Role.sanitize role )
56
+ end
57
+
58
+ RUBY
59
+ end
60
+
61
+ inject_into_file 'app/controllers/application_controller.rb', :before => "end\n" do
62
+ <<-RUBY
63
+
64
+ rescue_from CanCan::AccessDenied do |exception|
65
+ flash[:error] = "Access Denied"
66
+ redirect_to root_url
67
+ end
68
+ RUBY
69
+ end
70
+
71
+
72
+ append_file 'db/seeds.rb' do
73
+ <<-FILE
74
+ Role.create! :name => 'Admin'
75
+ Role.create! :name => 'Member'
76
+
77
+ user1 = User.find_by_email('#{ENV['PROLOGUE_USER_EMAIL']}')
78
+ user1.role_ids = [1,2]
79
+ user1.save
80
+ FILE
81
+ end
82
+
83
+
84
+
85
+
86
+
@@ -0,0 +1,8 @@
1
+ gsub_file 'config/routes.rb', /get \"home\/index\"/, ''
2
+ gsub_file 'config/routes.rb', /get \"users\/index\"/, ''
3
+ gsub_file 'config/routes.rb', /get \"users\/new\"/, ''
4
+ gsub_file 'config/routes.rb', /get \"users\/create\"/, ''
5
+ gsub_file 'config/routes.rb', /get \"users\/edit\"/, ''
6
+ gsub_file 'config/routes.rb', /get \"users\/update\"/, ''
7
+ gsub_file 'config/routes.rb', /get \"users\/destroy\"/, ''
8
+ gsub_file 'config/routes.rb', /get \"dashboard\/index\"/, ''
@@ -0,0 +1,2 @@
1
+ run 'rake db:migrate'
2
+ run 'rake db:test:prepare'
@@ -0,0 +1 @@
1
+ run 'rake db:seed'
@@ -0,0 +1,91 @@
1
+ say "Building authentication"
2
+ gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'
3
+
4
+ run 'rails generate devise:install'
5
+ run 'rails generate devise:views'
6
+
7
+ gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '### ActionMailer Config'
8
+
9
+ gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do
10
+ <<-RUBY
11
+ config.action_mailer.default_url_options = { :host => '0.0.0.0:3000' }
12
+ # A dummy setup for development - no deliveries, but logged
13
+ config.action_mailer.delivery_method = :smtp
14
+ config.action_mailer.perform_deliveries = false
15
+ config.action_mailer.raise_delivery_errors = true
16
+ config.action_mailer.default :charset => "utf-8"
17
+ RUBY
18
+ end
19
+
20
+ inject_into_file 'config/environments/test.rb', :after => "config.action_controller.allow_forgery_protection = false\n" do
21
+ <<-RUBY
22
+ config.action_mailer.default_url_options = { :host => '0.0.0.0:3000' }
23
+ RUBY
24
+ end
25
+
26
+ gsub_file 'config/environments/production.rb', /config.i18n.fallbacks = true/ do
27
+ <<-RUBY
28
+ config.i18n.fallbacks = true
29
+ config.action_mailer.default_url_options = { :host => 'yourhost.com' }
30
+ ### ActionMailer Config
31
+ # Setup for production - deliveries, no errors raised
32
+ config.action_mailer.delivery_method = :smtp
33
+ config.action_mailer.perform_deliveries = true
34
+ config.action_mailer.raise_delivery_errors = false
35
+ config.action_mailer.default :charset => "utf-8"
36
+ RUBY
37
+ end
38
+
39
+ run 'rails generate devise User'
40
+ run 'rm app/models/user.rb'
41
+
42
+ create_file 'app/models/user.rb' do
43
+ <<-RUBY
44
+ class User < ActiveRecord::Base
45
+ devise :database_authenticatable, :token_authenticatable, :recoverable, :rememberable, :trackable, :confirmable
46
+ default_scope :conditions => { :deleted_at => nil }
47
+ validates_presence_of :name, :email
48
+ validates_presence_of :password, :on => :create
49
+ validates_confirmation_of :password, :on => :create
50
+ validates_length_of :password, :within => 6..30, :allow_blank => true
51
+ validates_uniqueness_of :email, :case_sensitive => false, :scope => :deleted_at
52
+ validates_format_of :email, :with => Devise::email_regexp
53
+
54
+ attr_accessible :name, :email, :password, :password_confirmation, :remember_me
55
+
56
+ def destroy
57
+ self.update_attribute(:deleted_at, Time.now.utc)
58
+ end
59
+
60
+ def self.find_with_destroyed *args
61
+ self.with_exclusive_scope { find(*args) }
62
+ end
63
+
64
+ def self.find_only_destroyed
65
+ self.with_exclusive_scope :find => { :conditions => "deleted_at IS NOT NULL" } do
66
+ all
67
+ end
68
+ end
69
+
70
+ end
71
+ RUBY
72
+ end
73
+
74
+ generate(:migration, "AddNameToUsers name:string")
75
+ generate(:migration, "AddCachedSlugToUsers cached_slug:string")
76
+ generate(:migration, "AddDeletedAtToUsers deleted_at:datetime")
77
+
78
+ devise_migration = Dir['db/migrate/*_devise_create_users.rb'].first
79
+
80
+ gsub_file devise_migration, /# t.confirmable/, 't.confirmable'
81
+ gsub_file devise_migration, /# t.token_authenticatable/, 't.token_authenticatable'
82
+ gsub_file devise_migration, /# add_index :users, :confirmation_token, :unique => true/, 'add_index :users, :confirmation_token, :unique => true'
83
+
84
+ append_file 'db/seeds.rb' do
85
+ <<-FILE
86
+ # Setup initial user so we can get in
87
+ user = User.create! :name => "Thomas Symborski", :email => "thomas.symborski@gmail.com", :password => "password!", :password_confirmation => "password!"
88
+ user.confirmed_at = user.confirmation_sent_at
89
+ user.save
90
+ FILE
91
+ end
@@ -0,0 +1 @@
1
+ run 'rails generate friendly_id'
@@ -0,0 +1,29 @@
1
+ run 'rm Gemfile'
2
+ create_file 'Gemfile', "source 'http://rubygems.org'\n"
3
+ gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => '3-1-stable'
4
+ gem "sqlite3-ruby", :require => "sqlite3"
5
+ gem 'devise'
6
+ gem 'cancan'
7
+ gem "friendly_id", "~> 3.3.0.alpha2"
8
+ gem "will_paginate"
9
+ gem "haml"
10
+ gem "haml-rails"
11
+ gem "rails3-generators", :group => :development
12
+ gem "rspec-rails", :group => [:test, :development]
13
+ gem "shoulda-matchers", :group => [:test, :development]
14
+ gem "factory_girl_rails", :group => :test
15
+ gem "autotest", :group => :test
16
+ gem "autotest-rails", :group => :test
17
+ gem "thin", :group => [:test, :development]
18
+ gem "capybara", :group => :test
19
+ gem 'sass-rails', "~> 3.1.0.rc"
20
+ gem 'coffee-script'
21
+ gem 'uglifier'
22
+ gem 'jquery-rails'
23
+ gem 'stamp'
24
+ gem 'awesome_print'
25
+ gem 'pry'
26
+ gem 'launchy', :group => :test
27
+ gem 'webmock'
28
+ gem 'vcr'
29
+ run 'bundle install'
@@ -0,0 +1,7 @@
1
+ inject_into_file 'config/application.rb', :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do
2
+ <<-RUBY
3
+ config.generators do |g|
4
+ g.template_engine :haml
5
+ end
6
+ RUBY
7
+ end
@@ -0,0 +1,10 @@
1
+ generate(:controller, "home index")
2
+
3
+ remove_file 'app/views/home/index.html.haml'
4
+ create_file 'app/views/home/index.html.haml' do
5
+ <<-FILE
6
+ %h1 #{app_name.humanize}
7
+ FILE
8
+ end
9
+
10
+ route("root :to => 'home#index'")
@@ -0,0 +1,24 @@
1
+ initializer('accessible_attributes.rb') do
2
+ <<-'FILE'
3
+ class ActiveRecord::Base
4
+ attr_accessible
5
+ attr_accessor :accessible
6
+
7
+ private
8
+
9
+ def mass_assignment_authorizer
10
+ if accessible == :all
11
+ self.class.protected_attributes
12
+ else
13
+ super + (accessible || [])
14
+ end
15
+ end
16
+ end
17
+ FILE
18
+ end
19
+
20
+ initializer('haml.rb') do
21
+ <<-'FILE'
22
+ Haml::Template.options[:format] = :html5
23
+ FILE
24
+ end
@@ -0,0 +1,11 @@
1
+ run 'rm public/index.html'
2
+ run 'rm README'
3
+ run 'rm public/favicon.ico'
4
+ get "http://zsiec.ch/favicon.ico", "public/favicon.ico"
5
+
6
+ create_file 'README.md' do
7
+ <<-FILE
8
+ #{app_name.humanize}
9
+ ===========
10
+ FILE
11
+ end
@@ -0,0 +1,3 @@
1
+ run 'rm -rf spec/views/*'
2
+ run 'rm -rf spec/models/*'
3
+ run 'rm -rf spec/helpers/*'
@@ -0,0 +1,11 @@
1
+ run 'rails generate rspec:install'
2
+
3
+ inject_into_file 'config/application.rb', :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do
4
+ <<-RUBY
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ end
8
+ RUBY
9
+ end
10
+
11
+ run 'mkdir spec/factories'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gypsum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2156292680 !ruby/object:Gem::Requirement
16
+ requirement: &2157521360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0.rc6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156292680
24
+ version_requirements: *2157521360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &2156440920 !ruby/object:Gem::Requirement
27
+ requirement: &2157520880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.14.6
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2156440920
35
+ version_requirements: *2157520880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &2156493820 !ruby/object:Gem::Requirement
38
+ requirement: &2157520400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.0.rc6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2156493820
46
+ version_requirements: *2157520400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &2156545700 !ruby/object:Gem::Requirement
49
+ requirement: &2157519800 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.12
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2156545700
57
+ version_requirements: *2157519800
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &2156953160 !ruby/object:Gem::Requirement
60
+ requirement: &2157519300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2156953160
68
+ version_requirements: *2157519300
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &2157151600 !ruby/object:Gem::Requirement
71
+ requirement: &2157518880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2157151600
79
+ version_requirements: *2157518880
80
80
  description: Generate a Rails 3.1 app with application templates.
81
81
  email:
82
82
  - question@wearetitans.net
@@ -85,7 +85,33 @@ executables:
85
85
  extensions: []
86
86
  extra_rdoc_files: []
87
87
  files:
88
+ - .gitignore
89
+ - Gemfile
90
+ - Gemfile.lock
91
+ - LICENSE
92
+ - Rakefile
88
93
  - bin/gypsum
94
+ - gypsum.gemspec
95
+ - lib/gypsum.rb
96
+ - lib/gypsum/cli.rb
97
+ - lib/gypsum/errors.rb
98
+ - lib/gypsum/template_runner.rb
99
+ - lib/gypsum/version.rb
100
+ - templates/default/bootstrap.rb
101
+ - templates/default/default.rb
102
+ - templates/default/lib/cancan.rb
103
+ - templates/default/lib/clean_routes.rb
104
+ - templates/default/lib/db.rb
105
+ - templates/default/lib/db_seed.rb
106
+ - templates/default/lib/devise.rb
107
+ - templates/default/lib/friendly_id.rb
108
+ - templates/default/lib/gemfile.rb
109
+ - templates/default/lib/haml_generator.rb
110
+ - templates/default/lib/home_controller.rb
111
+ - templates/default/lib/initializers.rb
112
+ - templates/default/lib/rails_clean.rb
113
+ - templates/default/lib/rspec_clean.rb
114
+ - templates/default/lib/test_suite.rb
89
115
  homepage: http://www.wearetitans.net
90
116
  licenses: []
91
117
  post_install_message: