beet 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -4,10 +4,6 @@ Beet is a simple project generator, with its roots and underlying infrastructure
4
4
 
5
5
  Please visit the homepage to learn more: http://jackdempsey.github.com/beet
6
6
 
7
- = How to
8
- to work with ruby 1.9 recommend to use wycats-thor
9
- example: beet -g new_app --recipes rails/jquery,rails/authlogic,rails/git
10
-
11
7
  == Copyright
12
8
 
13
9
  Copyright (c) 2009 Jack Dempsey. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/beet.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beet}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jack Dempsey"]
12
- s.date = %q{2009-11-03}
12
+ s.date = %q{2009-11-16}
13
13
  s.default_executable = %q{beet}
14
14
  s.email = %q{jack.dempsey@gmail.com}
15
15
  s.executables = ["beet"]
@@ -37,14 +37,25 @@ Gem::Specification.new do |s|
37
37
  "lib/beet/executor.rb",
38
38
  "lib/beet/file_system.rb",
39
39
  "lib/beet/gem_location_map.rb",
40
+ "lib/beet/generators.rb",
41
+ "lib/beet/generators/app_container.rb",
42
+ "lib/beet/generators/base.rb",
43
+ "lib/beet/generators/templates/app_container/%stack_name%/%stack_name%.rb.tt",
44
+ "lib/beet/generators/templates/app_container/%stack_name%/Rakefile.tt",
45
+ "lib/beet/generators/templates/app_container/%stack_name%/config.ru.tt",
46
+ "lib/beet/generators/templates/app_container/%stack_name%/pancake_init.rb.tt",
47
+ "lib/beet/generators/templates/app_container/%stack_name%/public/.empty_directory",
48
+ "lib/beet/generators/templates/app_container/%stack_name%/views/root.html.haml",
40
49
  "lib/beet/interaction.rb",
41
50
  "lib/beet/logger.rb",
42
51
  "lib/beet/rails.rb",
52
+ "lib/beet/recipes/pancake/app_container.rb",
43
53
  "lib/beet/recipes/passenger/vhost.rb",
44
54
  "lib/beet/recipes/rack/middleware.rb",
45
- "lib/beet/recipes/rails/authlogic.rb",
55
+ "lib/beet/recipes/rails/auth/authlogic.rb",
56
+ "lib/beet/recipes/rails/auth/clearance.rb",
57
+ "lib/beet/recipes/rails/auth/devise.rb",
46
58
  "lib/beet/recipes/rails/clean_files.rb",
47
- "lib/beet/recipes/rails/clearance.rb",
48
59
  "lib/beet/recipes/rails/cms/bcms_blog.rb",
49
60
  "lib/beet/recipes/rails/cms/bcms_event.rb",
50
61
  "lib/beet/recipes/rails/css/blueprint.rb",
@@ -53,8 +64,8 @@ Gem::Specification.new do |s|
53
64
  "lib/beet/recipes/rails/db/postgres.rb",
54
65
  "lib/beet/recipes/rails/git.rb",
55
66
  "lib/beet/recipes/rails/jquery.rb",
56
- "lib/beet/recipes/rails/rspec.rb",
57
- "lib/beet/recipes/rails/shoulda.rb",
67
+ "lib/beet/recipes/rails/testing/rspec.rb",
68
+ "lib/beet/recipes/rails/testing/shoulda.rb",
58
69
  "lib/beet/scm.rb",
59
70
  "lib/beet/scm/git.rb",
60
71
  "lib/beet/scm/svn.rb",
data/bin/beet CHANGED
@@ -11,6 +11,9 @@ end
11
11
  $:.unshift(File.dirname(__FILE__) + '/../lib')
12
12
  require 'beet'
13
13
  require 'pp'
14
+ require 'thor/runner'
15
+ require 'beet/generators'
16
+
14
17
 
15
18
  WIN32 = (RUBY_PLATFORM =~ /win32|mingw|bccwin|cygwin/) rescue nil
16
19
  SUDO = (WIN32 || ENV['SUDOLESS']) ? '': 'sudo '
@@ -24,11 +27,19 @@ class BeetRunner < Thor
24
27
  map "-d" => :display
25
28
  map "--list" => :list
26
29
  map "--display" => :display
30
+ map '-x' => :execute
31
+
32
+
33
+ desc "to do some shit", 'xxxx'
34
+ def execute(*args)
35
+ Beet::Generators::Pancake::AppContainer.start
36
+ end
27
37
 
28
38
  desc 'generate [app_name]', "the main app generate method"
29
- method_options %w(recipes -r) => :string, %w(gems) => :string, %w(template -t) => :string, %w(save -s) => :string, %w(use -u) => :string
30
- def generate(app_name, project_type=:rails)
31
- executor = Beet::Executor.new(app_name, options.merge('project_type' => project_type))
39
+ method_options %w(recipes -r) => :string, %w(gems) => :string, %w(template -t) => :string, %w(save -s) => :string, %w(use -u) => :string,
40
+ %w(project_type -p) => :string
41
+ def generate(app_name)
42
+ executor = Beet::Executor.new(app_name, options)
32
43
  executor.start
33
44
  end
34
45
 
@@ -101,6 +112,7 @@ class BeetRunner < Thor
101
112
  }
102
113
  end
103
114
  end
115
+
104
116
  def method_missing(*args)
105
117
  unless @activesupport_required
106
118
  require 'activesupport'
data/lib/beet/executor.rb CHANGED
@@ -24,7 +24,7 @@ module Beet
24
24
  @options = options
25
25
  @todo_items = ''
26
26
  @recipes = []
27
- @project_type = options[:project_type]
27
+ @project_type = options[:project_type] || :rails
28
28
  @generate = true unless options[:generate] == false
29
29
  @display = options[:display]
30
30
  extract_commands_from_options
@@ -76,7 +76,11 @@ module Beet
76
76
  if @display
77
77
  puts code
78
78
  else
79
- in_root { instance_eval(code)}
79
+ if root
80
+ in_root { instance_eval(code)}
81
+ else
82
+ instance_eval(code)
83
+ end
80
84
  end
81
85
  rescue LoadError, Errno::ENOENT => e
82
86
  raise "The recipe [#{recipe}] could not be loaded. Error: #{e}"
@@ -104,15 +108,19 @@ module Beet
104
108
  end
105
109
 
106
110
  def calculate_project_root(project_name)
107
- # if the name looks like ~/projects/foobar then thats the root
108
- if project_name.include?('/')
109
- project_name
110
- # if we're running inside the app, then current dir is it
111
- elsif File.basename(Dir.pwd) == project_name
112
- Dir.pwd
113
- # assume the root is ./project_name
114
- else
115
- File.join(Dir.pwd, project_name)
111
+ # can't assume all project types want a root. Some, like pancake, might generate the root
112
+ # inside the recipe. Need to revisit this, but for now, only set when we're generating rails apps
113
+ if @project_type == :rails
114
+ # if the name looks like ~/projects/foobar then thats the root
115
+ if project_name.include?('/')
116
+ project_name
117
+ # if we're running inside the app, then current dir is it
118
+ elsif File.basename(Dir.pwd) == project_name
119
+ Dir.pwd
120
+ # assume the root is ./project_name
121
+ else
122
+ File.join(Dir.pwd, project_name)
123
+ end
116
124
  end
117
125
  end
118
126
 
@@ -0,0 +1,8 @@
1
+ require 'thor'
2
+ require 'extlib'
3
+
4
+ require File.join(File.dirname(__FILE__), "generators", "base.rb")
5
+
6
+ Dir[File.join(File.dirname(__FILE__), "generators", "*.rb")].each do |f|
7
+ require f unless f == 'base.rb'
8
+ end
@@ -0,0 +1,15 @@
1
+ module Beet
2
+ module Generators
3
+ module Pancake
4
+ class AppContainer < Base
5
+ argument :stack_name, :banner => "Name of stack"
6
+
7
+ desc "Generates a stack"
8
+ def stack
9
+ say "Creating The Stack For #{stack_name}"
10
+ directory "app_container/%stack_name%", stack_name
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ module Beet
2
+ module Generators
3
+ class Base < Thor::Group
4
+ include Thor::Actions
5
+
6
+ def self.source_root
7
+ File.join(File.dirname(__FILE__), "templates")
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ class <%= stack_name.camel_case %> < Pancake::Stacks::Short
2
+ add_root(__FILE__)
3
+
4
+ get "/" do
5
+ render :root
6
+ end
7
+ end
8
+
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'pancake'
4
+
5
+ require File.join(Pancake.get_root(__FILE__), "<%= stack_name %>")
6
+ Pancake.root = Pancake.get_root(__FILE__)
7
+ THIS_STACK = <%= stack_name.camel_case %>
8
+ <%= stack_name.camel_case %>.load_rake_tasks!(:master => true)
9
+
10
+ require 'spec/rake/spectask'
11
+ Spec::Rake::SpecTask.new(:spec) do |spec|
12
+ spec.libs << 'lib' << 'spec'
13
+ spec.spec_files = FileList['spec/**/*_spec.rb']
14
+ end
15
+
16
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
17
+ spec.libs << 'lib' << 'spec'
18
+ spec.pattern = 'spec/**/*_spec.rb'
19
+ spec.rcov = true
20
+ end
21
+
22
+
23
+ task :default => :spec
24
+
25
+ require 'rake/rdoctask'
26
+ Rake::RDocTask.new do |rdoc|
27
+ if File.exist?('VERSION.yml')
28
+ config = YAML.load(File.read('VERSION.yml'))
29
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
30
+ else
31
+ version = ""
32
+ end
33
+
34
+ rdoc.rdoc_dir = 'rdoc'
35
+ rdoc.title = "foo #{version}"
36
+ rdoc.rdoc_files.include('README*')
37
+ rdoc.rdoc_files.include('lib/**/*.rb')
38
+ end
39
+
40
+
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+
3
+ require 'pancake'
4
+ require ::File.join(::File.expand_path(::File.dirname(__FILE__)), "<%= stack_name %>")
5
+
6
+ # get the application to run. The applicadtion in the Pancake.start block
7
+ # is the master application. It will have all requests directed to it through the
8
+ # pancake middleware
9
+ # This should be a very minimal file, but should be used when any stand alone code needs to be included
10
+ app = Pancake.start(:root => Pancake.get_root(__FILE__)){ <%= stack_name.camel_case %>.stackup(:master => true) }
11
+
12
+ run app
@@ -0,0 +1 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__), "<%= stack_name %>"))
@@ -0,0 +1 @@
1
+ run "pancake-gen micro #{project_name}"
@@ -0,0 +1,12 @@
1
+ gem 'warden', :version => '~> 0.5.1'
2
+ gem 'devise', :version => '~> 0.4.1'
3
+
4
+ generate "devise_install"
5
+ generate "devise User"
6
+ generate "devise_views"
7
+
8
+ append_file 'config/environments/development.rb', "\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n"
9
+ append_file 'config/environment.rb', "\nDeviseMailer.sender = 'test@example.com'\n"
10
+ add_after 'config/routes.rb', '# map.root :controller => "welcome"', "\nmap.root :controller => 'home'\n"
11
+
12
+ rake "db:migrate"
@@ -40,3 +40,8 @@ production:
40
40
  end
41
41
 
42
42
  FileUtils.copy "config/database.yml", "config/database.yml.example"
43
+
44
+ if yes?("Create databases using rake db:create:all?")
45
+ rake "db:create:all"
46
+ end
47
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-03 00:00:00 -05:00
12
+ date: 2009-11-16 00:00:00 -05:00
13
13
  default_executable: beet
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -51,14 +51,25 @@ files:
51
51
  - lib/beet/executor.rb
52
52
  - lib/beet/file_system.rb
53
53
  - lib/beet/gem_location_map.rb
54
+ - lib/beet/generators.rb
55
+ - lib/beet/generators/app_container.rb
56
+ - lib/beet/generators/base.rb
57
+ - lib/beet/generators/templates/app_container/%stack_name%/%stack_name%.rb.tt
58
+ - lib/beet/generators/templates/app_container/%stack_name%/Rakefile.tt
59
+ - lib/beet/generators/templates/app_container/%stack_name%/config.ru.tt
60
+ - lib/beet/generators/templates/app_container/%stack_name%/pancake_init.rb.tt
61
+ - lib/beet/generators/templates/app_container/%stack_name%/public/.empty_directory
62
+ - lib/beet/generators/templates/app_container/%stack_name%/views/root.html.haml
54
63
  - lib/beet/interaction.rb
55
64
  - lib/beet/logger.rb
56
65
  - lib/beet/rails.rb
66
+ - lib/beet/recipes/pancake/app_container.rb
57
67
  - lib/beet/recipes/passenger/vhost.rb
58
68
  - lib/beet/recipes/rack/middleware.rb
59
- - lib/beet/recipes/rails/authlogic.rb
69
+ - lib/beet/recipes/rails/auth/authlogic.rb
70
+ - lib/beet/recipes/rails/auth/clearance.rb
71
+ - lib/beet/recipes/rails/auth/devise.rb
60
72
  - lib/beet/recipes/rails/clean_files.rb
61
- - lib/beet/recipes/rails/clearance.rb
62
73
  - lib/beet/recipes/rails/cms/bcms_blog.rb
63
74
  - lib/beet/recipes/rails/cms/bcms_event.rb
64
75
  - lib/beet/recipes/rails/css/blueprint.rb
@@ -67,8 +78,8 @@ files:
67
78
  - lib/beet/recipes/rails/db/postgres.rb
68
79
  - lib/beet/recipes/rails/git.rb
69
80
  - lib/beet/recipes/rails/jquery.rb
70
- - lib/beet/recipes/rails/rspec.rb
71
- - lib/beet/recipes/rails/shoulda.rb
81
+ - lib/beet/recipes/rails/testing/rspec.rb
82
+ - lib/beet/recipes/rails/testing/shoulda.rb
72
83
  - lib/beet/scm.rb
73
84
  - lib/beet/scm/git.rb
74
85
  - lib/beet/scm/svn.rb