gator 0.0.11.pre → 0.0.12.pre

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11.pre
1
+ 0.0.12.pre
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gator}
8
- s.version = "0.0.11.pre"
8
+ s.version = "0.0.12.pre"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dominic Graefen"]
12
- s.date = %q{2011-07-05}
12
+ s.date = %q{2011-07-06}
13
13
  s.default_executable = %q{gator}
14
14
  s.description = %q{gator - the friendly code-generator}
15
15
  s.email = %q{dominic.graefen@gmail.com}
@@ -36,8 +36,11 @@ Gem::Specification.new do |s|
36
36
  "lib/gator/config.rb",
37
37
  "lib/gator/generator.rb",
38
38
  "lib/gator/generators.rb",
39
- "lib/gator/generators/ClassTemplate.as.tt",
40
- "lib/gator/generators/as3_generator.rb",
39
+ "lib/gator/generators/as3/ClassTemplate.as.tt",
40
+ "lib/gator/generators/as3/class_generator.rb",
41
+ "lib/gator/generators/as3/collections.rb",
42
+ "lib/gator/generators/as3/test/ClassTemplate.as.tt",
43
+ "lib/gator/generators/as3/test/class_test_generator.rb",
41
44
  "lib/gator/project.rb",
42
45
  "lib/gator/runner.rb",
43
46
  "lib/gator/util.rb",
@@ -1,8 +1,22 @@
1
1
  module Gator
2
2
  class Command < Thor
3
- def self.register_command( name, usage, description, mappings=[], options={} )
4
- Gator::Runner.register self, name, usage,description,options
5
- Gator::Runner.map mappings => name
3
+ def self.register_command(target, name, usage, description, mappings=[], options={})
4
+ target.register self, name, usage, description, options
5
+ target.map mappings => name
6
6
  end
7
+
8
+ #The following lines fixes a bug in thor see: https://github.com/wycats/thor/pull/150
9
+ class << self
10
+ def register(klass, subcommand_name, usage, description, options={})
11
+ if klass <= Thor::Group
12
+ desc usage, description, options
13
+ define_method(subcommand_name) { |*args| invoke klass }
14
+ else
15
+ desc usage, description, options
16
+ subcommand subcommand_name, klass
17
+ end
18
+ end
19
+ end
20
+
7
21
  end
8
22
  end
@@ -2,9 +2,6 @@ require 'thor/actions'
2
2
 
3
3
  module Gator
4
4
  class GenerateCommand < Command
5
- include Thor::Actions
6
-
7
- register_command "generate", "generate TASK", "Generators.", ["g"]
8
-
5
+ register_command Gator::Runner, "generate", "generate TASK", "Generators.", ["g"]
9
6
  end
10
7
  end
@@ -2,13 +2,14 @@ require "thor"
2
2
  require "thor/actions"
3
3
  require "fileutils"
4
4
  require "gator/command"
5
+ require "gator/config"
5
6
 
6
7
  module Gator
7
8
  class ProjectCommand < Command
8
9
  include Thor::Actions
9
10
  include Gator::Configuration
10
11
 
11
- register_command "project", "project TASK", "Set of tasks to manage project templates.", ["p"]
12
+ register_command Gator::Runner, "project", "project TASK", "Set of tasks to manage project templates.", ["p"]
12
13
 
13
14
  def self.source_root
14
15
  Gator::Util.project_template_root
@@ -1,10 +1,12 @@
1
1
  require "thor/group"
2
+ require "thor/actions"
2
3
 
3
4
  module Gator
4
- class Generator < Thor
5
- def self.register_generator( name, usage, description, mappings=[], options={} )
6
- Gator::GenerateCommand.register self, name, usage,description,options
7
- Gator::GenerateCommand.map mappings => name
5
+ class Generator < Thor::Group
6
+ include Thor::Actions
7
+ def self.register_generator( target, name, usage, description, mappings=[], options={} )
8
+ target.register self, name, usage,description,options
9
+ target.map mappings => name
8
10
  end
9
11
  end
10
12
  end
@@ -1 +1,2 @@
1
- Dir.glob( File.join( File.dirname(__FILE__), "generators", "*.rb" ) ).each { |rb| require rb }
1
+ require File.dirname(__FILE__) + '/generators/as3/collections'
2
+ Dir.glob( File.join( File.dirname(__FILE__), "generators", "**", "*.rb" ) ).each { |rb| require rb }
@@ -0,0 +1,46 @@
1
+ module Gator
2
+ module AS3
3
+ class ClassGenerator < Generator
4
+ include Gator::Project
5
+
6
+ register_generator Gator::AS3::GeneratorCollection, "klass", "generate as3 klass CLASS_NAME", "Creates AS3 class."
7
+
8
+ argument :name
9
+
10
+ def self.source_root
11
+ File.dirname __FILE__
12
+ end
13
+
14
+ def generate
15
+ src = project.path(:src, :main, :as3)
16
+ @package_name, @class_name = split_class_name(name)
17
+ src = File.join(src, @package_name.split(".").join(File::SEPARATOR)) unless @package_name == ""
18
+ template "ClassTemplate.as.tt", File.join(src, "#{@class_name}.as")
19
+
20
+ invoke Gator::AS3::TestGeneratorCollection, "klass"
21
+ end
22
+
23
+ no_tasks {
24
+
25
+ def package_name
26
+ @package_name
27
+ end
28
+
29
+ def class_name
30
+ @class_name
31
+ end
32
+
33
+ }
34
+
35
+ protected
36
+
37
+ def split_class_name(class_name)
38
+ pieces = class_name.split "."
39
+ class_name = pieces.pop
40
+ package_name = pieces.join "."
41
+ return package_name, class_name
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,10 @@
1
+ module Gator
2
+ module AS3
3
+ class GeneratorCollection < Gator::Command
4
+ register_command Gator::GenerateCommand, "as3", "generate as3 GENERATOR", "Generators for AS3"
5
+ end
6
+ class TestGeneratorCollection < Gator::Command
7
+ register_command GeneratorCollection, "test", "generate as3 test GENERATOR", "TestGenerators for AS3"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ package <%= package_name %>
2
+ {
3
+ public class <%= class_name %>
4
+ {
5
+ public function <%= class_name %>()
6
+ {
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,47 @@
1
+ module Gator
2
+ module AS3
3
+ class ClassTestGenerator < Generator
4
+ include Gator::Project
5
+
6
+ register_generator Gator::AS3::TestGeneratorCollection, "klass", "generate as3 test klass CLASS_NAME", "Creates AS3 class test."
7
+
8
+ argument :name
9
+
10
+ def self.source_root
11
+ File.dirname __FILE__
12
+ end
13
+
14
+ def generate
15
+ src = project.path(:src, :test, :as3)
16
+ @package_name, @class_name = split_class_name(name)
17
+ @class_name += "Test"
18
+ src = File.join(src, @package_name.split(".").join(File::SEPARATOR)) unless @package_name == ""
19
+ template "ClassTemplate.as.tt", File.join(src, "#{@class_name}.as")
20
+
21
+ invoke Gator::AS3::GeneratorCollection, "klass"
22
+ end
23
+
24
+ no_tasks {
25
+
26
+ def package_name
27
+ @package_name
28
+ end
29
+
30
+ def class_name
31
+ @class_name
32
+ end
33
+
34
+ }
35
+
36
+ protected
37
+
38
+ def split_class_name(class_name)
39
+ pieces = class_name.split "."
40
+ class_name = pieces.pop
41
+ package_name = pieces.join "."
42
+ return package_name, class_name
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -16,5 +16,18 @@ module Gator
16
16
  say "Gator --pre"
17
17
  end
18
18
 
19
+ #The following lines fixes a bug in thor see: https://github.com/wycats/thor/pull/150
20
+ class << self
21
+ def register(klass, subcommand_name, usage, description, options={})
22
+ if klass <= Thor::Group
23
+ desc usage, description, options
24
+ define_method(subcommand_name) { |*args| invoke klass }
25
+ else
26
+ desc usage, description, options
27
+ subcommand subcommand_name, klass
28
+ end
29
+ end
30
+ end
31
+
19
32
  end
20
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11.pre
4
+ version: 0.0.12.pre
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-05 00:00:00.000000000 +02:00
12
+ date: 2011-07-06 00:00:00.000000000 +02:00
13
13
  default_executable: gator
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
17
- requirement: &2153996000 !ruby/object:Gem::Requirement
17
+ requirement: &2157657900 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.14.6
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2153996000
25
+ version_requirements: *2157657900
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2153995480 !ruby/object:Gem::Requirement
28
+ requirement: &2157657320 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.3.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2153995480
36
+ version_requirements: *2157657320
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2153994960 !ruby/object:Gem::Requirement
39
+ requirement: &2157656800 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2153994960
47
+ version_requirements: *2157656800
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: jeweler
50
- requirement: &2153994480 !ruby/object:Gem::Requirement
50
+ requirement: &2157656200 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.6.2
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2153994480
58
+ version_requirements: *2157656200
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rcov
61
- requirement: &2153993980 !ruby/object:Gem::Requirement
61
+ requirement: &2157655480 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2153993980
69
+ version_requirements: *2157655480
70
70
  description: gator - the friendly code-generator
71
71
  email: dominic.graefen@gmail.com
72
72
  executables:
@@ -93,8 +93,11 @@ files:
93
93
  - lib/gator/config.rb
94
94
  - lib/gator/generator.rb
95
95
  - lib/gator/generators.rb
96
- - lib/gator/generators/ClassTemplate.as.tt
97
- - lib/gator/generators/as3_generator.rb
96
+ - lib/gator/generators/as3/ClassTemplate.as.tt
97
+ - lib/gator/generators/as3/class_generator.rb
98
+ - lib/gator/generators/as3/collections.rb
99
+ - lib/gator/generators/as3/test/ClassTemplate.as.tt
100
+ - lib/gator/generators/as3/test/class_test_generator.rb
98
101
  - lib/gator/project.rb
99
102
  - lib/gator/runner.rb
100
103
  - lib/gator/util.rb
@@ -115,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
118
  version: '0'
116
119
  segments:
117
120
  - 0
118
- hash: -2931882300168997229
121
+ hash: -387151882015572738
119
122
  required_rubygems_version: !ruby/object:Gem::Requirement
120
123
  none: false
121
124
  requirements:
@@ -1,45 +0,0 @@
1
- require "gator/generator"
2
- require "gator/project"
3
-
4
- module Gator
5
- class AS3Generator < Gator::Generator
6
- include Thor::Actions
7
- include Gator::Project
8
-
9
- register_generator "as3", "generate as3 CLASS_NAME", "Creates a class."
10
-
11
- def self.source_root
12
- File.dirname __FILE__
13
- end
14
-
15
- desc "as3 klass CLASS_NAME", "Creates an AS3 Class"
16
- def klass(class_name)
17
- src = project.path(:src,:main,:as3)
18
- @package_name, @class_name = split_class_name(class_name)
19
- src = File.join( src, @package_name.split(".").join(File::SEPARATOR) ) unless @package_name == ""
20
- template "ClassTemplate.as.tt", File.join( src, "#{@class_name}.as")
21
- end
22
-
23
- no_tasks {
24
-
25
- def package_name
26
- @package_name
27
- end
28
-
29
- def class_name
30
- @class_name
31
- end
32
-
33
- }
34
-
35
- protected
36
-
37
- def split_class_name(class_name)
38
- pieces = class_name.split "."
39
- class_name = pieces.pop
40
- package_name = pieces.join "."
41
- return package_name, class_name
42
- end
43
-
44
- end
45
- end