bin/bs in blade-setting-0.2.1 vs bin/bs in blade-setting-0.2.2
- old
+ new
@@ -14,10 +14,16 @@
prompt = TTY::Prompt.new
prompt.ok("generate complete ! check files now")
exit(0);
end
+def fail()
+ prompt = TTY::Prompt.new
+ prompt.warn("generate failed ! check error above")
+ exit(0);
+end
+
if in_rails_application?
app_path = Dir.pwd + '/config/environment'
require app_path
prompt.ok('Load Rails Application ENV Success!')
else
@@ -30,11 +36,12 @@
menu_result = prompt.collect do
key(:menu).select('select the menu you want to do') do |menu|
menu.choice "Generate yml and setting logic files", 1
menu.choice "Generate Model's crud scaffold", 2
menu.choice "Add graphql base file to your project", 3
- menu.choice "Add Base File for project [response.rb,application.json.jbuilder, application.helper, base_model_concern]", 4
+ menu.choice "Add Doorkeeper Token to project", 4
+ menu.choice "Add Base File for project [response.rb,application.json.jbuilder, application.helper, base_model_concern]", 0
end
end
case menu_result[:menu]
when 1
@@ -63,28 +70,43 @@
prompt.warn('generating yml files ...')
Blade::BladeSetting.generate_setting_yml(result[:yml_path], result[:extra_yml_path], result[:configs])
prompt.ok("generate complete ! check files now")
+
when 2
model_result = prompt.collect do
key(:model_name).ask('enter the model name')
- key(:namespace).ask('enter the controller namespace',default:'api')
+ key(:namespace).ask('enter the controller namespace', default: 'api')
end
ActiveRecord::Base.connection
model = Blade::BladeSetting.get_model(model_result[:model_name].classify)
if (model.blank?)
prompt.error("Model doesn't exist")
exit(0);
end
prompt.warn("generating files ...please don't quit")
- Blade::BladeSetting.generate_model_template(model)
- Blade::BladeSetting.generate_crud(model,model_result[:namespace])
+ Blade::BladeSetting.generate_model_template(model,model_result[:model_name])
+ Blade::BladeSetting.generate_crud(model,model_result[:model_name], model_result[:namespace])
ok();
when 3
when 4
+ token_result = prompt.collect do
+ key(:app_name).ask('Enter the app name', default: 'My app')
+ key(:uri).ask('enter the redirect uri', default: 'localhost:3000')
+ end
+ if (!defined? Doorkeeper)
+ Blade::BladeSetting.generate_gem('doorkeeper')
+ prompt.error('You should install doorkeeper first')
+ else
+ app = Doorkeeper::Application.new(name: token_result[:app_name], redirect_uri: token_result[:uri], scopes: token_result[:uri])
+ app.save!
+ end
+ fail()
+
+when 0
Blade::BladeSetting.generate_base_files
ok();
end