Class: LogicalConstruct::BuildFiles

Inherits:
Mattock::TaskLib
  • Object
show all
Includes:
Mattock::CommandLineDSL
Defined in:
lib/logical-construct/ground-control/setup/build-files.rb

Instance Method Summary collapse

Instance Method Details

#default_configuration(parent) ⇒ Object



47
48
49
50
51
# File 'lib/logical-construct/ground-control/setup/build-files.rb', line 47

def default_configuration(parent)
  super
  parent.copy_settings_to(self)
  self.platform = parent.proxy_value.platform
end

#defineObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/logical-construct/ground-control/setup/build-files.rb', line 53

def define
  rakefile = nil
  initd = nil
  in_namespace do
    directory target_dir

    gemfile = ConfigBuilder.new(self) do |task|
      task.base_name = "Gemfile"
    end

    Mattock::BundleCommandTask.new(:standalone => gemfile.target_path) do |bundle_build|
      bundle_build.command = (
        cmd("cd", target_dir) &
        cmd("bundle", "install"){|bundler|
        bundler.options << "--standalone"
        bundler.options << "--binstubs=bin"
      })
    end

    rakefile = ConfigBuilder.new(self) do |task|
      task.base_name = "Rakefile"
    end

    initd = ConfigBuilder.new(self) do |task|
      task.base_name = "construct.init.d"
      task.extra[:construct_dir] = construct_dir
      task.extra[:platform] = platform
    end
  end
  desc "Template files to be created on the remote server"
  task root_task => [rakefile.target_path] + in_namespace(:standalone)
  task root_task => [initd.target_path] + in_namespace(:standalone)
  task :local_setup => root_task
end