jackdempsey-beet 0.2.2 → 0.3.0

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/README.rdoc CHANGED
@@ -4,6 +4,10 @@ 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
+
7
11
  == Copyright
8
12
 
9
13
  Copyright (c) 2009 Jack Dempsey. See LICENSE for details.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  gem.email = "jack.dempsey@gmail.com"
10
10
  gem.homepage = "http://github.com/jackdempsey/beet"
11
11
  gem.authors = ["Jack Dempsey"]
12
- gem.add_dependency "thor"
12
+ gem.add_dependency "wycats-thor"
13
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
14
  end
15
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
data/beet.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{beet}
5
- s.version = "0.2.2"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jack Dempsey"]
9
- s.date = %q{2009-07-04}
9
+ s.date = %q{2009-07-18}
10
10
  s.default_executable = %q{beet}
11
11
  s.email = %q{jack.dempsey@gmail.com}
12
12
  s.executables = ["beet"]
@@ -35,11 +35,13 @@ Gem::Specification.new do |s|
35
35
  "lib/beet/recipes/rack/middleware.rb",
36
36
  "lib/beet/recipes/rails/authlogic.rb",
37
37
  "lib/beet/recipes/rails/clean_files.rb",
38
+ "lib/beet/recipes/rails/clearance.rb",
38
39
  "lib/beet/recipes/rails/cms/bcms_blog.rb",
39
40
  "lib/beet/recipes/rails/cms/bcms_event.rb",
40
41
  "lib/beet/recipes/rails/css/blueprint.rb",
41
42
  "lib/beet/recipes/rails/css/reset.rb",
42
43
  "lib/beet/recipes/rails/db/mysql.rb",
44
+ "lib/beet/recipes/rails/db/postgres.rb",
43
45
  "lib/beet/recipes/rails/git.rb",
44
46
  "lib/beet/recipes/rails/jquery.rb",
45
47
  "lib/beet/recipes/rails/rspec.rb",
@@ -68,11 +70,11 @@ Gem::Specification.new do |s|
68
70
  s.specification_version = 3
69
71
 
70
72
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
71
- s.add_runtime_dependency(%q<thor>, [">= 0"])
73
+ s.add_runtime_dependency(%q<wycats-thor>, [">= 0"])
72
74
  else
73
- s.add_dependency(%q<thor>, [">= 0"])
75
+ s.add_dependency(%q<wycats-thor>, [">= 0"])
74
76
  end
75
77
  else
76
- s.add_dependency(%q<thor>, [">= 0"])
78
+ s.add_dependency(%q<wycats-thor>, [">= 0"])
77
79
  end
78
80
  end
data/bin/beet CHANGED
@@ -1,15 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+
3
3
  require 'rubygems'
4
4
  require 'thor'
5
5
  begin
6
- require 'ruby-debug'
6
+ if RUBY_VERSION <= '1.8.6'
7
+ require 'ruby-debug'
8
+ end
7
9
  rescue LoadError
8
10
  end
9
11
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
12
  require 'beet'
11
13
  require 'pp'
12
-
14
+
13
15
  WIN32 = (RUBY_PLATFORM =~ /win32|mingw|bccwin|cygwin/) rescue nil
14
16
  SUDO = (WIN32 || ENV['SUDOLESS']) ? '': 'sudo '
15
17
 
@@ -21,16 +23,17 @@ class BeetRunner < Thor
21
23
  map "-l" => :list
22
24
  map "-d" => :display
23
25
  map "--list" => :list
26
+ map "--display" => :display
24
27
 
25
28
  desc 'generate [app_name]', "the main app generate method"
26
- method_options :recipes => :optional, :gems => :optional, :template => :optional, :save => :optional, :use => :optional
29
+ method_options :recipes => :string, :gems => :string, :template => :string, :save => :string, :use => :string
27
30
  def generate(app_name, project_type=:rails)
28
31
  executor = Beet::Executor.new(app_name, options.merge('project_type' => project_type))
29
32
  executor.start
30
33
  end
31
34
 
32
35
  desc 'just_recipe', "when you just need a recipe"
33
- method_options :recipes => :optional, :gems => :optional, :save => :optional, :use => :optional
36
+ method_options :recipes => :string, :gems => :string, :save => :string, :use => :string
34
37
  def just_recipe(app_name='.')
35
38
  executor = Beet::Executor.new(app_name, options.merge('generate' => false))
36
39
  executor.start
@@ -51,7 +54,7 @@ class BeetRunner < Thor
51
54
  end
52
55
 
53
56
  desc 'display', "Display the code for the recipes/templates"
54
- method_options :recipes => :optional, :template => :optional
57
+ method_options :recipes => :string, :template => :string
55
58
  def display(app_name='.')
56
59
  executor = Beet::Executor.new(app_name,options.merge('generate' => false, 'display' => true))
57
60
  executor.start
@@ -68,30 +71,30 @@ class BeetRunner < Thor
68
71
  desc 'help', 'help output'
69
72
  def help
70
73
  puts %{
71
- Usage: #{$0} /path/to/your/app [options]
74
+ Usage: #{$0} /path/to/your/app [options]
72
75
 
73
- Options:
74
- -g, --generate Run the generate command to build a project
75
- -j, --just_recipe Run the just_recipe command to only run specified recipes, templates, etc.
76
- -d, --display Instead of running, show the template or recipe body
76
+ Options:
77
+ -g, --generate Run the generate command to build a project
78
+ -j, --just_recipe Run the just_recipe command to only run specified recipes, templates, etc.
79
+ -d, --display Instead of running, show the template or recipe body
77
80
 
78
- Beet Info:
79
- -v, --version Show the Beet version number and quit.
80
- -l, --list Show the various recipes known to Beet and quit.
81
- -h, --help Show this help message and quit.
81
+ Beet Info:
82
+ -v, --version Show the Beet version number and quit.
83
+ -l, --list Show the various recipes known to Beet and quit.
84
+ -h, --help Show this help message and quit.
82
85
 
83
- General Options:
86
+ General Options:
84
87
 
85
- Description:
86
- Beet is used to quickly generate applications.
88
+ Description:
89
+ Beet is used to quickly generate applications.
87
90
 
88
- Example:
89
- beet generate example_app --recipes="rails/authlogic, rails/clean_files, rails/git"
90
-
91
- Same thing but shorter:
91
+ Example:
92
+ beet generate example_app --recipes="rails/authlogic, rails/clean_files, rails/git"
92
93
 
93
- beet -g example_app -t=rails/authlogic,rails/clean_files,rails/git
94
- }
94
+ Same thing but shorter:
95
+
96
+ beet -g example_app -r=rails/authlogic,rails/clean_files,rails/git
97
+ }
95
98
  end
96
99
  end
97
100
  def method_missing(*args)
@@ -106,3 +109,4 @@ def method_missing(*args)
106
109
  end
107
110
 
108
111
  BeetRunner.start
112
+
data/lib/beet/executor.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'open-uri'
2
2
  require 'beet/logger'
3
+
3
4
  module Beet
4
5
  class Executor
5
6
  BEET_DATA_FILE = "~/.beet.yml"
@@ -16,7 +17,7 @@ module Beet
16
17
 
17
18
  def initialize(project_name, options={}) # :nodoc:
18
19
  @root = calculate_project_root(project_name)
19
- @project_name = project_name == '.' ? File.basename(Dir.pwd) : project_name
20
+ @project_name = ((project_name == '.') ? File.basename(Dir.pwd) : project_name)
20
21
  @logger = Beet::Logger.new
21
22
  @gems = []
22
23
  @template = options[:template]
@@ -75,7 +76,7 @@ module Beet
75
76
  if @display
76
77
  puts code
77
78
  else
78
- in_root { self.instance_eval(code) }
79
+ in_root { instance_eval(code)}
79
80
  end
80
81
  rescue LoadError, Errno::ENOENT => e
81
82
  raise "The recipe [#{recipe}] could not be loaded. Error: #{e}"
@@ -191,3 +192,4 @@ module Beet
191
192
  end
192
193
  end
193
194
  end
195
+
@@ -1,4 +1,4 @@
1
- file "app/models/user_session.rb" do
1
+ file "app/models/user_session.rb" do
2
2
  %{
3
3
  class UserSession < Authlogic::Session::Base
4
4
  logout_on_timeout true # default is false
@@ -129,11 +129,11 @@ file "app/controllers/users_controller.rb" do
129
129
  class UsersController < ApplicationController
130
130
  before_filter :require_no_user, :only => [:new, :create]
131
131
  before_filter :require_user, :only => [:show, :edit, :update]
132
-
132
+
133
133
  def new
134
134
  @user = User.new
135
135
  end
136
-
136
+
137
137
  def create
138
138
  @user = User.new(params[:user])
139
139
  if @user.save
@@ -143,15 +143,15 @@ class UsersController < ApplicationController
143
143
  render :action => :new
144
144
  end
145
145
  end
146
-
146
+
147
147
  def show
148
148
  @user = @current_user
149
149
  end
150
-
150
+
151
151
  def edit
152
152
  @user = @current_user
153
153
  end
154
-
154
+
155
155
  def update
156
156
  @user = @current_user # makes our views "cleaner" and more consistent
157
157
  if @user.update_attributes(params[:user])
@@ -181,13 +181,13 @@ end
181
181
  file "app/views/users/edit.html.erb" do
182
182
  %{
183
183
  <h1>Edit My Account</h1>
184
-
184
+
185
185
  <% form_for @user, :url => account_path do |f| %>
186
186
  <%= f.error_messages %>
187
187
  <%= render :partial => "form", :object => f %>
188
188
  <%= f.submit "Update" %>
189
189
  <% end %>
190
-
190
+
191
191
  <br /><%= link_to "My Profile", account_path %>
192
192
  }.strip
193
193
  end
@@ -195,7 +195,7 @@ end
195
195
  file "app/views/users/new.html.erb" do
196
196
  %{
197
197
  <h1>Register</h1>
198
-
198
+
199
199
  <% form_for @user, :url => account_path do |f| %>
200
200
  <%= f.error_messages %>
201
201
  <%= render :partial => "form", :object => f %>
@@ -210,46 +210,52 @@ file "app/views/users/show.html.erb" do
210
210
  <b>Email:</b>
211
211
  <%=h @user.email %>
212
212
  </p>
213
-
213
+
214
214
  <p>
215
215
  <b>Login count:</b>
216
216
  <%=h @user.login_count %>
217
217
  </p>
218
-
218
+
219
219
  <p>
220
220
  <b>Last request at:</b>
221
221
  <%=h @user.last_request_at %>
222
222
  </p>
223
-
223
+
224
224
  <p>
225
225
  <b>Last login at:</b>
226
226
  <%=h @user.last_login_at %>
227
227
  </p>
228
-
228
+
229
229
  <p>
230
230
  <b>Current login at:</b>
231
231
  <%=h @user.current_login_at %>
232
232
  </p>
233
-
233
+
234
234
  <p>
235
235
  <b>Last login ip:</b>
236
236
  <%=h @user.last_login_ip %>
237
237
  </p>
238
-
238
+
239
239
  <p>
240
240
  <b>Current login ip:</b>
241
241
  <%=h @user.current_login_ip %>
242
242
  </p>
243
-
244
-
243
+
244
+
245
245
  <%= link_to 'Edit', edit_account_path %>
246
246
  }.strip
247
247
  end
248
248
 
249
249
  # can't rely on internal rails migration generation, so we do it this way
250
+
251
+ #Dir.chdir("script") #for ruby 1.9.2 08/07/2009 . no need for ruby1.9.1p129
252
+ #run "./generate migration beet_authlogic_create_user" # for ruby 1.9.2 08/07/2009. no need for ruby1.9.1p129
253
+
250
254
  run "script/generate migration beet_authlogic_create_user"
251
255
 
252
256
  #now open it
257
+ #Dir.chdir("..") # for ruby 1.9.2 08/07/2009. no need for ruby1.9.1p129
258
+
253
259
  file(Dir.glob('db/migrate/*beet_authlogic_create_user*').first) do
254
260
  %{
255
261
  class BeetAuthlogicCreateUser < ActiveRecord::Migration
@@ -282,8 +288,10 @@ end
282
288
  }.strip
283
289
  end
284
290
 
291
+
285
292
  gem 'authlogic', :version => '~> 2.0.0'
286
293
 
287
294
  rake "gems:install", :sudo => true
288
- rake "db:create:all"
295
+ rake "db:create:all"
289
296
  rake "db:migrate"
297
+
@@ -0,0 +1,22 @@
1
+ gem 'thoughtbot-clearance', :lib => 'clearance',:source => 'http://gems.github.com', :version => '~> 0.6'
2
+ gem 'webrat'
3
+ gem 'cucumber'
4
+ gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => "http://gems.github.com"
5
+
6
+
7
+ rake "gems:install", :sudo => true
8
+ rake "gems:unpack"
9
+ rake "db:create:all"
10
+
11
+ generate "clearance"
12
+ generate "cucumber"
13
+ generate "clearance_features"
14
+ rake "db:migrate"
15
+
16
+ environment "HOST = 'localhost'", :env => "development"
17
+ environment "HOST = 'localhost'", :env => "test"
18
+ environment "DO_NOT_REPLY = \"donotreply@example.com\""
19
+ route "map.root :controller => 'sessions', :action => 'new'"
20
+
21
+ run "cp -fr vendor/gems/thoughtbot-clearance*/app/views app/"
22
+
@@ -0,0 +1,52 @@
1
+ file 'config/database.yml' do
2
+ %{
3
+ # PostgreSQL. Versions 7.4 and 8.x are supported.
4
+ #
5
+ # Install the ruby-postgres driver:
6
+ # gem install pg
7
+ # On Mac OS X:
8
+ # gem install ruby-postgres -- --include=/usr/local/pgsql
9
+ # On Windows:
10
+ # gem install ruby-postgres
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+
14
+ development: &defaults
15
+ adapter: postgresql
16
+ encoding: unicode
17
+ database: #{project_name}_development
18
+ pool: 5
19
+ username: root
20
+ password:
21
+
22
+ # Connect on a TCP socket. Omitted by default since the client uses a
23
+ # domain socket that doesn't need configuration. Windows does not have
24
+ # domain sockets, so uncomment these lines.
25
+ #host: localhost
26
+ #port: 5432
27
+
28
+ # Schema search path. The server defaults to $user,public
29
+ #schema_search_path: myapp,sharedapp,public
30
+
31
+ # Minimum log levels, in increasing order:
32
+ # debug5, debug4, debug3, debug2, debug1,
33
+ # log, notice, warning, error, fatal, and panic
34
+ # The server defaults to notice.
35
+ #min_messages: warning
36
+
37
+
38
+ # Warning: The database defined as "test" will be erased and
39
+ # re-generated from your development database when you run "rake".
40
+ # Do not set this db to the same as development or production.
41
+ test:
42
+ <<: *defaults
43
+ database: #{project_name}_test
44
+
45
+ production:
46
+ <<: *defaults
47
+ database: #{project_name}_production
48
+ }
49
+ end
50
+
51
+ FileUtils.copy "config/database.yml", "config/database.yml.example"
52
+
@@ -1,6 +1,6 @@
1
1
  FileUtils.rm_r Dir.glob("public/javascripts/*.js")
2
2
 
3
- run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js > public/javascripts/jquery.js"
3
+ run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js"
4
4
  run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
5
5
 
6
6
  # Thanks to Chris Wanstrath and Doug Ramsay. The below will make it so that Rails recognizes form requests
data/test/test_helper.rb CHANGED
@@ -5,6 +5,8 @@ require 'shoulda'
5
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
7
  require 'beet'
8
+ if RUBY_VERSION <= '1.8.6'
8
9
  require 'ruby-debug'
10
+ end
9
11
  class Test::Unit::TestCase
10
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackdempsey-beet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-04 00:00:00 -07:00
12
+ date: 2009-07-18 00:00:00 -07:00
13
13
  default_executable: beet
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: thor
16
+ name: wycats-thor
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,11 +52,13 @@ files:
52
52
  - lib/beet/recipes/rack/middleware.rb
53
53
  - lib/beet/recipes/rails/authlogic.rb
54
54
  - lib/beet/recipes/rails/clean_files.rb
55
+ - lib/beet/recipes/rails/clearance.rb
55
56
  - lib/beet/recipes/rails/cms/bcms_blog.rb
56
57
  - lib/beet/recipes/rails/cms/bcms_event.rb
57
58
  - lib/beet/recipes/rails/css/blueprint.rb
58
59
  - lib/beet/recipes/rails/css/reset.rb
59
60
  - lib/beet/recipes/rails/db/mysql.rb
61
+ - lib/beet/recipes/rails/db/postgres.rb
60
62
  - lib/beet/recipes/rails/git.rb
61
63
  - lib/beet/recipes/rails/jquery.rb
62
64
  - lib/beet/recipes/rails/rspec.rb