Skip to content

Instantly share code, notes, and snippets.

@tobscher
Created January 30, 2013 15:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tobscher/4674086 to your computer and use it in GitHub Desktop.
Save tobscher/4674086 to your computer and use it in GitHub Desktop.
Zeus engine setup.
require 'zeus/rails'
ROOT_PATH = File.expand_path(Dir.pwd)
ENV_PATH = File.expand_path('spec/dummy/config/environment', ROOT_PATH)
BOOT_PATH = File.expand_path('spec/dummy/config/boot', ROOT_PATH)
APP_PATH = File.expand_path('spec/dummy/config/application', ROOT_PATH)
ENGINE_ROOT = File.expand_path(Dir.pwd)
ENGINE_PATH = File.expand_path('lib/my_engine/engine', ENGINE_ROOT)
class CustomPlan < Zeus::Rails
end
Zeus.plan = CustomPlan.new
{
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {"rake": []},
"runner": ["r"],
"console": ["c"],
"server": ["s"],
"generate": ["g"],
"destroy": ["d"],
"dbconsole": []
},
"test_environment": {
"test_helper": {"test": ["rspec", "testrb"]}
}
}
}
}
}
@millisami
Copy link

It works, just a little note.

If you see your tests running twice, one pass and another fail in case of passing spec, then you should remove

require 'rspec/autorun'

from your rspec_helper.rb file.

And at line 8 from custom_plan.rb https://gist.github.com/Tobscher/4674086#file-custom_plan-rb-L8 , do rename my_engine with your engine name as well.

@JustinAiken
Copy link

Works for test and generate, but oddly enough, not for destroy:

jaiken@firefly➜ git:(master) git st
# On branch master
nothing to commit, working directory clean
jaiken@firefly➜ git:(master) zeus generate model Foo
      invoke  active_record
      create    db/migrate/20131030000225_create_foos.rb
      create    app/models/foo.rb
      invoke    rspec
      create      spec/models/foo_spec.rb
      invoke      factory_girl
      create        spec/factories/foos.rb
jaiken@firefly➜ git:(master) ✗ zeus destroy model Foo
      invoke  active_record
      remove    migration.rb
      remove    app/models/foo.rb
      invoke    rspec
      remove      spec/models/foo_spec.rb
      invoke      factory_girl
      remove        spec/factories/foos.rb
jaiken@firefly➜ git:(master) ✗ git st
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   app/models/foo.rb
#   db/migrate/20131030000225_create_foos.rb
#   spec/factories/foos.rb
#   spec/models/foo_spec.rb

Still, got me alot zeusy than I was before, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment