Sha256: 7e9e46faa4f65fcc0c43c546b5b4566e3cdd69351e0e26a374a12889ca2670a9
Contents?: true
Size: 1.87 KB
Versions: 64
Compression:
Stored size: 1.87 KB
Contents
#!/usr/bin/env ruby require 'rubypitaya' COMMANDS = ['run', 'create', 'create-migration', 'add-plugin'] def main if ARGV.size == 0 || !COMMANDS.include?(ARGV[0]) show_help() exit(-1) end command = ARGV[0] if command == 'run' command_run(ARGV) end if command == 'create' command_create(ARGV) end if command == 'create-migration' command_create_migration(ARGV) end if command == 'add-plugin' command_add_plugin(ARGV) end end def command_run(argv) puts 'Starting server...' RubyPitaya::RubyPitaya.run_server end def command_create(argv) if argv.size <= 1 show_help_create() exit(-1) end project_name = argv[1] folder_path = Dir.pwd RubyPitaya::RubyPitaya.create_project(project_name, folder_path) puts "Project #{project_name} created!" end def command_create_migration(argv) if argv.size <= 1 show_help_create_migration() exit(-1) end migration_name = argv[1] migration_file_name = RubyPitaya::RubyPitaya.create_migration(migration_name) puts "Migration #{migration_file_name} created!" end def command_add_plugin(argv) if argv.size <= 1 show_help_add_plugin() exit(-1) end plugin_git_url = argv[1] branch_name = argv[2] || "" plugin_name = RubyPitaya::RubyPitaya.add_plugin(plugin_git_url, branch_name) puts "Plugin #{plugin_name} added!" end def show_help puts 'Usage: $ rubypitaya [COMMAND]' puts 'COMMAND:' puts ' run: - Run server' puts ' create: - Create project' puts ' create-migration: - Create migration' puts '' end def show_help_create puts 'Usage: $ rubypitaya create [project_name]' puts '' end def show_help_create_migration puts 'Usage: $ rubypitaya create-migration [migration_name]' puts '' end def show_help_add_plugin puts 'Usage: $ rubypitaya add-plugin [plugin_git_link] [branch_name:optional]' puts '' end main
Version data entries
64 entries across 60 versions & 1 rubygems