gator 0.0.10.pre → 0.0.11.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.10.pre
1
+ 0.0.11.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.10.pre"
8
+ s.version = "0.0.11.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-04}
12
+ s.date = %q{2011-07-05}
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}
@@ -29,11 +29,16 @@ Gem::Specification.new do |s|
29
29
  "bin/gator",
30
30
  "gator.gemspec",
31
31
  "lib/gator.rb",
32
- "lib/gator/commands/command.rb",
32
+ "lib/gator/command.rb",
33
+ "lib/gator/commands.rb",
34
+ "lib/gator/commands/generate_command.rb",
33
35
  "lib/gator/commands/project_command.rb",
34
36
  "lib/gator/config.rb",
35
- "lib/gator/project/layout.rb",
36
- "lib/gator/project/project.rb",
37
+ "lib/gator/generator.rb",
38
+ "lib/gator/generators.rb",
39
+ "lib/gator/generators/ClassTemplate.as.tt",
40
+ "lib/gator/generators/as3_generator.rb",
41
+ "lib/gator/project.rb",
37
42
  "lib/gator/runner.rb",
38
43
  "lib/gator/util.rb",
39
44
  "spec/spec_helper.rb"
@@ -1,5 +1,8 @@
1
- require File.dirname(__FILE__) + '/gator/config'
2
- require File.dirname(__FILE__) + '/gator/util'
3
- require File.dirname(__FILE__) + '/gator/runner'
4
- require File.dirname(__FILE__) + '/gator/commands/command'
5
- require File.dirname(__FILE__) + '/gator/commands/project_command'
1
+ require 'gator/config'
2
+ require 'gator/project'
3
+ require 'gator/util'
4
+ require 'gator/runner'
5
+ require 'gator/command'
6
+ require 'gator/commands'
7
+ require 'gator/generator'
8
+ require 'gator/generators'
@@ -1,5 +1,3 @@
1
- require File.dirname(__FILE__) + '/../runner'
2
-
3
1
  module Gator
4
2
  class Command < Thor
5
3
  def self.register_command( name, usage, description, mappings=[], options={} )
@@ -0,0 +1 @@
1
+ Dir.glob( File.join( File.dirname(__FILE__), "commands", "*.rb" ) ).each { |rb| require rb }
@@ -0,0 +1,10 @@
1
+ require 'thor/actions'
2
+
3
+ module Gator
4
+ class GenerateCommand < Command
5
+ include Thor::Actions
6
+
7
+ register_command "generate", "generate TASK", "Generators.", ["g"]
8
+
9
+ end
10
+ end
@@ -1,12 +1,12 @@
1
1
  require "thor"
2
2
  require "thor/actions"
3
3
  require "fileutils"
4
- require File.dirname(__FILE__) + '/../util'
5
- require File.dirname(__FILE__) + '/command'
4
+ require "gator/command"
6
5
 
7
6
  module Gator
8
7
  class ProjectCommand < Command
9
8
  include Thor::Actions
9
+ include Gator::Configuration
10
10
 
11
11
  register_command "project", "project TASK", "Set of tasks to manage project templates.", ["p"]
12
12
 
@@ -53,6 +53,10 @@ module Gator
53
53
  @project_name
54
54
  end
55
55
 
56
+ def configuration
57
+ config
58
+ end
59
+
56
60
  }
57
61
 
58
62
  private
@@ -0,0 +1,10 @@
1
+ require "thor/group"
2
+
3
+ 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
8
+ end
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ Dir.glob( File.join( File.dirname(__FILE__), "generators", "*.rb" ) ).each { |rb| require rb }
@@ -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,45 @@
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
@@ -1,5 +1,39 @@
1
1
  module Gator
2
2
  module Project
3
+
4
+ def self.project
5
+ @project
6
+ end
7
+
8
+ def self.project=(project)
9
+ @project = project
10
+ end
11
+
12
+ def project(project= nil)
13
+ Project.project = project unless project.nil?
14
+ $stderr.puts "WARNING: No project definition found." if Project.project.nil?
15
+ Project.project
16
+ end
17
+
18
+ class ProjectBase
19
+
20
+ attr_accessor :name, :layout
21
+
22
+ def initialize
23
+ @name = ""
24
+ @layout = Layout.default
25
+ end
26
+
27
+ def path(*args)
28
+ File.join(Gator::Util.find_gator_project, layout.expand(*args))
29
+ end
30
+
31
+ def options
32
+ @options ||= {}
33
+ end
34
+
35
+ end
36
+
3
37
  # THIS CLASS IS STOLEN FROM BUILDR
4
38
 
5
39
  # Symbolic mapping for directory layout. Used for both the default and custom layouts.
@@ -1,7 +1,6 @@
1
1
  require 'thor'
2
2
  require 'thor/group'
3
3
  require 'thor/actions'
4
- require File.dirname(__FILE__) + '/util'
5
4
 
6
5
  module Gator
7
6
  class Runner < Thor
@@ -2,8 +2,7 @@ require "thor"
2
2
  require "thor/util"
3
3
  require "thor/actions"
4
4
  require "pathname"
5
- require File.dirname(__FILE__) + '/config'
6
- require File.dirname(__FILE__) + '/project/project'
5
+
7
6
  module Gator
8
7
  module Sandbox
9
8
  extend Gator::Configuration
@@ -11,7 +10,7 @@ module Gator
11
10
  end
12
11
  class Util
13
12
  def self.gator_files
14
- [ "gator", "gator.rb" ]
13
+ ["gator", "gator.rb"]
15
14
  end
16
15
 
17
16
  def self.gator_files_for(dir)
@@ -64,7 +63,7 @@ module Gator
64
63
  if File.exists? gator_config
65
64
  load_rubyfile gator_config
66
65
  else
67
- FileCreator.new.config_file
66
+ ConfigFileCreator.new.config_file
68
67
  end
69
68
 
70
69
  p_file = find_gator_project_file
@@ -72,16 +71,16 @@ module Gator
72
71
 
73
72
  end
74
73
 
75
- class FileCreator < Thor
74
+ class ConfigFileCreator < Thor
76
75
  include Thor::Actions
77
76
 
78
- desc "no cli usage", "create config file"
79
- def config_file
80
- file = Gator::Util.gator_config
81
- user = ask "Username:"
82
- create_file file, "config.user='#{user}'"
83
- end
84
-
77
+ no_tasks {
78
+ def config_file
79
+ file = Gator::Util.gator_config
80
+ user = ask "Username:"
81
+ create_file file, "config.user='#{user}'"
82
+ end
83
+ }
85
84
  end
86
85
 
87
86
  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.10.pre
4
+ version: 0.0.11.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-04 00:00:00.000000000 +02:00
12
+ date: 2011-07-05 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: &2157597980 !ruby/object:Gem::Requirement
17
+ requirement: &2153996000 !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: *2157597980
25
+ version_requirements: *2153996000
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2157597460 !ruby/object:Gem::Requirement
28
+ requirement: &2153995480 !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: *2157597460
36
+ version_requirements: *2153995480
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2157596960 !ruby/object:Gem::Requirement
39
+ requirement: &2153994960 !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: *2157596960
47
+ version_requirements: *2153994960
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: jeweler
50
- requirement: &2157596440 !ruby/object:Gem::Requirement
50
+ requirement: &2153994480 !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: *2157596440
58
+ version_requirements: *2153994480
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rcov
61
- requirement: &2157595920 !ruby/object:Gem::Requirement
61
+ requirement: &2153993980 !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: *2157595920
69
+ version_requirements: *2153993980
70
70
  description: gator - the friendly code-generator
71
71
  email: dominic.graefen@gmail.com
72
72
  executables:
@@ -86,11 +86,16 @@ files:
86
86
  - bin/gator
87
87
  - gator.gemspec
88
88
  - lib/gator.rb
89
- - lib/gator/commands/command.rb
89
+ - lib/gator/command.rb
90
+ - lib/gator/commands.rb
91
+ - lib/gator/commands/generate_command.rb
90
92
  - lib/gator/commands/project_command.rb
91
93
  - lib/gator/config.rb
92
- - lib/gator/project/layout.rb
93
- - lib/gator/project/project.rb
94
+ - lib/gator/generator.rb
95
+ - lib/gator/generators.rb
96
+ - lib/gator/generators/ClassTemplate.as.tt
97
+ - lib/gator/generators/as3_generator.rb
98
+ - lib/gator/project.rb
94
99
  - lib/gator/runner.rb
95
100
  - lib/gator/util.rb
96
101
  - spec/spec_helper.rb
@@ -110,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
115
  version: '0'
111
116
  segments:
112
117
  - 0
113
- hash: -106185028060707677
118
+ hash: -2931882300168997229
114
119
  required_rubygems_version: !ruby/object:Gem::Requirement
115
120
  none: false
116
121
  requirements:
@@ -1,39 +0,0 @@
1
- require File.dirname(__FILE__) + '/../util'
2
- require File.dirname(__FILE__) + '/layout'
3
- module Gator
4
- module Project
5
-
6
- def self.project
7
- @project
8
- end
9
-
10
- def self.project=(project)
11
- @project = project
12
- end
13
-
14
- def project( project= nil )
15
- Project.project = project unless project.nil?
16
- Project.project
17
- end
18
-
19
- class ProjectBase
20
-
21
- attr_accessor :name, :layout
22
-
23
- def initialize
24
- @name = ""
25
- @layout = Layout.default
26
- end
27
-
28
- def path(*args)
29
- File.join(Gator::Util.find_gator_project, layout.expand(*args))
30
- end
31
-
32
- def options
33
- @options ||= {}
34
- end
35
-
36
- end
37
-
38
- end
39
- end