Class: Blazing::Hook

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/blazing/hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ Hook

Returns a new instance of Hook.



10
11
12
13
14
15
# File 'lib/blazing/hook.rb', line 10

def initialize(target)
  @target = target
  @config = target.config
  @options = target.options
  @shell = Blazing::Shell.new
end

Instance Attribute Details

#targetObject

Returns the value of attribute target.



8
9
10
# File 'lib/blazing/hook.rb', line 8

def target
  @target
end

Instance Method Details

#rake_commandObject



22
23
24
25
26
27
28
29
# File 'lib/blazing/hook.rb', line 22

def rake_command
  rake_config = @config.instance_variable_get("@rake") || {}
  rails_env = "RAILS_ENV=#{@options[:rails_env]}" if @options[:rails_env]

  if rake_config[:task]
    "#{rake_config[:env]} #{rails_env} bundle exec rake #{rake_config[:task]}"
  end
end

#setupObject



17
18
19
20
# File 'lib/blazing/hook.rb', line 17

def setup
  prepare_hook
  deploy_hook
end