class Rusic::CLI

Public Instance Methods

deploy(env = nil) click to toggle source
# File lib/rusic/cli.rb, line 19
def deploy(env = nil)
  path = Pathname.new(Dir.pwd)
  files = []

  files << Dir.glob(path.join('{layouts,ideas,pages,participant,snippets,mailers}', '*.liquid'))
  files << Dir.glob(path.join('{reports}', '**/*.liquid'))
  files << Dir.glob(path.join('assets', '*.*'))
  files << Dir.glob(path.join('attributes.{yml,yaml}'))

  files.flatten!
  if options['watch']
    FileWatcher.new(%w[layouts/ ideas/ pages/ assets/ participant/ attributes.yml snippets/ mailers/ reports/]).watch(0.5) do |file, event|
      unless event == :delete
        file = Pathname.new(file).realdirpath.to_s
        deployer = Rusic::Deployer.new(file)
        deployer.upload_files(deploy_options_for(env))
      end
    end
  else
    deployer = Rusic::Deployer.new(files)
    deployer.upload_files(deploy_options_for(env))
  end
end
new(name) click to toggle source
# File lib/rusic/cli.rb, line 9
def new(name)
  Rusic::Generators::Theme.start([name])
end
version() click to toggle source
# File lib/rusic/cli.rb, line 44
def version
  puts Rusic::VERSION
end

Private Instance Methods

deploy_options_for(env) click to toggle source
# File lib/rusic/cli.rb, line 50
def deploy_options_for(env)
  environment_options = options_from_file
  environment_options.merge!(options_from_file.fetch(env, {}))
  Thor::CoreExt::HashWithIndifferentAccess.new(environment_options.merge(options))
end
options_from_file() click to toggle source
# File lib/rusic/cli.rb, line 56
def options_from_file
  config_file = Dir.glob(File.join(Dir.pwd, '.rusic{,.yml,.yaml}')).first
  return {} unless config_file
  ::YAML::load_file(config_file) || {}
end