Class: Yarg::Rails

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
FileActions
Defined in:
lib/yarg/rails.rb

Overview

Create a task that customizes a Rails project generation bootstrap.

Example (~/.yarg):

Yarg::Rails.new do |rg|
  rg.template "~/.yarg.d/default"
  rg.delete "public/index.html"
  rg.delete "public/dispatch.*"
  rg.plugin "git://github.com/thoughtbot/shoulda.git"
  rg.plugin "git://github.com/nex3/haml.git"
  rg.freeze :version => :edge
end

Instance Attribute Summary collapse

Attributes included from FileActions

#deletions, #scm_module, #templates

Instance Method Summary collapse

Methods included from FileActions

#delete, #initialize_file_actions, #scm, #template

Constructor Details

#initialize(name = :rails) {|_self| ... } ⇒ Rails

Returns a new instance of Rails.

Yields:

  • (_self)

Yield Parameters:

  • _self (Yarg::Rails)

    the object that the method was called on



33
34
35
36
37
38
39
40
# File 'lib/yarg/rails.rb', line 33

def initialize(name = :rails)
  self.name = name
  self.plugins = []
  self.frozen = false
  initialize_file_actions
  yield self if block_given?
  define
end

Instance Attribute Details

#freeze_versionObject

Version to freeze rails if frozen is true. (default is :gems)



31
32
33
# File 'lib/yarg/rails.rb', line 31

def freeze_version
  @freeze_version
end

#frozenObject

True if freezing rails under vendor/rails is desired. (default is false)



28
29
30
# File 'lib/yarg/rails.rb', line 28

def frozen
  @frozen
end

#nameObject

Name of rails generator task. (default is :rails)



22
23
24
# File 'lib/yarg/rails.rb', line 22

def name
  @name
end

#pluginsObject

List of plugins to install. (default is NONE)



25
26
27
# File 'lib/yarg/rails.rb', line 25

def plugins
  @plugins
end

Instance Method Details

#freeze(options = {}) ⇒ Object



46
47
48
49
# File 'lib/yarg/rails.rb', line 46

def freeze(options = {})
  self.frozen = true
  self.freeze_version = options[:version] || :gems
end

#plugin(repository) ⇒ Object



42
43
44
# File 'lib/yarg/rails.rb', line 42

def plugin(repository)
  self.plugins << repository
end