Class: Paperwork::Tasks::Template
- Includes:
- Rake::DSL
- Defined in:
- lib/paperwork/tasks/template.rb
Overview
Task for generating middleman template directory for building
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name, *dependencies) ⇒ Template
constructor
A new instance of Template.
- #tasks ⇒ Object
Methods inherited from Base
#create_tasks, explain, #register, #registered?, #registered_tasks
Constructor Details
#initialize(name, *dependencies) ⇒ Template
Returns a new instance of Template.
17 18 19 20 21 22 23 24 25 |
# File 'lib/paperwork/tasks/template.rb', line 17 def initialize(name, *dependencies) @dir = File.join(Paperwork::Config[:build_root], name.to_s) @bundle = File.join(Paperwork::Config[:build_root], ".bundle") super(self.dir, File.dirname(self.dir), @bundle, *dependencies) BuildDir.new(@bundle) BuildDir.new(File.dirname(self.dir)) @template = File.("middleman_template", __dir__) end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
13 14 15 |
# File 'lib/paperwork/tasks/template.rb', line 13 def dir @dir end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
13 14 15 |
# File 'lib/paperwork/tasks/template.rb', line 13 def template @template end |
Instance Method Details
#tasks ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/paperwork/tasks/template.rb', line 27 def tasks directory self.name => self.dependencies do cp_r template, self.dir Dir.chdir(self.dir) do cmd = "bundle install --path=../.bundle/gems --jobs 8 --without test development" if defined? Bundler Bundler.with_unbundled_env do Process.spawn(cmd, out: :out, in: :in, err: :err) end else Process.spawn(cmd, out: :out, in: :in, err: :err) end Process.spawn("yarn install", out: :out, in: :in, err: :err) Process.waitall end end end |