Class: GemRelease::GemspecTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/gem_release/gemspec_template.rb

Instance Attribute Summary collapse

Attributes inherited from Template

#module_names, #module_path, #name, #template

Instance Method Summary collapse

Methods inherited from Template

#write

Methods included from Helpers

#gem_filename, #gem_name, #gem_name_from_directory, #gem_version, #gemspec, #gemspec_dirs, #gemspec_filename, #github_token, #github_user, #in_bootstrapped_dir, #in_gemspec_dirs, #quiet?, #run_cmd, #user_email, #user_name

Constructor Details

#initialize(options = {}) ⇒ GemspecTemplate

Returns a new instance of GemspecTemplate.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gem_release/gemspec_template.rb', line 5

def initialize(options = {})
  super('gemspec', options)

  @author      ||= user_name
  @email       ||= user_email
  @homepage    ||= "https://github.com/#{github_user}/#{name}" || "[your github name]"

  @summary     ||= 'TODO: summary'
  @description ||= 'TODO: description'

  @strategy = options[:strategy]
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



3
4
5
# File 'lib/gem_release/gemspec_template.rb', line 3

def author
  @author
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/gem_release/gemspec_template.rb', line 3

def description
  @description
end

#emailObject (readonly)

Returns the value of attribute email.



3
4
5
# File 'lib/gem_release/gemspec_template.rb', line 3

def email
  @email
end

#homepageObject (readonly)

Returns the value of attribute homepage.



3
4
5
# File 'lib/gem_release/gemspec_template.rb', line 3

def homepage
  @homepage
end

#strategyObject (readonly)

Returns the value of attribute strategy.



3
4
5
# File 'lib/gem_release/gemspec_template.rb', line 3

def strategy
  @strategy
end

#summaryObject (readonly)

Returns the value of attribute summary.



3
4
5
# File 'lib/gem_release/gemspec_template.rb', line 3

def summary
  @summary
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/gem_release/gemspec_template.rb', line 27

def exists?
  File.exists?(filename)
end

#filenameObject



31
32
33
# File 'lib/gem_release/gemspec_template.rb', line 31

def filename
  "#{name}.gemspec"
end

#filesObject



18
19
20
21
22
23
24
25
# File 'lib/gem_release/gemspec_template.rb', line 18

def files
  case strategy
  when 'git'
    '`git ls-files app lib`.split("\n")'
  else
    'Dir.glob("{lib/**/*,[A-Z]*}")'
  end
end