class Binda::Shopify::InstallGenerator
Attributes
structure[RW]
Public Instance Methods
create_shopify_settings()
click to toggle source
# File lib/generators/binda/shopify/install_generator.rb, line 13 def create_shopify_settings puts "1) Setting up Shopify Connection" @installer = ::Binda::Shopify::Installer.new @settings = {} ::Binda::Shopify::CONNECTION_KEYS.each do |field_name| STDOUT.puts "What is your Shopify #{field_name.to_s.titleize}?" @settings[field_name] = STDIN.gets.strip end ::Binda::Shopify::STRUCTURES.each do |structure_name, structure_fields| default_name = "Shopify #{structure_name.to_s.titleize}" puts "How would you like to name your #{structure_name} structure? ['#{default_name}']" @settings[structure_name] = STDIN.gets.strip.presence || default_name end @settings_board = @installer.create_settings_board @settings puts end
finish()
click to toggle source
# File lib/generators/binda/shopify/install_generator.rb, line 39 def finish puts "Done!" puts end
setup_structures()
click to toggle source
# File lib/generators/binda/shopify/install_generator.rb, line 30 def setup_structures ::Binda::Shopify::STRUCTURES.each.with_index do |(structure_name, structure_fields), index| name = @settings[structure_name].presence || structure_name.to_s.titleize puts "#{index+2}) Setting up #{name} Structure" @installer.create_item_structure structure_name, name puts end end
start()
click to toggle source
# File lib/generators/binda/shopify/install_generator.rb, line 9 def start puts "Ok, let'do this!" end