Class: SCV::CLI
- Inherits:
-
Thor
- Object
- Thor
- SCV::CLI
- Includes:
- Rails::Generators::Actions, Thor::Actions
- Defined in:
- lib/scv/cli.rb
Instance Method Summary collapse
Instance Method Details
#bootstrap ⇒ Object
14 15 16 17 18 |
# File 'lib/scv/cli.rb', line 14 def bootstrap invoke :config, [], :force => true invoke :db, [], :seed => false invoke :populate, :truncate => false end |
#config ⇒ Object
27 28 29 30 |
# File 'lib/scv/cli.rb', line 27 def config source_paths.push(destination_root = ".") directory("config/examples", "config") end |
#db ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/scv/cli.rb', line 35 def db rake([].tap do |commands| commands.push "db:drop" if .drop? commands.push "db:create" commands.push "db:migrate" commands.push "db:seed" if .seed? commands.push "db:test:prepare" end.join(" ")) end |
#populate ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/scv/cli.rb', line 47 def populate log :load, "environment" require './config/environment' if .truncate? log :truncate, "database" DatabaseCleaner.clean_with(:truncation) end load_seed_file("db/seeds.rb") load_seed_file("db/populate.rb") end |
#reset ⇒ Object
21 22 23 24 |
# File 'lib/scv/cli.rb', line 21 def reset invoke :db, [], :drop => true, :seed => false invoke :populate, [], :truncate => false end |