whtt-eric-beet 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +12 -0
- data/Gemfile.lock +25 -0
- data/LICENSE +20 -0
- data/README.rdoc +13 -0
- data/Rakefile +59 -0
- data/TODO +25 -0
- data/VERSION +1 -0
- data/bin/beet +114 -0
- data/features/generating.feature +24 -0
- data/features/step_definitions/beet_steps.rb +7 -0
- data/features/step_definitions/common_steps.rb +172 -0
- data/features/support/common.rb +33 -0
- data/features/support/env.rb +25 -0
- data/lib/beet.rb +13 -0
- data/lib/beet/capistrano.rb +14 -0
- data/lib/beet/command_execution.rb +56 -0
- data/lib/beet/executor.rb +236 -0
- data/lib/beet/file_system.rb +163 -0
- data/lib/beet/files/swfupload/images/cancelbutton.gif +0 -0
- data/lib/beet/files/swfupload/images/header-bg.jpg +0 -0
- data/lib/beet/files/swfupload/images/logo.gif +0 -0
- data/lib/beet/files/swfupload/js/handlers.js +290 -0
- data/lib/beet/gem_location_map.rb +65 -0
- data/lib/beet/interaction.rb +47 -0
- data/lib/beet/logger.rb +44 -0
- data/lib/beet/rails.rb +175 -0
- data/lib/beet/recipes/passenger/vhost.rb +17 -0
- data/lib/beet/recipes/rack/middleware.rb +17 -0
- data/lib/beet/recipes/rails/auth/authlogic.rb +302 -0
- data/lib/beet/recipes/rails/auth/clearance.rb +22 -0
- data/lib/beet/recipes/rails/auth/devise.rb +22 -0
- data/lib/beet/recipes/rails/clean_files.rb +4 -0
- data/lib/beet/recipes/rails/cms/bcms_blog.rb +21 -0
- data/lib/beet/recipes/rails/cms/bcms_event.rb +24 -0
- data/lib/beet/recipes/rails/css/blueprint.rb +5 -0
- data/lib/beet/recipes/rails/css/compass.rb +35 -0
- data/lib/beet/recipes/rails/css/nifty_layout.rb +5 -0
- data/lib/beet/recipes/rails/css/reset.rb +10 -0
- data/lib/beet/recipes/rails/db/mongo.rb +57 -0
- data/lib/beet/recipes/rails/db/mysql.rb +47 -0
- data/lib/beet/recipes/rails/db/postgres.rb +52 -0
- data/lib/beet/recipes/rails/git.rb +23 -0
- data/lib/beet/recipes/rails/jquery.rb +11 -0
- data/lib/beet/recipes/rails/swfupload.rb +305 -0
- data/lib/beet/recipes/rails/testing/rspec.rb +3 -0
- data/lib/beet/recipes/rails/testing/shoulda.rb +1 -0
- data/lib/beet/recipes/rails3/admin_interface/active_scaffold.rb +10 -0
- data/lib/beet/recipes/rails3/admin_interface/rails_admin.rb +9 -0
- data/lib/beet/recipes/rails3/auth/devise.rb +17 -0
- data/lib/beet/recipes/rails3/clean_files.rb +3 -0
- data/lib/beet/recipes/rails3/css/boilerplate.rb +41 -0
- data/lib/beet/recipes/rails3/css/reset.rb +10 -0
- data/lib/beet/recipes/rails3/css/sass.rb +3 -0
- data/lib/beet/recipes/rails3/db/mysql.rb +35 -0
- data/lib/beet/recipes/rails3/file_uploads/paperclip.rb +29 -0
- data/lib/beet/recipes/rails3/git.rb +16 -0
- data/lib/beet/recipes/rails3/jammit.rb +26 -0
- data/lib/beet/recipes/rails3/js/jquery.rb +12 -0
- data/lib/beet/recipes/rails3/markup/haml.rb +3 -0
- data/lib/beet/recipes/rails3/testing/cucumber.rb +19 -0
- data/lib/beet/recipes/rails3/testing/rspec.rb +40 -0
- data/lib/beet/recipes/standalone/hades.rb +61 -0
- data/lib/beet/recipes/system/rvmrc.rb +15 -0
- data/lib/beet/scm.rb +36 -0
- data/lib/beet/scm/git.rb +15 -0
- data/lib/beet/scm/svn.rb +5 -0
- data/lib/beet/template_location_map.rb +15 -0
- data/test/executor_test.rb +24 -0
- data/test/file_system_test.rb +59 -0
- data/test/test_helper.rb +12 -0
- data/whtt-eric-beet.gemspec +120 -0
- metadata +203 -0
@@ -0,0 +1 @@
|
|
1
|
+
gem 'thoughtbot-shoulda', :lib => 'shoulda', :source => 'http://gems.github.com'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
gem 'devise'
|
2
|
+
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
|
3
|
+
|
4
|
+
rvm "bundle update"
|
5
|
+
|
6
|
+
model_name = ask "What is the name of your Devise model? (e.g. User, Admin)"
|
7
|
+
model_name = "User" if model_name.empty?
|
8
|
+
|
9
|
+
generate "rails_admin:install_admin model_name=#{model_name}"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# this is designed for rails 3
|
2
|
+
gem 'devise', :version => '1.3.4'
|
3
|
+
|
4
|
+
generate "devise:install"
|
5
|
+
|
6
|
+
model_name = ask "What would you like to call your Devise model? (e.g. User, Admin)"
|
7
|
+
model_name = "User" if model_name.empty?
|
8
|
+
|
9
|
+
generate "devise #{model_name}"
|
10
|
+
|
11
|
+
if yes?("Generate Devise views?")
|
12
|
+
generate "devise:views"
|
13
|
+
end
|
14
|
+
|
15
|
+
if yes?("Run migration to create #{model_name} table?")
|
16
|
+
rake "db:migrate"
|
17
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
gem "compass"
|
2
|
+
gem "haml"
|
3
|
+
gem "html5-boilerplate"
|
4
|
+
|
5
|
+
|
6
|
+
say("Compass recommends that you keep your stylesheets in app/stylesheets")
|
7
|
+
say("instead of the Sass default location of public/stylesheets/sass.")
|
8
|
+
css_dir = yes?("Is this OK? (Y/n)") ? "app/stylesheets" : "public/stylesheets/sass"
|
9
|
+
|
10
|
+
say("Compass recommends that you keep your compiled css in public/stylesheets/compiled/")
|
11
|
+
say("instead the Sass default of public/stylesheets/.")
|
12
|
+
say("However, if you're exclusively using Sass, then public/stylesheets/ is recommended.")
|
13
|
+
sass_dir = yes?("Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n)") ? "public/stylesheets/compiled" : "public/stylesheets"
|
14
|
+
|
15
|
+
say("The compass output syntax can be either sass or scss. The default is scss.")
|
16
|
+
syntax = yes?("Use scss output? (Y/n)") ? "scss" : "sass"
|
17
|
+
|
18
|
+
framework = ask("Which Compass framework would you like to use (default: blueprint)?")
|
19
|
+
framework = 'blueprint' if framework.empty?
|
20
|
+
|
21
|
+
|
22
|
+
file 'config/compass.rb', <<-RUBY.gsub(/^ {2}/, '')
|
23
|
+
require 'html5-boilerplate'
|
24
|
+
|
25
|
+
project_type = :rails
|
26
|
+
project_path = Compass::AppIntegration::Rails.root
|
27
|
+
http_path = "/"
|
28
|
+
css_dir = "#{css_dir}"
|
29
|
+
sass_dir = "#{sass_dir}"
|
30
|
+
environment = Compass::AppIntegration::Rails.env
|
31
|
+
|
32
|
+
if Compass::AppIntegration::Rails.env == :development
|
33
|
+
output_style = :nested
|
34
|
+
else
|
35
|
+
output_style = :compressed
|
36
|
+
end
|
37
|
+
RUBY
|
38
|
+
|
39
|
+
rvm "bundle install"
|
40
|
+
|
41
|
+
rvm "compass init rails -r html5-boilerplate -u html5-boilerplate -x #{syntax} --using #{framework} -c config/compass.rb --force"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
reset_file_location = "http://developer.yahoo.com/yui/build/reset/reset.css"
|
2
|
+
unless File.exists?('public/stylesheets/reset.css')
|
3
|
+
begin
|
4
|
+
file "public/stylesheets/reset.css" do
|
5
|
+
open(reset_file_location).read
|
6
|
+
end
|
7
|
+
rescue
|
8
|
+
"Couldn't load #{reset_file_location}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
gem "mysql2"
|
2
|
+
|
3
|
+
rvm "bundle install"
|
4
|
+
|
5
|
+
file 'config/database.yml' do
|
6
|
+
%{
|
7
|
+
---
|
8
|
+
development: &defaults
|
9
|
+
adapter: mysql2
|
10
|
+
encoding: utf8
|
11
|
+
reconnect: false
|
12
|
+
database: #{project_name}_development
|
13
|
+
pool: 5
|
14
|
+
username: root
|
15
|
+
password:
|
16
|
+
|
17
|
+
# Warning: The database defined as "test" will be erased and
|
18
|
+
# re-generated from your development database when you run "rake".
|
19
|
+
# Do not set this db to the same as development or production.
|
20
|
+
test:
|
21
|
+
<<: *defaults
|
22
|
+
database: #{project_name}_test
|
23
|
+
|
24
|
+
production:
|
25
|
+
<<: *defaults
|
26
|
+
database: #{project_name}_production
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
FileUtils.copy "config/database.yml", "config/database.yml.example"
|
31
|
+
|
32
|
+
if yes?("Create databases using rake db:create:all?")
|
33
|
+
rake "db:create:all"
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
gem 'paperclip'
|
2
|
+
|
3
|
+
model_name = ask "Name of the model to add an attachment to, e.g. user_profile"
|
4
|
+
attachment_name = ask "Name for the attached file, e.g. has_attached_file :avatar"
|
5
|
+
underscored_model_name = model_name.underscore
|
6
|
+
|
7
|
+
in_root do
|
8
|
+
if File.exists?("app/models/#{model_name}.rb")
|
9
|
+
table_name = model_name.tableize
|
10
|
+
|
11
|
+
generate "migration add_#{attachment_name}_to_#{table_name}"
|
12
|
+
migration_file = Dir["db/migrate/*add_#{attachment_name}_to_#{table_name}*"].first
|
13
|
+
add_after migration_file, 'def self.up', do
|
14
|
+
%{
|
15
|
+
add_column :#{table_name}, :#{attachment_name}_file_name, :string
|
16
|
+
add_column :#{table_name}, :#{attachment_name}_content_type, :string
|
17
|
+
add_column :#{table_name}, :#{attachment_name}_file_size, :integer
|
18
|
+
add_column :#{table_name}, :#{attachment_name}_updated_at, :datetime
|
19
|
+
}
|
20
|
+
end
|
21
|
+
else
|
22
|
+
generate "model #{model_name} #{attachment_name}_file_name:string #{attachment_name}_content_type:string #{attachment_name}_file_size:integer #{attachment_name}_updated_at:datetime"
|
23
|
+
end
|
24
|
+
|
25
|
+
add_after "app/models/#{underscored_model_name}.rb", "class #{model_name.camelize} < ActiveRecord::Base", "has_attached_file :#{attachment_name}, :styles => { :thumb => '50x' }"
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
rake "db:migrate"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#remove_file '.gitignore'
|
2
|
+
file '.gitignore', <<-CODE.gsub(/^ {2}/, '')
|
3
|
+
.DS_Store
|
4
|
+
.bundle
|
5
|
+
.rvmrc
|
6
|
+
mkmf.log
|
7
|
+
log/*
|
8
|
+
coverage/*
|
9
|
+
tmp/**/*
|
10
|
+
config/database.yml
|
11
|
+
coverage/*
|
12
|
+
CODE
|
13
|
+
|
14
|
+
git :init
|
15
|
+
git :add => "."
|
16
|
+
git :commit => "-m 'Initial commit from Beet. Enjoy.'"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
gem 'jammit', :version => "0.6.0"
|
2
|
+
|
3
|
+
rvm "bundle install"
|
4
|
+
|
5
|
+
in_root do
|
6
|
+
file "config/assets.yml" do
|
7
|
+
%{
|
8
|
+
package_assets: on
|
9
|
+
javascript_compressor: closure
|
10
|
+
|
11
|
+
stylesheets:
|
12
|
+
base:
|
13
|
+
- public/stylesheets/reset.css
|
14
|
+
- public/stylesheets/application.css
|
15
|
+
ie7:
|
16
|
+
- public/stylesheets/ie7.css
|
17
|
+
ie8:
|
18
|
+
- public/stylesheets/ie8.css
|
19
|
+
|
20
|
+
javascripts:
|
21
|
+
application:
|
22
|
+
- public/javascripts/rails.js
|
23
|
+
- public/javascripts/application.js
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
gem "jquery-rails", :version => '1.0'
|
2
|
+
|
3
|
+
rvm "bundle install"
|
4
|
+
|
5
|
+
command = "jquery:install"
|
6
|
+
command += " --ui" if yes?("Include jQuery UI?")
|
7
|
+
|
8
|
+
version = ask "Version of jQuery to install? (default is 1.6)"
|
9
|
+
version = "1.6" if version.empty?
|
10
|
+
command += " --version #{version}"
|
11
|
+
|
12
|
+
generate command
|
@@ -0,0 +1,19 @@
|
|
1
|
+
gem_group [:development, :test] do
|
2
|
+
gem 'capybara', :version => '0.4.1.2'
|
3
|
+
gem 'database_cleaner'
|
4
|
+
gem 'cucumber-rails', :version => '0.4.1'
|
5
|
+
gem 'launchy'
|
6
|
+
gem 'email_spec', :version => '1.1.1'
|
7
|
+
end
|
8
|
+
|
9
|
+
rvm 'bundle install'
|
10
|
+
|
11
|
+
generate 'cucumber:install --capybara'
|
12
|
+
|
13
|
+
in_root do
|
14
|
+
add_after "features/support/env.rb", "require 'cucumber/rails'" do
|
15
|
+
%{require 'email_spec/cucumber}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
generate 'email_spec:steps'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
gem_group [:development, :test] do
|
2
|
+
gem 'rspec-rails', :version => '2.5.0'
|
3
|
+
gem 'shoulda-matchers', :version => '1.0.0.beta2'
|
4
|
+
gem 'mocha', :version => '0.9.12'
|
5
|
+
gem 'factory_girl_rails', :version => '1.0.1'
|
6
|
+
gem 'email_spec', :version => '1.1.1'
|
7
|
+
end
|
8
|
+
|
9
|
+
rvm "bundle install"
|
10
|
+
|
11
|
+
generate "rspec:install"
|
12
|
+
|
13
|
+
in_root do
|
14
|
+
add_after 'config/application.rb', 'class Application < Rails::Application' do
|
15
|
+
%{
|
16
|
+
config.generators do |g|
|
17
|
+
g.test_framework :rspec
|
18
|
+
end
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# mocha config
|
23
|
+
gsub_file "spec/spec_helper.rb", /(config.mock_with :rspec)/, '# \1'
|
24
|
+
gsub_file "spec/spec_helper.rb", /#\s*(config.mock_with :mocha)/, '\1'
|
25
|
+
|
26
|
+
# factory_girl_rails config
|
27
|
+
gsub_file "spec/spec_helper.rb", /(config.fixture_path = "\#\{::Rails.root\}\/spec\/fixtures")/, '# \1'
|
28
|
+
|
29
|
+
# email_spec config
|
30
|
+
add_after "spec/spec_helper.rb", "require 'rspec/rails'" do
|
31
|
+
%{require "email_spec"}
|
32
|
+
end
|
33
|
+
|
34
|
+
add_after "spec/spec_helper.rb", "RSpec.configure do |config|" do
|
35
|
+
%{
|
36
|
+
config.include(EmailSpec::Helpers)
|
37
|
+
config.include(EmailSpec::Matchers)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'active_support/core_ext/string/inflections'
|
3
|
+
|
4
|
+
run "gem install thin" if `which thin` == ''
|
5
|
+
run "gem install jeweler" if `which jeweler` == ''
|
6
|
+
run "gem install sinatra" if `gem list sinatra | grep sinatra` == ''
|
7
|
+
|
8
|
+
name = ask "Project name: "
|
9
|
+
run "jeweler #{name}"
|
10
|
+
|
11
|
+
file "#{name}/bin/#{name}" do
|
12
|
+
%{
|
13
|
+
#!/usr/bin/env ruby
|
14
|
+
|
15
|
+
# #{name} command line interface script.
|
16
|
+
# Run #{name} -h to get more usage.
|
17
|
+
# inspired by Dave Hrycyszyn
|
18
|
+
# http://labs.headlondon.com/2010/07/skinny-daemons/
|
19
|
+
|
20
|
+
require File.expand_path(File.join(*%w[.. .. lib #{name}]), __FILE__)
|
21
|
+
require 'thin'
|
22
|
+
|
23
|
+
rackup_file = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. lib #{name} config.ru]))
|
24
|
+
|
25
|
+
argv = ARGV
|
26
|
+
argv << ["-R", rackup_file] unless ARGV.include?("-R")
|
27
|
+
argv << ["-p", "2003"] unless ARGV.include?("-p")
|
28
|
+
argv << ["-e", "production"] unless ARGV.include?("-e")
|
29
|
+
Thin::Runner.new(argv.flatten).run!
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
FileUtils.chmod 0755, "#{name}/bin/#{name}"
|
34
|
+
|
35
|
+
file "#{name}/lib/#{name}/config.ru" do
|
36
|
+
%{
|
37
|
+
require File.dirname(__FILE__) + '/../#{name}'
|
38
|
+
#{name.camelize}.run! :port => 2003
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
file "#{name}/lib/#{name}.rb" do
|
43
|
+
%{
|
44
|
+
require 'rubygems'
|
45
|
+
require 'sinatra/base'
|
46
|
+
|
47
|
+
class #{name.camelize} < Sinatra::Base
|
48
|
+
# This can display a nice status message.
|
49
|
+
#
|
50
|
+
get "/" do
|
51
|
+
"#{name.titleize} is up and running."
|
52
|
+
end
|
53
|
+
|
54
|
+
# This POST allows your other apps to control the service.
|
55
|
+
#
|
56
|
+
post "/do-something/:great" do
|
57
|
+
# something great could happen here
|
58
|
+
end
|
59
|
+
end
|
60
|
+
}
|
61
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# not sure if it matters, but this recipe should probably be the first in the list to ensure that gems are installed to the correct gemset
|
2
|
+
current_ruby = `rvm list`.match(/=> ([^ ]+)/)[1]
|
3
|
+
desired_ruby = ask "Which rvm Ruby would you like to use? (leave blank to use #{current_ruby})"
|
4
|
+
desired_ruby = current_ruby if desired_ruby.empty?
|
5
|
+
@ruby_version = desired_ruby
|
6
|
+
|
7
|
+
gemset_name = ask "What name should the custom gemset have? (leave empty to use global)"
|
8
|
+
@ruby_version += "@#{gemset_name}" unless gemset_name.empty?
|
9
|
+
|
10
|
+
run "rvm use #{@ruby_version} --create"
|
11
|
+
|
12
|
+
file '.rvmrc', "rvm #{@ruby_version}"
|
13
|
+
run "rvm rvmrc trust"
|
14
|
+
|
15
|
+
run "rvm #{@ruby_version} gem install bundler"
|
data/lib/beet/scm.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Scm
|
2
|
+
|
3
|
+
private
|
4
|
+
|
5
|
+
def self.hash_to_parameters(hash)
|
6
|
+
hash.collect { |key, value| "--#{key} #{(value.kind_of?(String) ? value : "")}"}.join(" ")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
require File.dirname(__FILE__) + '/scm/git'
|
10
|
+
require File.dirname(__FILE__) + '/scm/svn'
|
11
|
+
|
12
|
+
module Beet
|
13
|
+
module SCM
|
14
|
+
# Run a command in git.
|
15
|
+
#
|
16
|
+
# ==== Examples
|
17
|
+
#
|
18
|
+
# git :init
|
19
|
+
# git :add => "this.file that.rb"
|
20
|
+
# git :add => "onefile.rb", :rm => "badfile.cxx"
|
21
|
+
#
|
22
|
+
def git(command = {})
|
23
|
+
in_root do
|
24
|
+
if command.is_a?(Symbol)
|
25
|
+
log 'running', "git #{command}"
|
26
|
+
Git.run(command.to_s)
|
27
|
+
else
|
28
|
+
command.each do |command, options|
|
29
|
+
log 'running', "git #{command} #{options}"
|
30
|
+
Git.run("#{command} #{options}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/beet/scm/git.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class Git < Scm
|
2
|
+
def self.clone(repos, branch=nil)
|
3
|
+
system("git clone #{repos}")
|
4
|
+
|
5
|
+
if branch
|
6
|
+
system("cd #{repos.split('/').last}/")
|
7
|
+
system("git checkout #{branch}")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.run(command)
|
12
|
+
system("git #{command}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|