class Syndi::Jewel::Specification

A specification for an Syndi jewel (i.e. plugin, extension, etc.).

@!attribute name

Attributes

authors[R]
bundle[R]
code_files[R]
doc_files[R]
install_do[R]
name[R]
our_dir[R]
post_message[R]
syndi_version[R]
version[R]

Public Class Methods

new(file) { |self| ... } click to toggle source

Construct a new specification.

@param [String] file The value of +__FILE__+ as accessed from the spec itself.

# File lib/syndi/jewel/specification.rb, line 32
def initialize file
  @name         = nil
  @version      = nil
  @authors      = []
  @syndi_version = nil
  @our_dir      = File.expand_path('..', file)
  @bundle       = 'Gemfile'
  @code_files   = []
  @doc_files    = []
  @post_message = nil

  @install_do = proc { nil }

  # Yield to block for configuration.
  yield self

  # Initiate installation.
  install
end

Public Instance Methods

author=(its_a_trap) click to toggle source

Sets the jewel author (only one).

@param [String] its_a_trap The (sole) author of the jewel.

# File lib/syndi/jewel/specification.rb, line 76
def author= its_a_trap
  raise JewelError, 'Invalid jewel author!' unless its_a_trap.instance_of? String

  @authors.push its_a_trap
  omg "Jewel written by #{its_a_trap.blue}"
end
authors=(*chi) click to toggle source

Sets multiple jewel authors.

@param [Array] chi The authors of the jewel. (splat)

# File lib/syndi/jewel/specification.rb, line 86
def authors= *chi
  raise JewelError, 'Invalid jewel author list!'              unless chi.instance_of? Array
  raise JewelError, 'Invalid method of author specification!' unless chi.length > 1

  @authors = chi
  omg "Jewel written by #{chi.join ', '}"
end
bundle=(sephora = 'Gemfile') click to toggle source

Sets the name of the GemBundler Gemfile. Default is Gemfile.

@param [String] sephora The name of the Gemfile.

# File lib/syndi/jewel/specification.rb, line 109
def bundle= sephora = 'Gemfile'
  raise JewelError, "Jewel's Gemfile is missing!" unless File.exists? File.join(@our_dir, sephora)

  @bundle = sephora
end
name=(monkey) click to toggle source

Sets the jewel name.

@param [String] monkey The name of the jewel.

# File lib/syndi/jewel/specification.rb, line 55
def name= monkey
  raise JewelError, 'Invalid jewel name!' unless monkey.instance_of? String
  monkey.downcase!
  
  @name = monkey
  omg "Jewel name: #{monkey.green}"
end
omg(*args) click to toggle source
# File lib/syndi/jewel/specification.rb, line 23
def omg *args
  args.each do |unicorn|
    puts "==> #{unicorn}".magenta
  end
end
syndi_version=(essie) click to toggle source

Sets the Syndi version required by the jewel.

@param [String] essie The minimum Syndi version required.

# File lib/syndi/jewel/specification.rb, line 97
def syndi_version= essie
  if Gem::Version.new(essie.dup) < Gem::Version.new(Syndi::VERSION.dup)
    raise JewelError, "This jewel requires Syndi version >= #{essie.red} but current version is #{Syndi::VERSION}!"
  end

  @syndi_version = essie
  omg "Jewel is compatible with your version of Syndi (requires: >= #{essie.green})!"
end
version=(mascara) click to toggle source

Sets the jewel version.

@param [String] mascara The version of the jewel.

# File lib/syndi/jewel/specification.rb, line 66
def version= mascara
  mascara.downcase!

  @version = mascara
  omg "Jewel version: #{mascara.green}"
end