abaddon 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/abaddon.gemspec +8 -4
- data/bin/abaddon +1 -1
- data/lib/abaddon.rb +32 -28
- data/lib/abaddon/help.rb +22 -0
- data/lib/abaddon/helpers/array.rb +5 -0
- data/lib/abaddon/information.rb +12 -0
- data/lib/abaddon/runner.rb +24 -0
- data/lib/templates/mockup/mockup.rb +6 -0
- metadata +19 -5
- data/lib/shared/config/compass.rb +0 -24
- data/lib/templates/mockup.rb +0 -14
data/abaddon.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'abaddon'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.3'
|
4
4
|
s.date = '2011-10-31'
|
5
5
|
s.summary = "Abaddon"
|
6
|
-
s.description = "A
|
6
|
+
s.description = "A gem 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"
|
@@ -11,6 +11,10 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.files =
|
12
12
|
["abaddon.gemspec",
|
13
13
|
"lib/abaddon.rb",
|
14
|
-
"lib/
|
15
|
-
"lib/
|
14
|
+
"lib/abaddon/information.rb",
|
15
|
+
"lib/abaddon/help.rb",
|
16
|
+
"lib/abaddon/runner.rb",
|
17
|
+
"lib/abaddon/helpers/array.rb",
|
18
|
+
"lib/templates/mockup/mockup.rb"]
|
19
|
+
s.add_dependency("compass", ">= 0.11.5")
|
16
20
|
end
|
data/bin/abaddon
CHANGED
data/lib/abaddon.rb
CHANGED
@@ -1,49 +1,53 @@
|
|
1
|
-
|
1
|
+
require_relative "./abaddon/helpers/array"
|
2
2
|
|
3
|
+
module Abaddon
|
4
|
+
|
3
5
|
extend self
|
4
6
|
|
7
|
+
require 'FileUtils'
|
8
|
+
|
5
9
|
def templates
|
6
|
-
|
10
|
+
Dir.new("#{File.dirname(__FILE__)}/templates/").entries.select { |t| t !~ /^\./ }
|
7
11
|
end
|
8
12
|
|
9
|
-
def load_file(template)
|
10
|
-
|
13
|
+
def load_file(template, action)
|
14
|
+
require_relative "./templates/#{template}/#{action}.rb"
|
11
15
|
end
|
12
16
|
|
13
|
-
def load(
|
17
|
+
def load(args)
|
18
|
+
template = args.first
|
19
|
+
action = args.second || template
|
14
20
|
if templates.include? template
|
15
|
-
load_file template
|
21
|
+
load_file template, action
|
22
|
+
true
|
16
23
|
else
|
17
|
-
|
24
|
+
false
|
18
25
|
end
|
19
26
|
end
|
20
27
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
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
|
28
|
+
def create_directories(directories, &block)
|
29
|
+
if block_given?
|
30
|
+
directories = directories.map { |d| block.call d }
|
29
31
|
end
|
32
|
+
directories.each { |d| FileUtils.mkdir "./#{d}" unless File.directory? d or File.file? d }
|
30
33
|
end
|
31
34
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
+
def create_files(files, &block)
|
36
|
+
if block_given?
|
37
|
+
files = files.map { |f| block.call f }
|
38
|
+
end
|
39
|
+
files.each { |f| FileUtils.touch "./#{f}" unless File.directory? f or File.file? f }
|
35
40
|
end
|
36
41
|
|
37
|
-
|
38
|
-
|
39
|
-
def initialize(args)
|
40
|
-
if args.size > 0
|
41
|
-
args.each { |template| Abaddon.load template }
|
42
|
-
else
|
43
|
-
Abaddon.message :blank
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
42
|
+
def create_files_in_dir
|
47
43
|
end
|
48
44
|
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_directories(directories, &block)
|
48
|
+
Abaddon.create_directories(directories, &block)
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_files(files, &block)
|
52
|
+
Abaddon.create_files(files, &block)
|
49
53
|
end
|
data/lib/abaddon/help.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Abaddon
|
2
|
+
|
3
|
+
module Help
|
4
|
+
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def display
|
8
|
+
puts "Welcome to Abaddon. You could use one of the usual commands like"
|
9
|
+
puts "-v or --version"
|
10
|
+
end
|
11
|
+
|
12
|
+
def message(type)
|
13
|
+
case type
|
14
|
+
when :not_found
|
15
|
+
puts "Oops! I can't do that (yet). Available templates are:"
|
16
|
+
Abaddon.templates.each { |s| print s }
|
17
|
+
end
|
18
|
+
puts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative './../abaddon'
|
2
|
+
require_relative './information'
|
3
|
+
require_relative './help'
|
4
|
+
|
5
|
+
module Abaddon
|
6
|
+
|
7
|
+
class Runner
|
8
|
+
|
9
|
+
def initialize(args)
|
10
|
+
case args.first
|
11
|
+
when 'help', '-h', '--help'
|
12
|
+
Abaddon::Help.display
|
13
|
+
when 'version', '-v', '--version'
|
14
|
+
puts Abaddon::Information.version
|
15
|
+
when 'new', 'create'
|
16
|
+
Abaddon::Help.message :not_found unless Abaddon.load args[1..args.size]
|
17
|
+
else
|
18
|
+
Abaddon::Help.display
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
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.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,8 +10,19 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2011-10-31 00:00:00.000000000Z
|
13
|
-
dependencies:
|
14
|
-
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: compass
|
16
|
+
requirement: &70302806840140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.11.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70302806840140
|
25
|
+
description: A gem that helps creating project templates.
|
15
26
|
email:
|
16
27
|
- arturopuentevc@gmail.com
|
17
28
|
executables:
|
@@ -21,8 +32,11 @@ extra_rdoc_files: []
|
|
21
32
|
files:
|
22
33
|
- abaddon.gemspec
|
23
34
|
- lib/abaddon.rb
|
24
|
-
- lib/
|
25
|
-
- lib/
|
35
|
+
- lib/abaddon/information.rb
|
36
|
+
- lib/abaddon/help.rb
|
37
|
+
- lib/abaddon/runner.rb
|
38
|
+
- lib/abaddon/helpers/array.rb
|
39
|
+
- lib/templates/mockup/mockup.rb
|
26
40
|
- bin/abaddon
|
27
41
|
homepage: http://github.com/arturopuente
|
28
42
|
licenses: []
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Require any additional compass plugins here.
|
2
|
-
|
3
|
-
# Set this to the root of your project when deployed:
|
4
|
-
http_path = "/"
|
5
|
-
css_dir = "stylesheets"
|
6
|
-
sass_dir = "sass"
|
7
|
-
images_dir = "images"
|
8
|
-
javascripts_dir = "javascripts"
|
9
|
-
|
10
|
-
# You can select your preferred output style here (can be overridden via the command line):
|
11
|
-
# output_style = :expanded or :nested or :compact or :compressed
|
12
|
-
# output_style = :compressed
|
13
|
-
|
14
|
-
# To enable relative paths to assets via compass helper functions. Uncomment:
|
15
|
-
# relative_assets = true
|
16
|
-
|
17
|
-
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
18
|
-
# line_comments = false
|
19
|
-
|
20
|
-
# If you prefer the indented syntax, you might want to regenerate this
|
21
|
-
# project again passing --syntax sass, or you can uncomment this:
|
22
|
-
# preferred_syntax = :sass
|
23
|
-
# and then run:
|
24
|
-
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
|
data/lib/templates/mockup.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'FileUtils'
|
2
|
-
|
3
|
-
directories = %w[javascripts stylesheets coffeescripts sass]
|
4
|
-
files = %w[index.html config.rb]
|
5
|
-
|
6
|
-
directories.each { |d| FileUtils.mkdir "./#{d}" unless File.directory? d }
|
7
|
-
files.each { |f| FileUtils.touch "./#{f}" unless File.exists? f }
|
8
|
-
|
9
|
-
compass_config = File.read "#{File.dirname(__FILE__)}/../shared/config/compass.rb"
|
10
|
-
filename = "config.rb"
|
11
|
-
|
12
|
-
if File.exists? filename
|
13
|
-
File.open(filename, "w") { |f| f.write compass_config }
|
14
|
-
end
|