abaddon 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'abaddon'
3
- s.version = '0.0.1'
4
- s.date = '2011-10-29'
3
+ s.version = '0.0.2'
4
+ s.date = '2011-10-31'
5
5
  s.summary = "Abaddon"
6
- s.description = "A library that creates project structures."
6
+ s.description = "A library that helps creating project templates."
7
7
  s.authors = ["Arturo Puente"]
8
8
  s.email = ["arturopuentevc@gmail.com"]
9
9
  s.homepage = "http://github.com/arturopuente"
@@ -1,32 +1,46 @@
1
1
  module Abaddon
2
+
2
3
  extend self
3
4
 
4
5
  def templates
5
6
  %w[mockup]
6
7
  end
7
8
 
9
+ def load_file(template)
10
+ require "#{File.dirname(__FILE__)}/templates/#{template}.rb"
11
+ end
12
+
8
13
  def load(template)
9
- path = File.dirname(File.expand_path(__FILE__))
10
- require "#{path}/templates/#{template}.rb"
14
+ if templates.include? template
15
+ load_file template
16
+ else
17
+ message :not_found
18
+ end
19
+ end
20
+
21
+ def message(type)
22
+ case type
23
+ when :not_found
24
+ puts "Oops! I can't do that (yet). Available templates are:"
25
+ print_available_templates
26
+ when :blank
27
+ puts "Aviable templates are:"
28
+ print_available_templates
29
+ end
30
+ end
31
+
32
+ def print_available_templates
33
+ templates.each { |s| print s }
34
+ puts
11
35
  end
12
36
 
13
37
  class Runner
14
38
 
15
39
  def initialize(args)
16
40
  if args.size > 0
17
- args.each do |template|
18
- if Abaddon.templates.include? template
19
- Abaddon.load template
20
- else
21
- puts "Oops! I can't do that (yet). Available templates are:"
22
- Abaddon.templates.each { |s| print s }
23
- puts
24
- end
25
- end
41
+ args.each { |template| Abaddon.load template }
26
42
  else
27
- puts "Aviable templates are:"
28
- Abaddon.templates.each { |s| print s }
29
- puts
43
+ Abaddon.message :blank
30
44
  end
31
45
  end
32
46
 
@@ -6,8 +6,7 @@ files = %w[index.html config.rb]
6
6
  directories.each { |d| FileUtils.mkdir "./#{d}" unless File.directory? d }
7
7
  files.each { |f| FileUtils.touch "./#{f}" unless File.exists? f }
8
8
 
9
- path = File.dirname(File.expand_path(__FILE__))
10
- compass_config = File.read "#{path}/../shared/config/compass.rb"
9
+ compass_config = File.read "#{File.dirname(__FILE__)}/../shared/config/compass.rb"
11
10
  filename = "config.rb"
12
11
 
13
12
  if File.exists? filename
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abaddon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-29 00:00:00.000000000Z
12
+ date: 2011-10-31 00:00:00.000000000Z
13
13
  dependencies: []
14
- description: A library that creates project structures.
14
+ description: A library that helps creating project templates.
15
15
  email:
16
16
  - arturopuentevc@gmail.com
17
17
  executables: