coronate 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/coronate/builder/app_builder.rb +19 -24
- data/lib/coronate/builder/ebook_builder.rb +17 -22
- data/lib/coronate/builder/game_builder.rb +17 -22
- data/lib/coronate/builder/project_builder.rb +15 -19
- data/lib/coronate/builder/scene_builder.rb +7 -11
- data/lib/coronate/cli.rb +35 -59
- data/lib/coronate/extensions/method_hooker.rb +68 -0
- data/lib/coronate/extensions/string_extention.rb +7 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZThlMDdmZjQ1Mzk5NTRkMzkxZWQ3MjgzN2E1YjUyNGVjNmM2MTY2Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjNkMDU5OTQ5MGJlZDNjMDdhODc3YzU5OWE4NjJlMTg5ZmRhOGUwZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDg3YTIxZTZjYTM4N2M0NzE5MDAwZGIxOWJlY2NkZTIxNmYzNGE0OGE4MTdl
|
10
|
+
MDgyYTMxN2FkMWEwYTY4OTU5ZDlmYjM0M2M4NTY0ZWU0MGY4NjlhNzIyYmNi
|
11
|
+
MzUyMzMyZmI0M2ExMWE5ZDliMDU4NjgxYTMwMTIwNDgxZmIxMzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWYyN2FkNzljODkwZDUyNGJhMzdmMmI0NTI4NGEyNzM4OGY4NjllOTI5MDYw
|
14
|
+
MDNkNWQ2MDI5YTU5OGU1ZGJjOGU1M2QzZWJhMjMyMDZiZTg5OGM0ZGJlYzlk
|
15
|
+
Njc0MzhmNTkyNDgyMzdiNjMxOTM4YTVkYjQ0YTEyYjY4YjU3M2M=
|
@@ -1,27 +1,22 @@
|
|
1
1
|
module Coronate
|
2
|
-
|
3
|
-
|
2
|
+
module Builder
|
3
|
+
module AppBuilder
|
4
|
+
def build_app
|
5
|
+
template 'builder/templates/app/build.settings.tt', "#{@name}/build.settings"
|
6
|
+
template 'builder/templates/app/config.lua.tt', "#{@name}/config.lua"
|
7
|
+
template 'builder/templates/app/view1.lua.tt', "#{@name}/view1.lua"
|
8
|
+
template 'builder/templates/app/view2.lua.tt', "#{@name}/view2.lua"
|
9
|
+
template 'builder/templates/app/main.lua.tt', "#{@name}/main.lua"
|
4
10
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
copy_file 'builder/templates/app/icon1-down@2x.png', "#{@name}/icon1-down@2x.png"
|
17
|
-
copy_file 'builder/templates/app/icon2-down.png', "#{@name}/icon2-down.png"
|
18
|
-
copy_file 'builder/templates/app/icon2-down@2x.png', "#{@name}/icon2-down@2x.png"
|
19
|
-
copy_file 'builder/templates/app/icon1.png', "#{@name}/icon1.png"
|
20
|
-
copy_file 'builder/templates/app/icon1@2x.png', "#{@name}/icon1@2x.png"
|
21
|
-
copy_file 'builder/templates/app/icon2.png', "#{@name}/icon2.png"
|
22
|
-
copy_file 'builder/templates/app/icon2@2x.png', "#{@name}/icon2@2x.png"
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
11
|
+
copy_file 'builder/templates/app/icon1-down.png', "#{@name}/icon1-down.png"
|
12
|
+
copy_file 'builder/templates/app/icon1-down@2x.png', "#{@name}/icon1-down@2x.png"
|
13
|
+
copy_file 'builder/templates/app/icon2-down.png', "#{@name}/icon2-down.png"
|
14
|
+
copy_file 'builder/templates/app/icon2-down@2x.png', "#{@name}/icon2-down@2x.png"
|
15
|
+
copy_file 'builder/templates/app/icon1.png', "#{@name}/icon1.png"
|
16
|
+
copy_file 'builder/templates/app/icon1@2x.png', "#{@name}/icon1@2x.png"
|
17
|
+
copy_file 'builder/templates/app/icon2.png', "#{@name}/icon2.png"
|
18
|
+
copy_file 'builder/templates/app/icon2@2x.png', "#{@name}/icon2@2x.png"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
27
22
|
end
|
@@ -1,25 +1,20 @@
|
|
1
1
|
module Coronate
|
2
|
-
|
3
|
-
|
2
|
+
module Builder
|
3
|
+
module EbookBuilder
|
4
|
+
def build_ebook
|
5
|
+
template 'builder/templates/ebook/build.settings.tt', "#{@name}/build.settings"
|
6
|
+
template 'builder/templates/ebook/title.lua.tt', "#{@name}/title.lua"
|
7
|
+
template 'builder/templates/ebook/config.lua.tt', "#{@name}/config.lua"
|
8
|
+
template 'builder/templates/ebook/main.lua.tt', "#{@name}/main.lua"
|
9
|
+
template 'builder/templates/ebook/page1.lua.tt', "#{@name}/page1.lua"
|
4
10
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
copy_file 'builder/templates/ebook/coronaicon-big.png', "#{@name}/coronaicon-big.png"
|
16
|
-
copy_file 'builder/templates/ebook/cover.jpg', "#{@name}/cover.jpg"
|
17
|
-
copy_file 'builder/templates/ebook/moon.png', "#{@name}/moon.png"
|
18
|
-
copy_file 'builder/templates/ebook/pagebg1.png', "#{@name}/pagebg1.png"
|
19
|
-
copy_file 'builder/templates/ebook/space.jpg', "#{@name}/space.jpg"
|
20
|
-
copy_file 'builder/templates/ebook/sun.png', "#{@name}/sun.png"
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
11
|
+
copy_file 'builder/templates/ebook/coronaicon-big.png', "#{@name}/coronaicon-big.png"
|
12
|
+
copy_file 'builder/templates/ebook/cover.jpg', "#{@name}/cover.jpg"
|
13
|
+
copy_file 'builder/templates/ebook/moon.png', "#{@name}/moon.png"
|
14
|
+
copy_file 'builder/templates/ebook/pagebg1.png', "#{@name}/pagebg1.png"
|
15
|
+
copy_file 'builder/templates/ebook/space.jpg', "#{@name}/space.jpg"
|
16
|
+
copy_file 'builder/templates/ebook/sun.png', "#{@name}/sun.png"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
25
20
|
end
|
@@ -1,25 +1,20 @@
|
|
1
1
|
module Coronate
|
2
|
-
|
3
|
-
|
2
|
+
module Builder
|
3
|
+
module GameBuilder
|
4
|
+
def build_game
|
5
|
+
template 'builder/templates/game/build.settings.tt', "#{@name}/build.settings"
|
6
|
+
template 'builder/templates/game/config.lua.tt', "#{@name}/config.lua"
|
7
|
+
template 'builder/templates/game/main.lua.tt', "#{@name}/main.lua"
|
8
|
+
template 'builder/templates/game/menu.lua.tt', "#{@name}/menu.lua"
|
9
|
+
template 'builder/templates/game/level1.lua.tt', "#{@name}/level1.lua"
|
4
10
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
copy_file 'builder/templates/game/background.jpg', "#{@name}/background.jpg"
|
16
|
-
copy_file 'builder/templates/game/button-over.png', "#{@name}/button-over.png"
|
17
|
-
copy_file 'builder/templates/game/button.png', "#{@name}/button.png"
|
18
|
-
copy_file 'builder/templates/game/crate.png', "#{@name}/crate.png"
|
19
|
-
copy_file 'builder/templates/game/grass.png', "#{@name}/grass.png"
|
20
|
-
copy_file 'builder/templates/game/logo.png', "#{@name}/logo.png"
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
11
|
+
copy_file 'builder/templates/game/background.jpg', "#{@name}/background.jpg"
|
12
|
+
copy_file 'builder/templates/game/button-over.png', "#{@name}/button-over.png"
|
13
|
+
copy_file 'builder/templates/game/button.png', "#{@name}/button.png"
|
14
|
+
copy_file 'builder/templates/game/crate.png', "#{@name}/crate.png"
|
15
|
+
copy_file 'builder/templates/game/grass.png', "#{@name}/grass.png"
|
16
|
+
copy_file 'builder/templates/game/logo.png', "#{@name}/logo.png"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
25
20
|
end
|
@@ -1,21 +1,17 @@
|
|
1
1
|
module Coronate
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
2
|
+
module Builder
|
3
|
+
module ProjectBuilder
|
4
|
+
def build_project
|
5
|
+
empty_directory "#{@name}/assets"
|
6
|
+
template 'builder/templates/project/main.tt', "#{@name}/main.lua"
|
7
|
+
template 'builder/templates/project/utils.tt', "#{@name}/utils.lua"
|
8
|
+
template 'builder/templates/project/titleScene.tt', "#{@name}/titleScene.lua"
|
9
|
+
template 'builder/templates/project/endingScene.tt', "#{@name}/endingScene.lua"
|
10
|
+
template 'builder/templates/project/settingsScene.tt', "#{@name}/settingsScene.lua"
|
11
|
+
template 'builder/templates/project/menuScene.tt', "#{@name}/menuScene.lua"
|
12
|
+
template 'builder/templates/project/config.tt', "#{@name}/config.lua"
|
13
|
+
template 'builder/templates/project/build.settings.tt', "#{@name}/build.settings"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
21
17
|
end
|
@@ -1,13 +1,9 @@
|
|
1
1
|
module Coronate
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
2
|
+
module Builder
|
3
|
+
module SceneBuilder
|
4
|
+
def build_scene
|
5
|
+
template 'builder/templates/scene/scene.tt', "#{@name}.lua"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
13
9
|
end
|
data/lib/coronate/cli.rb
CHANGED
@@ -1,75 +1,51 @@
|
|
1
|
-
require
|
1
|
+
require 'thor'
|
2
|
+
require_relative 'extensions/string_extention'
|
2
3
|
|
3
|
-
%w[project app game ebook scene].each { |
|
4
|
+
%w[project app game ebook scene].each { |task| require_relative "builder/#{task}_builder" }
|
4
5
|
|
5
|
-
class Coronate::CLI < Thor
|
6
|
+
class Coronate::CLI < Thor
|
6
7
|
include Thor::Actions
|
7
|
-
|
8
|
+
|
9
|
+
Coronate::Builder.constants.each { |b| include "Coronate::Builder::#{b}".to_class }
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
super
|
13
|
+
method = args[2][:current_command][:name]
|
14
|
+
processing(args[0][0] || "#{method}1" , method)
|
15
|
+
end
|
8
16
|
|
9
17
|
def self.source_root
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
desc "scene [NAME]", "generate an scene"
|
14
|
-
def scene(name='scene1')
|
15
|
-
build_scene({
|
16
|
-
:name => name,
|
17
|
-
:width => options[:width],
|
18
|
-
:height => options[:height],
|
19
|
-
:landscape => options[:landscape]
|
20
|
-
})
|
18
|
+
File.dirname(__FILE__)
|
21
19
|
end
|
22
20
|
|
21
|
+
class_option :width, :type => :numeric, :default => 320, :required => false, :aliases => "-w", :desc => "width"
|
22
|
+
class_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
23
|
+
class_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
24
|
+
|
25
|
+
desc "scene [NAME]", "generate an scene"
|
26
|
+
def scene(name='scene1') end
|
27
|
+
|
23
28
|
desc "project [NAME]", "generate a corona project"
|
24
|
-
|
25
|
-
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
26
|
-
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
27
|
-
def project(name='project1')
|
28
|
-
build_project({
|
29
|
-
:name => name,
|
30
|
-
:width => options[:width],
|
31
|
-
:height => options[:height],
|
32
|
-
:landscape => options[:landscape]
|
33
|
-
})
|
34
|
-
end
|
29
|
+
def project(name='project1') end
|
35
30
|
|
36
31
|
desc "game [NAME]", "generate a corona game project"
|
37
|
-
|
38
|
-
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
39
|
-
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
40
|
-
def game(name='game1')
|
41
|
-
build_game({
|
42
|
-
:name => name,
|
43
|
-
:width => options[:width],
|
44
|
-
:height => options[:height],
|
45
|
-
:landscape => options[:landscape]
|
46
|
-
})
|
47
|
-
end
|
32
|
+
def game(name='game1') end
|
48
33
|
|
49
34
|
desc "ebook [NAME]", "generate a corona ebook project"
|
50
|
-
|
51
|
-
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
52
|
-
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
53
|
-
def ebook(name='ebook1')
|
54
|
-
build_ebook({
|
55
|
-
:name => name,
|
56
|
-
:width => options[:width],
|
57
|
-
:height => options[:height],
|
58
|
-
:landscape => options[:landscape]
|
59
|
-
})
|
60
|
-
end
|
35
|
+
def ebook(name='ebook1') end
|
61
36
|
|
62
37
|
desc "app [NAME]", "generate a corona app project"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
38
|
+
def app(name='app1') end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def processing(name,method)
|
43
|
+
@name, @width, @height, @orient = name,
|
44
|
+
options[:width],
|
45
|
+
options[:height],
|
46
|
+
options[:landscape] ?
|
47
|
+
%{ "landscapeLeft", "landscapeRight" } : %{ "portrait", "portraitUpsideDown" }
|
48
|
+
send "build_#{method}"
|
49
|
+
end
|
74
50
|
|
75
51
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Extensions
|
2
|
+
module MethodHooker
|
3
|
+
def self.included(base)
|
4
|
+
base.extend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.extended(base)
|
8
|
+
base.extend(ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def before_each_method type, &block
|
13
|
+
singleton = class << self; self; end
|
14
|
+
case type
|
15
|
+
when :instance
|
16
|
+
this = self
|
17
|
+
singleton.instance_eval do
|
18
|
+
define_method :method_added do |name|
|
19
|
+
last = instance_variable_get(:@__last_methods_added)
|
20
|
+
return if last and last.include?(name)
|
21
|
+
with = :"#{name}_with_before_each_method"
|
22
|
+
without = :"#{name}_without_before_each_method"
|
23
|
+
instance_variable_set(:@__last_methods_added, [name, with, without])
|
24
|
+
this.class_eval do
|
25
|
+
define_method with do |*args, &blk|
|
26
|
+
instance_exec(name, args, blk, &block)
|
27
|
+
send without, *args, &blk
|
28
|
+
end
|
29
|
+
alias_method without, name
|
30
|
+
alias_method name, with
|
31
|
+
end
|
32
|
+
instance_variable_set(:@__last_methods_added, nil)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
when :class
|
36
|
+
this = self
|
37
|
+
singleton.instance_eval do
|
38
|
+
define_method :singleton_method_added do |name|
|
39
|
+
return if name == :singleton_method_added
|
40
|
+
last = instance_variable_get(:@__last_singleton_methods_added)
|
41
|
+
return if last and last.include?(name)
|
42
|
+
with = :"#{name}_with_before_each_method"
|
43
|
+
without = :"#{name}_without_before_each_method"
|
44
|
+
instance_variable_set(:@__last_singleton_methods_added, [name, with, without])
|
45
|
+
singleton.class_eval do
|
46
|
+
define_method with do |*args, &blk|
|
47
|
+
instance_exec(name, args, blk, &block)
|
48
|
+
send without, *args, &blk
|
49
|
+
end
|
50
|
+
alias_method without, name
|
51
|
+
alias_method name, with
|
52
|
+
end
|
53
|
+
instance_variable_set(:@__last_singleton_methods_added, nil)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def before_class_method &block
|
60
|
+
before_each_method :class, &block
|
61
|
+
end
|
62
|
+
|
63
|
+
def before_instance_method &block
|
64
|
+
before_each_method :instance, &block
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coronate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eiffel Qiu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -140,6 +140,8 @@ files:
|
|
140
140
|
- lib/coronate/builder/templates/project/utils.tt
|
141
141
|
- lib/coronate/builder/templates/scene/scene.tt
|
142
142
|
- lib/coronate/cli.rb
|
143
|
+
- lib/coronate/extensions/method_hooker.rb
|
144
|
+
- lib/coronate/extensions/string_extention.rb
|
143
145
|
- LICENSE.txt
|
144
146
|
- README.md
|
145
147
|
- bin/coronate
|