Class: Fasta::Installer
- Inherits:
-
Thor
- Object
- Thor
- Fasta::Installer
- Includes:
- Thor::Actions
- Defined in:
- lib/fasta/cli.rb
Constant Summary collapse
- DEFAULT_ACTIONS =
%w[show index create delete patch put].freeze
- DEFAULT_ACTION =
:show
Instance Method Summary collapse
Instance Method Details
#endpoint(name, *actions) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fasta/cli.rb', line 33 def endpoint(name, *actions) normalized_name = name.downcase create_file "./app/endpoints/#{normalized_name}.rb", "module #{normalized_name.capitalize} extend Fasta::Model end " create_file "./app/endpoints/#{normalized_name}/.keep" actions.each do |action| default_action = DEFAULT_ACTIONS.include?(action) build_action(normalized_name, action, default_action) end build_migration(normalized_name) end |
#go ⇒ Object
28 29 30 |
# File 'lib/fasta/cli.rb', line 28 def go exec("puma boot.ru -e #{options[:environment]} -p #{options[:port]}") end |
#plz(name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fasta/cli.rb', line 12 def plz(name) directory 'config', "#{name}/config" create_file "#{name}/app/endpoints/.keep" create_file "#{name}/log/db.log" directory 'app', "#{name}/app" copy_file 'db/migrations/001_create_users_table.rb', "#{name}/db/migrations/001_create_users_table.rb" copy_file 'application.rb', "#{name}/application.rb" copy_file 'boot.ru', "#{name}/boot.ru" copy_file 'Gemfile', "#{name}/Gemfile" copy_file 'Procfile', "#{name}/Procfile" copy_file 'Rakefile', "#{name}/Rakefile" end |