susanoo 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/susanoo.rb +2 -0
- data/lib/susanoo/cli.rb +3 -4
- data/lib/susanoo/cli/{global.rb → global_interface.rb} +0 -0
- data/lib/susanoo/cli/global_interface/.keep +0 -0
- data/lib/susanoo/cli/project_interface.rb +41 -0
- data/lib/susanoo/cli/project_interface/build.rb +50 -0
- data/lib/susanoo/cli/project_interface/commands.rb +5 -0
- data/lib/susanoo/cli/project_interface/console.rb +23 -0
- data/lib/susanoo/cli/project_interface/generate.rb +71 -0
- data/lib/susanoo/cli/project_interface/run.rb +23 -0
- data/lib/susanoo/cli/project_interface/server.rb +66 -0
- data/lib/susanoo/controllers/assets.rb +19 -7
- data/lib/susanoo/controllers/index.rb +4 -2
- data/lib/susanoo/controllers/static.rb +2 -1
- data/lib/susanoo/controllers/views.rb +1 -1
- data/lib/susanoo/templates/application/bin/susanoo +2 -2
- data/lib/susanoo/version.rb +1 -1
- metadata +11 -4
- data/lib/susanoo/cli/project.rb +0 -163
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4086a3dff1194bc49fcce65b34876d9c6d66a8d
|
4
|
+
data.tar.gz: 975a9d183243d833cbff060fdeb9239b4ecbb02f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edeedacdc86029542c823fc30db887caac1efa16b755263c6a335e3be061640a2ea4e7da6764e55ef3e8a432b2079211e50b2dc98578f76ed106c6dedf4a5d12
|
7
|
+
data.tar.gz: 4c917db03b1fbe1c743e51a2ddbad1a730b0abf544864789026d7701d43ea95907d301f8ef79f773584027bf1b9eb0d1060887a574e5bb3fdea34fba5172ce44
|
data/lib/susanoo.rb
CHANGED
data/lib/susanoo/cli.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
-
require 'susanoo/cli/
|
5
|
-
require 'susanoo/cli/
|
6
|
-
require 'active_support/core_ext/string/inflections'
|
4
|
+
require 'susanoo/cli/global_interface'
|
5
|
+
require 'susanoo/cli/project_interface'
|
7
6
|
|
8
7
|
|
9
8
|
module Susanoo
|
@@ -13,7 +12,7 @@ module Susanoo
|
|
13
12
|
|
14
13
|
def self.run
|
15
14
|
unless execute
|
16
|
-
Susanoo::CLI::
|
15
|
+
Susanoo::CLI::GlobalInterface.start
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
File without changes
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
require_relative './project_interface/commands'
|
4
|
+
|
5
|
+
module Susanoo
|
6
|
+
module CLI
|
7
|
+
# Project wide `Thor` class which is responsible for
|
8
|
+
# each command that user execute inside project
|
9
|
+
class ProjectInterface < Thor
|
10
|
+
|
11
|
+
# Include the Thor actions
|
12
|
+
include ::Thor::Actions
|
13
|
+
|
14
|
+
package_name 'Susanoo'
|
15
|
+
|
16
|
+
# Set the project root
|
17
|
+
def self.root=(path)
|
18
|
+
@@root = path
|
19
|
+
Susanoo::Project.path = path
|
20
|
+
end
|
21
|
+
|
22
|
+
# Set source paths for current generator
|
23
|
+
def self.source_root
|
24
|
+
"#{@@root}/src"
|
25
|
+
end
|
26
|
+
|
27
|
+
include Susanoo::CLI::Commands::Server
|
28
|
+
include Susanoo::CLI::Commands::Generate
|
29
|
+
include Susanoo::CLI::Commands::Build
|
30
|
+
include Susanoo::CLI::Commands::Console
|
31
|
+
include Susanoo::CLI::Commands::Run
|
32
|
+
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def project_root
|
37
|
+
Susanoo::Project.path
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Susanoo::CLI
|
2
|
+
module Commands
|
3
|
+
# Provide the `generate` & `destroy` commands for project wide usage.
|
4
|
+
module Build
|
5
|
+
extend ::ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
|
9
|
+
map 'b' => :build
|
10
|
+
|
11
|
+
desc 'build [PLATFORM]', 'Build the application for given PLATFORM (default=android).'
|
12
|
+
def build(platform = 'android')
|
13
|
+
|
14
|
+
require File.join(project_root, 'config/routes')
|
15
|
+
router = ROUTER.instance_variable_get('@router')
|
16
|
+
|
17
|
+
build_dir = File.join(project_root, 'www')
|
18
|
+
# setup build directory
|
19
|
+
|
20
|
+
remove_file build_dir if File.exist? build_dir
|
21
|
+
# Create the www directory if there isn't
|
22
|
+
# WWW directory will be the build directory
|
23
|
+
# which will contains the static files.
|
24
|
+
#
|
25
|
+
# NOTE: cordova only uses this directory
|
26
|
+
# and we can't change it as far as I know
|
27
|
+
empty_directory build_dir
|
28
|
+
|
29
|
+
router.routes.each do |route|
|
30
|
+
controller = route.dest
|
31
|
+
if controller.respond_to? :build
|
32
|
+
say_status 'build', "Controller: #{controller.__getobj__.class}"
|
33
|
+
|
34
|
+
# options to pass to controller build method
|
35
|
+
options = {
|
36
|
+
route: route.dup,
|
37
|
+
platform: platform
|
38
|
+
}
|
39
|
+
|
40
|
+
controller.build(self, options)
|
41
|
+
else
|
42
|
+
say_status 'warning', "#{controller.__getobj__.class.to_s}' does not have 'build' method.",
|
43
|
+
:yellow
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'susanoo/irb'
|
2
|
+
|
3
|
+
module Susanoo::CLI
|
4
|
+
module Commands
|
5
|
+
# Provide the `console` command for project wide usage.
|
6
|
+
module Console
|
7
|
+
extend ::ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
|
11
|
+
map 'c' => :console
|
12
|
+
|
13
|
+
desc 'console', 'Run pry in environment of `Susanoo`. '
|
14
|
+
def console
|
15
|
+
project_root = Susanoo::Project.path
|
16
|
+
require File.join(project_root, 'config/routes')
|
17
|
+
|
18
|
+
IRB.start_session(binding)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'susanoo/generators'
|
2
|
+
|
3
|
+
module Susanoo::CLI
|
4
|
+
module Commands
|
5
|
+
# Provide the `generate` & `destroy` commands for project wide usage.
|
6
|
+
module Generate
|
7
|
+
extend ::ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
map 'g' => :generate
|
11
|
+
map 'd' => :destroy
|
12
|
+
|
13
|
+
desc 'generate GENERATOR [options]', 'Run the given generator'
|
14
|
+
def generate(generator_name = nil, *options)
|
15
|
+
generator = get_the_generator_class generator_name
|
16
|
+
# Run the generator with given options
|
17
|
+
generator.start(options, behavior: :invoke,
|
18
|
+
destination_root: project_root)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'destroy GENERATOR [options]', 'Destroy the given generator'
|
22
|
+
def destroy(generator_name = nil, *options)
|
23
|
+
generator = get_the_generator_class generator_name
|
24
|
+
|
25
|
+
generator.start(options, behavior: :revoke,
|
26
|
+
destination_root: project_root)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def print_generator_list
|
34
|
+
say 'Available generators:'
|
35
|
+
say '---------------------------------------------------'
|
36
|
+
Susanoo::Generators.constants.each do |g|
|
37
|
+
generator = Susanoo::Generators.const_get(g)
|
38
|
+
|
39
|
+
if generator.respond_to?(:global_generator?) && \
|
40
|
+
!generator.global_generator?
|
41
|
+
generator_name = generator.to_s.split('::').last.underscore
|
42
|
+
say "#{generator_name}\t\t #{generator.desc}\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_the_generator_class(generator_name)
|
50
|
+
# Print the generators list and exit
|
51
|
+
if generator_name.nil?
|
52
|
+
print_generator_list
|
53
|
+
return
|
54
|
+
end
|
55
|
+
|
56
|
+
# Try to load and get the generator Class
|
57
|
+
begin
|
58
|
+
klass = generator_name.downcase.camelize
|
59
|
+
generator = Susanoo::Generators.const_get(klass)
|
60
|
+
|
61
|
+
rescue NameError
|
62
|
+
say_status 'Error', "Generator `#{generator_name}` not found.",
|
63
|
+
:red
|
64
|
+
exit 1
|
65
|
+
end
|
66
|
+
generator
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Susanoo::CLI
|
2
|
+
module Commands
|
3
|
+
# Provide the `run` command for project wide usage.
|
4
|
+
module Run
|
5
|
+
extend ::ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
|
9
|
+
map 'r' => :run_in
|
10
|
+
|
11
|
+
desc 'run PLATFORM', 'Run application on PLATFORM.'
|
12
|
+
def run_in(platform = :android)
|
13
|
+
# Build the project first
|
14
|
+
build
|
15
|
+
inside Susanoo::Project.path do
|
16
|
+
system "cordova run #{platform.to_s}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Susanoo::CLI
|
2
|
+
module Commands
|
3
|
+
# Provide the `server` command for project wide usage.
|
4
|
+
module Server
|
5
|
+
extend ::ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
map 's' => :server
|
9
|
+
|
10
|
+
method_option :debug, default: true
|
11
|
+
method_option :built, default: false
|
12
|
+
method_option :port, default: 3000
|
13
|
+
desc 'server [PLATFROM]', 'Run development server. Simulate the given PLATFORM'
|
14
|
+
def server(platform = 'android')
|
15
|
+
port = options[:port]
|
16
|
+
|
17
|
+
if options[:built]
|
18
|
+
return not_built unless built?
|
19
|
+
app = static_server_for platform
|
20
|
+
|
21
|
+
else
|
22
|
+
require File.join(project_root, 'config/routes')
|
23
|
+
# Set global debug flag
|
24
|
+
Susanoo::Project.debug = options[:debug]
|
25
|
+
app = ROUTER
|
26
|
+
|
27
|
+
end
|
28
|
+
# Run the selected application to serve the project
|
29
|
+
Rack::Server.start(app: app, server: :thin, Port: port,
|
30
|
+
debug: options[:debug])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# Does project is built?
|
37
|
+
def built?
|
38
|
+
return false unless File.directory? File.join(project_root, 'www')
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
def not_built
|
43
|
+
error "'www' directory is not present. Build you app first."
|
44
|
+
end
|
45
|
+
|
46
|
+
# Return a `Rack` applciation which will serve the
|
47
|
+
# already built project under specific platform path
|
48
|
+
def static_server_for(platform)
|
49
|
+
require 'rack/rewrite'
|
50
|
+
|
51
|
+
root = project_root
|
52
|
+
|
53
|
+
app = Rack::Builder.new do
|
54
|
+
use Rack::Rewrite do
|
55
|
+
rewrite '/', "/#{platform}_asset/www"
|
56
|
+
end
|
57
|
+
|
58
|
+
map "/#{platform}_asset/www/" do
|
59
|
+
run Rack::Directory.new File.join(root, 'www')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -11,26 +11,38 @@ class Susanoo::Application
|
|
11
11
|
environment.call env
|
12
12
|
end
|
13
13
|
|
14
|
-
def build(generator,
|
15
|
-
|
16
|
-
|
14
|
+
def build(generator, options)
|
15
|
+
platform = options[:platform]
|
16
|
+
|
17
|
+
Sprockets::Helpers.configure do |config|
|
18
|
+
config.prefix = "/#{platform}_asset/www/assets"
|
19
|
+
config.debug = false
|
20
|
+
config.environment = @environment
|
21
|
+
end
|
22
|
+
|
23
|
+
@environment.append_path File.join(project_root,
|
17
24
|
'src/assets/javascripts')
|
18
|
-
|
19
|
-
|
25
|
+
@environment.append_path File.join(project_root,
|
26
|
+
'src/assets/stylesheets')
|
27
|
+
|
28
|
+
@environment.append_path File.join(project_root,
|
29
|
+
'src/assets/fonts')
|
30
|
+
|
20
31
|
|
21
32
|
func = lambda do |path, filename|
|
22
33
|
filename !~ %r~assets~ && !%w[.js .css].include?(File.extname(path))
|
23
34
|
end
|
24
35
|
|
25
36
|
precompile = [func, /(?:\/|\\|\A)application\.(css|js)$/]
|
26
|
-
|
37
|
+
@environment.each_logical_path(*precompile).each {|path|
|
27
38
|
case File.extname(path)
|
28
39
|
when '.js'
|
29
40
|
dir = 'javascripts'
|
30
41
|
when '.css'
|
31
42
|
dir = 'stylesheets'
|
32
43
|
end
|
33
|
-
|
44
|
+
@environment[path].write_to "www/assets/#{path}"
|
45
|
+
#@environment[path].write_to "www/assets/#{dir}/#{path}"
|
34
46
|
}
|
35
47
|
|
36
48
|
if File.exist? File.join(project_root,
|
@@ -10,11 +10,13 @@ class Susanoo::Application
|
|
10
10
|
[200, {'Content-Type' => 'text/html'}, [template.render(self)]]
|
11
11
|
end
|
12
12
|
|
13
|
-
def build(generator,
|
13
|
+
def build(generator, options)
|
14
|
+
platform = options[:platform]
|
15
|
+
|
14
16
|
# Configure Sprockets::Helpers (if necessary)
|
15
17
|
Sprockets::Helpers.configure do |config|
|
16
18
|
config.environment = @environment
|
17
|
-
config.prefix =
|
19
|
+
config.prefix = "/#{platform}_asset/www/assets"
|
18
20
|
config.debug = false
|
19
21
|
end
|
20
22
|
|
@@ -15,7 +15,7 @@ class Susanoo::Application
|
|
15
15
|
[200, {'Content-Type' => 'text/html'}, [template.render(self)]]
|
16
16
|
end
|
17
17
|
|
18
|
-
def build(generator,
|
18
|
+
def build(generator, options)
|
19
19
|
file_pattern = File.join(project_root, 'src/views/**/*.{html,html.erb}')
|
20
20
|
dest_path = File.join(project_root, 'www')
|
21
21
|
src_path = File.join(project_root, 'src')
|
data/lib/susanoo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: susanoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sameer Rahmani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -258,8 +258,15 @@ files:
|
|
258
258
|
- lib/susanoo/application.rb
|
259
259
|
- lib/susanoo/assets.rb
|
260
260
|
- lib/susanoo/cli.rb
|
261
|
-
- lib/susanoo/cli/
|
262
|
-
- lib/susanoo/cli/
|
261
|
+
- lib/susanoo/cli/global_interface.rb
|
262
|
+
- lib/susanoo/cli/global_interface/.keep
|
263
|
+
- lib/susanoo/cli/project_interface.rb
|
264
|
+
- lib/susanoo/cli/project_interface/build.rb
|
265
|
+
- lib/susanoo/cli/project_interface/commands.rb
|
266
|
+
- lib/susanoo/cli/project_interface/console.rb
|
267
|
+
- lib/susanoo/cli/project_interface/generate.rb
|
268
|
+
- lib/susanoo/cli/project_interface/run.rb
|
269
|
+
- lib/susanoo/cli/project_interface/server.rb
|
263
270
|
- lib/susanoo/controller.rb
|
264
271
|
- lib/susanoo/controllers/assets.rb
|
265
272
|
- lib/susanoo/controllers/index.rb
|
data/lib/susanoo/cli/project.rb
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'susanoo/generators'
|
3
|
-
require 'susanoo/irb'
|
4
|
-
|
5
|
-
module Susanoo
|
6
|
-
module CLI
|
7
|
-
class Project < Thor
|
8
|
-
|
9
|
-
include ::Thor::Actions
|
10
|
-
|
11
|
-
package_name 'Susanoo'
|
12
|
-
|
13
|
-
map 's' => :server
|
14
|
-
map 'g' => :generate
|
15
|
-
map 'r' => :run_in
|
16
|
-
map 'd' => :destroy
|
17
|
-
map 'b' => :build
|
18
|
-
map 'c' => :console
|
19
|
-
|
20
|
-
# Set the project root
|
21
|
-
def self.root=(path)
|
22
|
-
@@root = path
|
23
|
-
Susanoo::Project.path = path
|
24
|
-
end
|
25
|
-
|
26
|
-
# Set source paths for current generator
|
27
|
-
def self.source_root
|
28
|
-
"#{@@root}/src"
|
29
|
-
end
|
30
|
-
|
31
|
-
desc 'generate GENERATOR [options]', 'Run the given generator'
|
32
|
-
def generate(generator_name = nil, *options)
|
33
|
-
generator = get_the_generator_class generator_name
|
34
|
-
# Run the generator with given options
|
35
|
-
generator.start(options, behavior: :invoke,
|
36
|
-
destination_root: Susanoo::Project.path)
|
37
|
-
end
|
38
|
-
|
39
|
-
desc 'destroy GENERATOR [options]', 'Destroy the given generator'
|
40
|
-
def destroy(generator_name = nil, *options)
|
41
|
-
generator = get_the_generator_class generator_name
|
42
|
-
|
43
|
-
generator.start(options, behavior: :revoke,
|
44
|
-
destination_root: Susanoo::Project.path)
|
45
|
-
end
|
46
|
-
|
47
|
-
method_option :debug, default: true
|
48
|
-
method_option :built, default: false
|
49
|
-
desc 'server', 'Run development server.'
|
50
|
-
def server(port = 3000)
|
51
|
-
project_root = Susanoo::Project.path
|
52
|
-
|
53
|
-
if options[:built]
|
54
|
-
unless File.directory? File.join(project_root, 'www')
|
55
|
-
error "'www' directory is not present. Build you app first."
|
56
|
-
return
|
57
|
-
end
|
58
|
-
|
59
|
-
app = Rack::Directory.new File.join(project_root, 'www')
|
60
|
-
|
61
|
-
else
|
62
|
-
require File.join(project_root, 'config/routes')
|
63
|
-
# Set global debug flag
|
64
|
-
Susanoo::Project.debug = options[:debug]
|
65
|
-
|
66
|
-
app = ROUTER
|
67
|
-
end
|
68
|
-
|
69
|
-
Rack::Server.start(app: app, server: :thin, Port: port,
|
70
|
-
debug: options[:debug])
|
71
|
-
end
|
72
|
-
|
73
|
-
desc 'build', 'Build the application.'
|
74
|
-
def build
|
75
|
-
project_root = Susanoo::Project.path
|
76
|
-
|
77
|
-
require File.join(project_root, 'config/routes')
|
78
|
-
|
79
|
-
router = ROUTER.instance_variable_get('@router')
|
80
|
-
|
81
|
-
build_dir = File.join(project_root, 'www')
|
82
|
-
# setup build directory
|
83
|
-
|
84
|
-
remove_file build_dir if File.exist? build_dir
|
85
|
-
# Create the www directory if there isn't
|
86
|
-
# WWW directory will be the build directory
|
87
|
-
# which will contains the static files.
|
88
|
-
#
|
89
|
-
# NOTE: cordova only uses this directory
|
90
|
-
# and we can't change it as far as I know
|
91
|
-
empty_directory build_dir
|
92
|
-
|
93
|
-
router.routes.each do |route|
|
94
|
-
controller = route.dest
|
95
|
-
if controller.respond_to? :build
|
96
|
-
say_status 'build', "Controller: #{controller.__getobj__.class}"
|
97
|
-
controller.build(self, route.dup)
|
98
|
-
else
|
99
|
-
say_status 'warning', "#{controller.__getobj__.class.to_s}' does not have 'build' method.",
|
100
|
-
:yellow
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
desc 'run PLATFORM', 'Run application on PLATFORM.'
|
106
|
-
def run_in(platform = :android)
|
107
|
-
# Build the project first
|
108
|
-
build
|
109
|
-
|
110
|
-
inside Susanoo::Project.path do
|
111
|
-
system "cordova run #{platform.to_s}"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
desc 'console', 'Run pry in environment of `Susanoo`. '
|
116
|
-
def console
|
117
|
-
project_root = Susanoo::Project.path
|
118
|
-
require File.join(project_root, 'config/routes')
|
119
|
-
|
120
|
-
IRB.start_session(binding)
|
121
|
-
end
|
122
|
-
|
123
|
-
private
|
124
|
-
# Private ---------------------------
|
125
|
-
|
126
|
-
def get_the_generator_class(generator_name)
|
127
|
-
# Print the generators list and exit
|
128
|
-
if generator_name.nil?
|
129
|
-
print_generator_list
|
130
|
-
return
|
131
|
-
end
|
132
|
-
|
133
|
-
# Try to load and get the generator Class
|
134
|
-
begin
|
135
|
-
klass = generator_name.downcase.camelize
|
136
|
-
generator = Susanoo::Generators.const_get(klass)
|
137
|
-
|
138
|
-
rescue NameError
|
139
|
-
say_status 'Error', "Generator `#{generator_name}` not found.",
|
140
|
-
:red
|
141
|
-
exit 1
|
142
|
-
end
|
143
|
-
generator
|
144
|
-
end
|
145
|
-
|
146
|
-
def print_generator_list
|
147
|
-
say 'Available generators:'
|
148
|
-
say '---------------------------------------------------'
|
149
|
-
Susanoo::Generators.constants.each do |g|
|
150
|
-
generator = Susanoo::Generators.const_get(g)
|
151
|
-
|
152
|
-
if generator.respond_to?(:global_generator?) && \
|
153
|
-
!generator.global_generator?
|
154
|
-
generator_name = generator.to_s.split('::').last.underscore
|
155
|
-
say "#{generator_name}\t\t #{generator.desc}\n"
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|