class Soybean::CLI

Public Instance Methods

generate_service(wsdl, dir, options) click to toggle source
# File lib/soybean/cli.rb, line 43
def generate_service(wsdl, dir, options)
  Soybean.cache.clear
  Soybean::Generators::ServiceGenerator.new(dir, wsdl, spec_dir(dir)).generate do |filename, content, generator|
    opts = options
    if generator.is_a? Soybean::Generators::ModelGenerator
      opts = opts.merge(:skip => true, :force => false)
    end
    if opts[:remove]
      remove_file filename, opts
    else
      create_file filename, content, opts
    end
  end
end
service(wsdl, dir) click to toggle source
# File lib/soybean/cli.rb, line 24
def service(wsdl, dir)
  opts = options
  raise 'PATH_TO_WSDL should be a exists wsdl file or directory with wsdl`s' unless File.exists? wsdl
  full_path = File.expand_path wsdl, FileUtils.pwd
  if File.directory? full_path
    Dir["#{full_path}/*.wsdl"].each do |file|
      generate_service(file, dir, opts)
    end
  else
    generate_service(full_path, dir, opts)
  end
end
spec_dir(dir) click to toggle source
# File lib/soybean/cli.rb, line 58
def spec_dir(dir)
  default_spec_dir = "spec/#{dir}"
  if options[:force] || File.exists?(default_spec_dir)
    default_spec_dir
  else
    ask("Spec directory: '#{default_spec_dir}'? ").presence || default_spec_dir
  end
end
types(location, destination = '.') click to toggle source
# File lib/soybean/cli.rb, line 13
def types(location, destination = '.')
  Soybean::Generators::TypesGenerator.new(URI.parse(location)).generate do |filename, content|
    if options[:remove]
      remove_file File.join(destination, filename), options
    else
      create_file File.join(destination, filename), content, options
    end
  end
end
version() click to toggle source
# File lib/soybean/cli.rb, line 38
def version
  puts Soybean::VERSION
end