moonglum / exogenesis

Build your dotfile installer, updater and teardown
MIT License
19 stars 8 forks source link

Add rake tasks to exogenesis #8

Closed bitboxer closed 10 years ago

bitboxer commented 11 years ago

Instead of letting everyone add their own Rake Tasks, I think it would be better to have the rake tasks defined in exogenesis. What you you think?

bitboxer commented 11 years ago

My proposal:

In your Rakefile:

require "rubygems"
require "exogenesis"

Output.fancy

Exogenesis.register([Dotfile.new, OhMyZSH.new]) 

And than

bundle exec rake exogenesis:install
moonglum commented 11 years ago

Yep, I like the idea of Exogenesis.register :+1: The following solution would be a little bit more rspec-esque (= more "best practice"?):

require "rubygems"
require "exogenesis/raketask"

Exogenesis.board([Dotfile.new, OhMyZSH.new])

Exogenesis::RakeTask.new(:setup) do |setup|
  # Configuration....
end

What do you think? And what do you think of Exogenesis.board instead of register? We're in space!

bitboxer commented 11 years ago

:+1: for board .

For the setup: what exactly do you want to do in there?

moonglum commented 11 years ago

This would add the RakeTask setup calling setup on all but this makes no sense... It doesn't help at all. Sorry for that :laughing:

What do you think about this solution:

require "rubygems"
require "exogenesis"

# Configure the output style
Exogenesis.fancy_output # calls Output.fancy

# Configure the package managers
Exogenesis.board([
  Dotfile.new,
  OhMyZSH.new("moonglum"),
  Homebrew.new(packages["brews"]),
  Vundle.new,
  Rvm.new(packages["rubies"])
])

# Add the Rake tasks `setup`, `install` and `update`
Exogenesis.init_rake_tasks(:setup, :install, :update)
moonglum commented 11 years ago

I'm also thinking about putting all the exogenesis classes into an exogenesis module (as its standard with gems). Then we could write some thing like this:

require "rubygems"
require "exogenesis"

include Exogenesis

# Configure the output style
fancy_output # calls Output.fancy

# Configure the package managers
board([
  Dotfile.new,
  OhMyZSH.new("moonglum"),
  Homebrew.new(packages["brews"]),
  Vundle.new,
  Rvm.new(packages["rubies"])
])

# Add the Rake tasks `setup`, `install` and `update`
init_rake_tasks(:setup, :install, :update)
bitboxer commented 11 years ago

Why should we need to add the Rake tasks manually? Can't they just be automatically added as rake exogenesis:setup ?

moonglum commented 11 years ago

Not exactly sure what you mean. Do you mean why we need a init_rake_task? The reason for that is that if you require exogenesis it should not add anything to your Raketask, because the user may not have rake because he or she created a setup.rb without any Rake. Do you mean why I want to give arguments to the init_rake_tasks? Because a user may not want to install all tasks, but only a few. We could however have the option to give no arguments, which would then just install all tasks.

bitboxer commented 11 years ago

No, I mean that gems can provide their own Rake tasks that you can use in your app. There is no need for manual registering those tasks.

I see no point in only using "setup" and not "uninstall"

moonglum commented 11 years ago

Ok, now I understand :wink: Sounds like a nice idea, because it won't get in the way of people using other tools than Rake. Let's do it.

bitboxer commented 10 years ago

Since you said in #22 that we should use Thor, we should close this one. I prefer Thor, too!

moonglum commented 10 years ago

Yep.