Top Level Namespace
Instance Method Summary collapse
- #guess_symfony_lib ⇒ Object
- #guess_symfony_orm ⇒ Object
- #load_database_config(data, env) ⇒ Object
- #prompt_with_default(var, default, &block) ⇒ Object
Instance Method Details
#guess_symfony_lib ⇒ Object
36 37 38 39 40 |
# File 'lib/ksymfony1.rb', line 36 def guess_symfony_lib symfony_version = capture("cd #{latest_release} && #{php_bin} ./symfony -V") /\((.*)\)/.match(symfony_version)[1] end |
#guess_symfony_orm ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/ksymfony1.rb', line 26 def guess_symfony_orm databases = YAML::load(IO.read('config/databases.yml')) if databases[symfony_env_local] databases[symfony_env_local].keys[0].to_s else databases['all'].keys[0].to_s end end |
#load_database_config(data, env) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ksymfony1.rb', line 42 def load_database_config(data, env) databases = YAML::load(data) if databases[env] db_param = databases[env][symfony_orm]['param'] else db_param = databases['all'][symfony_orm]['param'] end { 'type' => /(\w+)\:/.match(db_param['dsn'])[1], 'user' => db_param['username'], 'pass' => db_param['password'], 'db' => /dbname=([^;$]+)/.match(db_param['dsn'])[1] } end |
#prompt_with_default(var, default, &block) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/kcapifony.rb', line 10 def prompt_with_default(var, default, &block) set(var) do Capistrano::CLI.ui.ask("#{var} [#{default}] : ", &block) end set var, default if eval("#{var.to_s}.empty?") end |