jackdempsey-beet 0.1.5 → 0.1.6

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.
Files changed (6) hide show
  1. data/TODO +1 -0
  2. data/VERSION +1 -1
  3. data/beet.gemspec +1 -1
  4. data/bin/beet +13 -3
  5. data/lib/beet/executor.rb +26 -16
  6. metadata +1 -1
data/TODO CHANGED
@@ -1,4 +1,5 @@
1
1
  * refactor methods in bin/beet to use each other (lots of duplication between generate and just_recipe
2
+ ( maybe just make generate a boolean option rather than a method )
2
3
  * refactor so you can use template names in the recipe calls along with local paths and remote paths
3
4
 
4
5
  * fixup places where its obviously just rails stuff, like add_gems
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
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.1.5"
5
+ s.version = "0.1.6"
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"]
data/bin/beet CHANGED
@@ -15,6 +15,7 @@ class BeetRunner < Thor
15
15
  map "-h" => :help
16
16
  map "-v" => :version
17
17
  map "-l" => :list
18
+ map "-d" => :display
18
19
  map "--list" => :list
19
20
 
20
21
  desc 'generate [app_name]', "the main app generate method"
@@ -39,10 +40,17 @@ class BeetRunner < Thor
39
40
  recipes = paths.map do |path|
40
41
  Dir.glob(path)
41
42
  end.flatten.compact
42
- puts "Recipes: "
43
+ puts "\nRecipes: (e.g. beet -g app -r rails/git)"
43
44
  pp recipes
44
- puts "Templates: "
45
- pp TEMPLATE_LOCATIONS.values.sort
45
+ puts "\nTemplates: (e.g. beet -g app -t bort)"
46
+ pp TEMPLATE_LOCATIONS.sort.map {|array| array[0] + " => " + array[1]}
47
+ end
48
+
49
+ desc 'display', "Display the code for the recipes/templates"
50
+ method_options :recipes => :optional, :template => :optional
51
+ def display(app_name='.')
52
+ executor = Beet::Executor.new(app_name,options.merge('generate' => false, 'display' => true))
53
+ executor.start
46
54
  end
47
55
 
48
56
  desc 'version', "the current version of beet"
@@ -60,6 +68,8 @@ Usage: #{$0} /path/to/your/app [options]
60
68
 
61
69
  Options:
62
70
  -g, --generate Run the generate command to build a project
71
+ -j, --just_recipe Run the just_recipe command to only run specified recipes, templates, etc.
72
+ -d, --display Instead of running, show the template or recipe body
63
73
 
64
74
  Beet Info:
65
75
  -v, --version Show the Beet version number and quit.
data/lib/beet/executor.rb CHANGED
@@ -25,6 +25,7 @@ module Beet
25
25
  @recipes = []
26
26
  @project_type = options[:project_type]
27
27
  @generate = true unless options[:generate] == false
28
+ @display = options[:display]
28
29
  extract_commands_from_options
29
30
  end
30
31
 
@@ -39,34 +40,43 @@ module Beet
39
40
  end
40
41
  end
41
42
 
42
- case @project_type
43
- when :rails
44
- if @generate
45
- puts "Generating rails project #{project_name}..."
46
- if @options[:template]
47
- system("rails #{project_name} -m #{TEMPLATE_LOCATIONS[options[:template]]}")
48
- else
49
- system("rails #{project_name}")
43
+ if @display
44
+ puts open(TEMPLATE_LOCATIONS[options[:template]]).read
45
+ else
46
+ case @project_type
47
+ when :rails
48
+ if @generate
49
+ puts "Generating rails project #{project_name}..."
50
+ if @options[:template]
51
+ system("rails #{project_name} -m #{TEMPLATE_LOCATIONS[options[:template]]}")
52
+ else
53
+ system("rails #{project_name}")
54
+ end
50
55
  end
51
56
  end
52
- end
53
57
 
54
- run_recipes
55
-
56
- add_gems
58
+ add_gems
57
59
 
58
- print_todo
60
+ print_todo
59
61
 
60
- if @options[:save]
61
- save_run
62
+ if @options[:save]
63
+ save_run
64
+ end
62
65
  end
66
+
67
+ run_recipes
68
+
63
69
  end
64
70
 
65
71
  def run_recipes
66
72
  @recipes.each do |recipe|
67
73
  begin
68
74
  code = open(recipe).read
69
- in_root { self.instance_eval(code) }
75
+ if @display
76
+ puts code
77
+ else
78
+ in_root { self.instance_eval(code) }
79
+ end
70
80
  rescue LoadError, Errno::ENOENT => e
71
81
  raise "The recipe [#{recipe}] could not be loaded. Error: #{e}"
72
82
  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.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey