Module: ThemeJuice::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/theme-juice/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path.



11
12
13
# File 'lib/theme-juice/config.rb', line 11

def path
  @path
end

Instance Method Details

#command(cmd, *args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/theme-juice/config.rb', line 13

def command(cmd, *args)
  return if @project.no_config

  args.map { |arg|
    arg.reject! { |a| /^-/ =~ a } if arg.is_a?(Array) }

  commands.fetch("#{cmd}") {
    @io.error "Command '#{cmd}' not found in config", NotImplementedError }
    .each { |c| cmds = format_command(c, *args)
      @env.inside_vm ? run_inside_vm(cmds) : run(cmds) }
rescue NoMethodError
  @io.say "Skipping...", :color => :yellow, :icon => :notice
end

#commandsObject



33
34
35
36
37
# File 'lib/theme-juice/config.rb', line 33

def commands
  config.commands
rescue NoMethodError
  {}
end

#deploymentObject



39
40
41
42
43
# File 'lib/theme-juice/config.rb', line 39

def deployment
  config.deployment
rescue NoMethodError
  @io.error("Deployment settings not found in config", NotImplementedError)
end

#exist?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/theme-juice/config.rb', line 45

def exist?
  !capture { config }.nil?
end

#projectObject



27
28
29
30
31
# File 'lib/theme-juice/config.rb', line 27

def project
  config.project
rescue NoMethodError
  {}
end

#refresh!Object



49
50
51
# File 'lib/theme-juice/config.rb', line 49

def refresh!
  @config = read
end