jenerator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -0
- data/jenerator.gemspec +27 -0
- data/lib/jenerator.rb +30 -0
- data/lib/jenerator/cli.rb +26 -0
- data/lib/jenerator/generators/actions.rb +21 -0
- data/lib/jenerator/generators/component.rb +50 -0
- data/lib/jenerator/generators/templates/joomla2.5/component/admin.php.tt +6 -0
- data/lib/jenerator/generators/templates/joomla2.5/component/manifest.xml.tt +39 -0
- data/lib/jenerator/generators/templates/joomla2.5/component/site.php.tt +6 -0
- metadata +99 -0
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Details
|
2
|
+
|
3
|
+
Jenerator is a dummy/scaffold for generator for Joomla! extensions. It follows a Nooku style structure and generates
|
4
|
+
extensions that can be symlinked automatically using the Nooku Symlinker.
|
5
|
+
|
6
|
+
Currently generates *components* but the rest of the extension types are planned.
|
7
|
+
|
8
|
+
# Installation and Usage
|
9
|
+
|
10
|
+
## Install:
|
11
|
+
|
12
|
+
- `$ gem install jenerator`
|
13
|
+
|
14
|
+
## To list available generators run
|
15
|
+
|
16
|
+
- `$ jenerator`
|
17
|
+
|
18
|
+
## To generate an extension just past a name
|
19
|
+
|
20
|
+
- `$ jenerator component helloworld`
|
21
|
+
|
22
|
+
## To get help for a generator run:
|
23
|
+
|
24
|
+
- `$ jenerator generator_name -h`
|
25
|
+
|
26
|
+
e.g
|
27
|
+
- `$ jenerator component -h`
|
28
|
+
|
29
|
+
# More Docs Coming Soon
|
data/jenerator.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env gem build
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "jenerator"
|
6
|
+
s.rubyforge_project = "jenerator"
|
7
|
+
s.authors = ["Ken Erickson"]
|
8
|
+
s.email = "bookworm.productions@gmail.com"
|
9
|
+
s.summary = "Joomla Generators"
|
10
|
+
s.homepage = "http://github.com/bookworm/jenerator"
|
11
|
+
s.description = "Generators for easily creating dummy/base Joomla! extensions"
|
12
|
+
s.required_rubygems_version = ">= 1.3.6"
|
13
|
+
s.version = '0.0.1'
|
14
|
+
s.date = Time.now.strftime("%Y-%m-%d")
|
15
|
+
|
16
|
+
s.extra_rdoc_files = Dir["*.rdoc"]
|
17
|
+
s.files = `git ls-files`.split("\n") | Dir.glob("{lib}/**/*")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
22
|
+
|
23
|
+
s.add_dependency("bundler", "~> 1.0")
|
24
|
+
s.add_dependency("thor")
|
25
|
+
s.add_dependency("ffaker")
|
26
|
+
s.add_dependency("active_support")
|
27
|
+
end
|
data/lib/jenerator.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'active_support/core_ext'
|
2
|
+
require 'active_support/ordered_hash'
|
3
|
+
require 'ffaker'
|
4
|
+
|
5
|
+
module Jenerator
|
6
|
+
module Generators
|
7
|
+
# Path To Source Folder
|
8
|
+
DEV_PATH = File.expand_path("../../", File.dirname(__FILE__))
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def load_paths
|
12
|
+
@_files ||= []
|
13
|
+
end
|
14
|
+
|
15
|
+
def mappings
|
16
|
+
@_mappings ||= ActiveSupport::OrderedHash.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_generator(name, klass)
|
20
|
+
mappings[name] = klass
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_components!
|
24
|
+
load_paths.flatten.each { |file| require file }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Jenerator::Generators.load_paths << Dir[File.dirname(__FILE__) + '/jenerator/generators/{actions,component}.rb']
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Jenerator
|
4
|
+
class CLI < Thor::Group
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
8
|
+
class_option :help, :type => :boolean, :desc => "Show help usage"
|
9
|
+
|
10
|
+
# Loads the components available for all generators.
|
11
|
+
# @private
|
12
|
+
def setup
|
13
|
+
Jenerator::Generators.load_components!
|
14
|
+
|
15
|
+
generator_kind = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0].present?
|
16
|
+
generator_class = Jenerator::Generators.mappings[generator_kind]
|
17
|
+
|
18
|
+
if generator_class
|
19
|
+
args = ARGV.empty? && generator_class.require_arguments? ? ["-h"] : ARGV
|
20
|
+
generator_class.start(args)
|
21
|
+
else
|
22
|
+
puts "Please specify generator to use (#{Jenerator::Generators.mappings.keys.join(", ")})"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Jenerator
|
2
|
+
module Actions
|
3
|
+
def self.included(base)
|
4
|
+
base.extend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
def destination_root(*paths)
|
8
|
+
File.expand_path(File.join(@destination_stack.last, paths))
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def require_arguments!
|
13
|
+
@require_arguments = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def require_arguments?
|
17
|
+
@require_arguments
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Jenerator
|
2
|
+
module Generators
|
3
|
+
class Component < Thor::Group
|
4
|
+
include Thor::Actions
|
5
|
+
include Jenerator::Actions
|
6
|
+
|
7
|
+
Jenerator::Generators.add_generator(:component, self)
|
8
|
+
|
9
|
+
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
10
|
+
def self.banner; "jenerator component [name]"; end
|
11
|
+
|
12
|
+
desc "Description:\n\n\tjenerator component generates a new Joomla! Component"
|
13
|
+
|
14
|
+
argument :name, :desc => "The name of the component"
|
15
|
+
|
16
|
+
class_option :joomla_version, :desc => 'Joomla version', :default => '2.5'
|
17
|
+
class_option :element, :desc => "The name of the component", :default => "com_NAME"
|
18
|
+
class_option :author, :desc => "The author", :default => Faker::Name.name
|
19
|
+
class_option :copyright, :desc => "The copyright", :default => "Copyright Author"
|
20
|
+
class_option :licenser, :desc => "The license", :default => "GPL V3"
|
21
|
+
class_option :author_emai, :desc => "The author's email", :default => Faker::Internet.email
|
22
|
+
class_option :author_url, :desc => "The author's url", :default => "http://#{Faker::Internet.domain_name}"
|
23
|
+
class_option :version, :desc => "The version", :default => "#{rand(100)}.#{rand(100)}.#{rand(100)}"
|
24
|
+
class_option :description, :desc => "The description", :default => Faker::Lorem.paragraphs(1).join("\n")
|
25
|
+
|
26
|
+
require_arguments!
|
27
|
+
|
28
|
+
def create_component
|
29
|
+
new_options = options.dup
|
30
|
+
options = new_options
|
31
|
+
|
32
|
+
options[:element] = "com_#{self.name.downcase}" if options[:element] == 'com_NAME'
|
33
|
+
options[:copyright] = "Copyright #{options[:author]}" if options[:copyright] == "Copyright Author"
|
34
|
+
|
35
|
+
|
36
|
+
self.destination_root = File.join(self.destination_root, options[:element])
|
37
|
+
empty_directory "code/administrator/components/#{options[:element]}"
|
38
|
+
empty_directory "code/site/components/#{options[:element]}"
|
39
|
+
empty_directory "packages"
|
40
|
+
empty_directory "tasks"
|
41
|
+
|
42
|
+
template "templates/joomla#{options[:joomla_version]}/component/manifest.xml.tt", destination_root("code", "manifest.xml"), options
|
43
|
+
template "templates/joomla#{options[:joomla_version]}/component/admin.php.tt",
|
44
|
+
destination_root("code/administrator/components/#{options[:element]}", "#{self.name.downcase}.php"), options
|
45
|
+
template "templates/joomla#{options[:joomla_version]}/component/site.php.tt",
|
46
|
+
destination_root("code/site/components/#{options[:element]}", "#{self.name.downcase}.php"), options
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<install type="component" version="2.5.0" method="upgrade">
|
3
|
+
<name><%= @name =></name>
|
4
|
+
<author><%= config[:author] =></author>
|
5
|
+
<creationDate><%= config[:creation_date] =></creationDate>
|
6
|
+
<copyright><%= config[:copyright] =></copyright>
|
7
|
+
<license><%= config[:license] =></license>
|
8
|
+
<authorEmail><%= config[:author_email] =></authorEmail>
|
9
|
+
<authorUrl><%= config[:author_url] =></authorUrl>
|
10
|
+
<version><%= config[:version] =></version>
|
11
|
+
<description><%= config[:description] =></description>
|
12
|
+
|
13
|
+
<install> <!-- Runs on install -->
|
14
|
+
<sql>
|
15
|
+
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
|
16
|
+
</sql>
|
17
|
+
</install>
|
18
|
+
<uninstall> <!-- Runs on uninstall -->
|
19
|
+
<sql>
|
20
|
+
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
|
21
|
+
</sql>
|
22
|
+
</uninstall>
|
23
|
+
<update> <!-- Runs on update; New in 1.6 -->
|
24
|
+
<schemas>
|
25
|
+
<schemapath type="mysql">sql/updates/mysql</schemapath>
|
26
|
+
</schemas>
|
27
|
+
</update>
|
28
|
+
|
29
|
+
<files folder="site/components/<%= @element =>">
|
30
|
+
<filename><= @name =>.php</filename>
|
31
|
+
</files>
|
32
|
+
|
33
|
+
<administration>
|
34
|
+
<files folder="administrator/components/<%= @element =>">
|
35
|
+
<filename><%= @name =>.php</filename>
|
36
|
+
<folder>sql</folder>
|
37
|
+
</files>
|
38
|
+
</administration>
|
39
|
+
</install>
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jenerator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ken Erickson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &2161096400 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2161096400
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor
|
27
|
+
requirement: &2161095940 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2161095940
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ffaker
|
38
|
+
requirement: &2161095280 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2161095280
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: active_support
|
49
|
+
requirement: &2161094860 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2161094860
|
58
|
+
description: Generators for easily creating dummy/base Joomla! extensions
|
59
|
+
email: bookworm.productions@gmail.com
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- README.md
|
65
|
+
- jenerator.gemspec
|
66
|
+
- lib/jenerator.rb
|
67
|
+
- lib/jenerator/cli.rb
|
68
|
+
- lib/jenerator/generators/actions.rb
|
69
|
+
- lib/jenerator/generators/component.rb
|
70
|
+
- lib/jenerator/generators/templates/joomla2.5/component/admin.php.tt
|
71
|
+
- lib/jenerator/generators/templates/joomla2.5/component/manifest.xml.tt
|
72
|
+
- lib/jenerator/generators/templates/joomla2.5/component/site.php.tt
|
73
|
+
homepage: http://github.com/bookworm/jenerator
|
74
|
+
licenses: []
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- --charset=UTF-8
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 1.3.6
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project: jenerator
|
94
|
+
rubygems_version: 1.8.11
|
95
|
+
signing_key:
|
96
|
+
specification_version: 3
|
97
|
+
summary: Joomla Generators
|
98
|
+
test_files: []
|
99
|
+
has_rdoc:
|