jackdempsey-beet 0.0.6 → 0.0.7

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
@@ -2,17 +2,17 @@
2
2
 
3
3
  Beet is a simple project/app generator, with its roots and underlying infrastructure heavily influenced from Rails Templates.
4
4
 
5
- Currently Beet will focus on Rails template generation, but there's no reason not to extend it to build out any sort of project.
5
+ Currently Beet will focus on Rails recipes, but there's no reason not to extend it to build out any sort of project.
6
6
  The goal is to have a variety of core level methods to allow for building of higher level concepts that make sense in whatever
7
7
  your project needs.
8
8
 
9
- Eventually I would love to see strategies/templates for sinatra, merb, iPhone apps, etc. The sky is the limit.
9
+ Eventually I would love to see recipes for sinatra, merb, iPhone apps, etc. The sky is the limit.
10
10
 
11
- == Existing Templates
11
+ == Existing Recipes
12
12
 
13
13
  Beet should be compatible with existing rails templates. For instance, to use the daring.rb template, you can run:
14
14
 
15
- beet generate new_daring_project --templates http://github.com/jeremymcanally/rails-templates/raw/10f5bc25e4067968dcf3e950a95538dcbc1f79ed/daring.rb
15
+ beet generate new_daring_project --recipes http://github.com/jeremymcanally/rails-templates/raw/10f5bc25e4067968dcf3e950a95538dcbc1f79ed/daring.rb
16
16
 
17
17
  == Copyright
18
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
data/beet.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{beet}
5
- s.version = "0.0.6"
5
+ s.version = "0.0.7"
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"]
@@ -31,15 +31,16 @@ Gem::Specification.new do |s|
31
31
  "lib/beet/interaction.rb",
32
32
  "lib/beet/logger.rb",
33
33
  "lib/beet/rails.rb",
34
+ "lib/beet/recipes/rails/authlogic.rb",
35
+ "lib/beet/recipes/rails/clean_files.rb",
36
+ "lib/beet/recipes/rails/db/mysql.rb",
37
+ "lib/beet/recipes/rails/git.rb",
38
+ "lib/beet/recipes/rails/jquery.rb",
39
+ "lib/beet/recipes/rails/rspec.rb",
40
+ "lib/beet/recipes/rails/shoulda.rb",
34
41
  "lib/beet/scm.rb",
35
42
  "lib/beet/scm/git.rb",
36
43
  "lib/beet/scm/svn.rb",
37
- "lib/beet/templates/rails/authlogic.rb",
38
- "lib/beet/templates/rails/clean_files.rb",
39
- "lib/beet/templates/rails/db/mysql.rb",
40
- "lib/beet/templates/rails/git.rb",
41
- "lib/beet/templates/rails/jquery.rb",
42
- "lib/beet/templates/rails/rspec.rb",
43
44
  "spec/beet_spec.rb",
44
45
  "spec/spec_helper.rb"
45
46
  ]
data/bin/beet CHANGED
@@ -10,12 +10,13 @@ class BeetRunner < Thor
10
10
  default_task :help
11
11
 
12
12
  map "-g" => :generate
13
+ map "-j" => :just_recipe
13
14
  map "-h" => :help
14
15
  map "-v" => :version
15
16
  map "-l" => :list
16
17
 
17
18
  desc 'generate [app_name]', "the main app generate method"
18
- method_options :templates => :optional, :gems => :optional
19
+ method_options :recipes => :optional, :gems => :optional
19
20
  def generate(app_name, type=:rails)
20
21
  case type
21
22
  when :rails
@@ -28,11 +29,18 @@ class BeetRunner < Thor
28
29
  end
29
30
  end
30
31
 
32
+ desc 'just_recipe', "when you just need a recipe"
33
+ method_options :recipes => :optional, :gems => :optional
34
+ def just_recipe
35
+ executor = Beet::Executor.new('.', options)
36
+ executor.start
37
+ end
38
+
31
39
  desc 'list', "list what recipes beet knows about"
32
40
  def list
33
41
  paths = []
34
- paths << File.dirname(__FILE__) + '/../lib/beet/templates/**/*.rb'
35
- paths << ENV['BEET_TEMPLATES_DIR'] if ENV['BEET_TEMPLATES_DIR']
42
+ paths << File.dirname(__FILE__) + '/../lib/beet/recipes/**/*.rb'
43
+ paths << ENV['BEET_RECIPES_DIR'] if ENV['BEET_RECIPES_DIR']
36
44
  recipes = paths.map do |path|
37
45
  Dir.glob(path)
38
46
  end.flatten.compact
@@ -53,9 +61,11 @@ class BeetRunner < Thor
53
61
  Usage: #{$0} /path/to/your/app [options]
54
62
 
55
63
  Options:
64
+ -g, --generate Run the generate command to build a project
56
65
 
57
66
  Beet Info:
58
67
  -v, --version Show the Beet version number and quit.
68
+ -l, --list Show the various recipes known to Beet and quit.
59
69
  -h, --help Show this help message and quit.
60
70
 
61
71
  General Options:
@@ -64,7 +74,11 @@ Description:
64
74
  Beet is used to quickly generate applications.
65
75
 
66
76
  Example:
67
- beet example_app --git --clean_files
77
+ beet generate example_app --recipes="rails/authlogic, rails/clean_files, rails/git"
78
+
79
+ Same thing but shorter:
80
+
81
+ beet -g example_app -t=rails/authlogic,rails/clean_files,rails/git
68
82
  }
69
83
  end
70
84
  end
data/lib/beet/executor.rb CHANGED
@@ -12,11 +12,11 @@ module Beet
12
12
  include Beet::SCM
13
13
 
14
14
  attr_reader :root, :logger
15
- attr_accessor :templates, :project_name, :gems
15
+ attr_accessor :recipes, :project_name, :gems
16
16
 
17
17
  def initialize(project_name, options) # :nodoc:
18
18
  @root = File.expand_path(File.join(Dir.pwd, project_name))
19
- @project_name = project_name
19
+ @project_name = project_name == '.' ? File.basename(Dir.pwd) : project_name
20
20
  @logger = Beet::Logger.new
21
21
  @gems = []
22
22
  if options[:gems]
@@ -28,28 +28,32 @@ module Beet
28
28
  end
29
29
  end
30
30
  end
31
- @templates = []
32
- if options[:templates]
33
- options[:templates].split(/[\s,]+/).each do |template|
34
- if file = template_location(template)
35
- @templates << file
31
+ @recipes = []
32
+ if options[:recipes]
33
+ options[:recipes].split(/[\s,]+/).each do |recipe|
34
+ if file = recipe_location(recipe)
35
+ @recipes << file
36
36
  end
37
37
  end
38
38
  end
39
39
  end
40
40
 
41
41
  def start
42
- run_templates
42
+ run_recipes
43
43
  add_gems
44
44
  end
45
45
 
46
- def run_templates
47
- @templates.each do |template|
48
- begin
49
- code = open(template).read
50
- in_root { self.instance_eval(code) }
51
- rescue LoadError, Errno::ENOENT => e
52
- raise "The template [#{template}] could not be loaded. Error: #{e}"
46
+ def run_recipes
47
+ if @recipes.empty?
48
+ puts "No recipes found."
49
+ else
50
+ @recipes.each do |recipe|
51
+ begin
52
+ code = open(recipe).read
53
+ in_root { self.instance_eval(code) }
54
+ rescue LoadError, Errno::ENOENT => e
55
+ raise "The recipe [#{recipe}] could not be loaded. Error: #{e}"
56
+ end
53
57
  end
54
58
  end
55
59
  end
@@ -72,15 +76,16 @@ module Beet
72
76
  GEM_LOCATIONS[gem_name]
73
77
  end
74
78
 
75
- def template_location(template)
76
- return template if File.exists?(template) or template.include?('http://')
79
+ def recipe_location(recipe)
80
+ return recipe if File.exists?(recipe) or recipe.include?('http://')
77
81
  locations = []
78
- locations << File.expand_path(ENV['BEET_TEMPLATES_DIR']) if ENV['BEET_TEMPLATES_DIR']
79
- locations << File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
82
+ locations << File.expand_path(ENV['BEET_RECIPES_DIR']) if ENV['BEET_RECIPES_DIR']
83
+ locations << File.expand_path(File.join(File.dirname(__FILE__), 'recipes'))
80
84
  locations.each do |location|
81
- filename = File.join(location, "#{template}.rb")
85
+ filename = File.join(location, "#{recipe}.rb")
82
86
  return filename if File.exists?(filename)
83
87
  end
88
+ nil
84
89
  end
85
90
  end
86
91
  end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ gem 'thoughtbot-shoulda', :lib => 'shoulda', :source => 'http://gems.github.com'
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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey
@@ -48,15 +48,16 @@ files:
48
48
  - lib/beet/interaction.rb
49
49
  - lib/beet/logger.rb
50
50
  - lib/beet/rails.rb
51
+ - lib/beet/recipes/rails/authlogic.rb
52
+ - lib/beet/recipes/rails/clean_files.rb
53
+ - lib/beet/recipes/rails/db/mysql.rb
54
+ - lib/beet/recipes/rails/git.rb
55
+ - lib/beet/recipes/rails/jquery.rb
56
+ - lib/beet/recipes/rails/rspec.rb
57
+ - lib/beet/recipes/rails/shoulda.rb
51
58
  - lib/beet/scm.rb
52
59
  - lib/beet/scm/git.rb
53
60
  - lib/beet/scm/svn.rb
54
- - lib/beet/templates/rails/authlogic.rb
55
- - lib/beet/templates/rails/clean_files.rb
56
- - lib/beet/templates/rails/db/mysql.rb
57
- - lib/beet/templates/rails/git.rb
58
- - lib/beet/templates/rails/jquery.rb
59
- - lib/beet/templates/rails/rspec.rb
60
61
  - spec/beet_spec.rb
61
62
  - spec/spec_helper.rb
62
63
  has_rdoc: false