Module: Piv::Ruby

Includes:
Piv
Defined in:
lib/piv/ruby.rb

Instance Method Summary collapse

Methods included from Piv

#directory, #file, #generate_project, #license

Instance Method Details

#generate_class(*names) ⇒ Object



22
23
24
# File 'lib/piv/ruby.rb', line 22

def generate_class *names
  generate_ruby 'class', names
end

#generate_destroy(*names) ⇒ Object



17
18
19
20
# File 'lib/piv/ruby.rb', line 17

def generate_destroy *names
  rm "lib/#{names.join '/'}.rb"
  rm "spec/#{names.join '/'}_spec.rb"
end

#generate_gem(name) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/piv/ruby.rb', line 30

def generate_gem name
  file 'gemspec', %{
Gem::Specification.new do |spec|
spec.name = '#{name}'
spec.version = '0.0.1'
spec.summary = 'SUMMARY'
spec.description = <<-EOF
DESCRIPTION
EOF
spec.authors << 'YOUR NAME'
spec.email = 'YOUR EMAIL'
spec.homepage = 'http://HOMEPAGE'
spec.files = Dir['lib/**/*'] + Dir['spec/**/*'] + Dir['bin/*'] + ['README.rdoc', 'MIT-LICENSE', 'HISTORY.rdoc', 'Rakefile', '.gemtest']
spec.executables << 'EXECUTABLE'

spec.add_development_dependency 'rake', '~>0.8'
spec.add_development_dependency 'gemesis', '~>0'
spec.add_development_dependency 'rspec', '~>2'
end
}

end

#generate_init(*ignored) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/piv/ruby.rb', line 6

def generate_init *ignored
  directory 'lib'
  directory 'spec'
  file '.gemtest'
  file 'Rakefile'
  file 'Gemfile'
  file 'README.rdoc'
  file 'HISTORY.rdoc'
  file 'MIT-LICENSE', license
end

#generate_module(*names) ⇒ Object



26
27
28
# File 'lib/piv/ruby.rb', line 26

def generate_module *names
  generate_ruby 'module', names
end