class BranchableCDNAssets::RakeTasks

Attributes

file_manager[R]
rake_namespace[R]

Public Class Methods

new(namespace, config) click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 17
def initialize namespace, config
  @file_manager   = FileManager.new config
  @rake_namespace = namespace
end
register(namespace, data={}) click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 10
def register namespace, data={}
  RakeTasks.new( namespace, Config.new(data) ).register_tasks
end

Public Instance Methods

register_move_to_production(task_desc) click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 45
def register_move_to_production task_desc
  in_namespace do
    desc task_desc
    task :move_to_production, :branch do |t,args|
      puts file_manager.with_check(:move_to_production, args[:branch])
    end
  end
end
register_tasks() click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 35
def register_tasks
  tasks.each do |name, desc|
    if self.respond_to?(:"register_#{name}")
      self.send(:"register_#{name}", desc)
    else
      register_task name, desc
    end
  end
end
tasks() click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 22
def tasks
  {
    list:   'list of local files',
    pull!:  'move the current branch\'s remote files to local',
    push!:  'move local files to the current branch\'s remote',
    prune!: 'remove local files with the same name as remote files',
    move_to_production: 'move named branch files to production cdn',
    doctor: 'list file differences between remotes',
    heal:   'pulls then pushes necessary files to make all remotes lists match',
    setup:  'setup dir on remotes'
  }
end

Private Instance Methods

in_namespace() { || ... } click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 56
def in_namespace &block
  namespace rake_namespace do
    yield
  end
end
register_task(task_name, task_desc) click to toggle source
# File lib/branchable_cdn_assets/rake_tasks.rb, line 62
def register_task task_name, task_desc
  in_namespace do
    desc task_desc
    task task_name.to_s.sub('!', '') do
      puts file_manager.public_send( :with_check, task_name )
    end
  end
end