gator 0.0.14.pre → 0.0.16.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ gem "thor", "~>0.14.6"
9
9
  # Include everything needed to run rake, tests, features, etc.
10
10
  group :development do
11
11
  gem "rspec", "~> 2.3.0"
12
+ gem "ci_reporter", "~> 1.6.5"
12
13
  gem "bundler", "~> 1.0.0"
13
14
  gem "jeweler", "~> 1.6.2"
14
15
  gem "rcov", ">= 0"
@@ -1,6 +1,6 @@
1
1
  = gator
2
2
 
3
- Description goes here.
3
+ gator - the friendly code generator
4
4
 
5
5
  == Contributing to gator
6
6
 
data/Rakefile CHANGED
@@ -27,10 +27,15 @@ Jeweler::RubygemsDotOrgTasks.new
27
27
 
28
28
  require 'rspec/core'
29
29
  require 'rspec/core/rake_task'
30
+ require 'ci/reporter/rake/rspec'
31
+
32
+ ENV["CI_REPORTS"] ||= File.expand_path( File.join( File.dirname(__FILE__), "test", "report" ) )
30
33
  RSpec::Core::RakeTask.new(:spec) do |spec|
31
34
  spec.pattern = FileList['spec/**/*_spec.rb']
32
35
  end
33
36
 
37
+ task :spec => "ci:setup:rspec"
38
+
34
39
  RSpec::Core::RakeTask.new(:rcov) do |spec|
35
40
  spec.pattern = 'spec/**/*_spec.rb'
36
41
  spec.rcov = true
@@ -39,7 +44,7 @@ end
39
44
  task :test => :spec
40
45
  task :default => :spec
41
46
 
42
- require 'rake/rdoctask'
47
+ require 'rdoc/task'
43
48
  Rake::RDocTask.new do |rdoc|
44
49
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
50
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.14.pre
1
+ 0.0.16.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.14.pre"
8
+ s.version = "0.0.16.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-06}
12
+ s.date = %q{2011-07-11}
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}
@@ -34,17 +34,18 @@ Gem::Specification.new do |s|
34
34
  "lib/gator/commands/generate.rb",
35
35
  "lib/gator/commands/project.rb",
36
36
  "lib/gator/config.rb",
37
- "lib/gator/generators.rb",
38
- "lib/gator/generators/as3/ClassTemplate.as.tt",
39
- "lib/gator/generators/as3/class_generator.rb",
40
- "lib/gator/generators/as3/collections.rb",
41
- "lib/gator/generators/as3/test/ClassTemplate.as.tt",
42
- "lib/gator/generators/as3/test/class_test_generator.rb",
43
37
  "lib/gator/project.rb",
44
38
  "lib/gator/runner.rb",
45
39
  "lib/gator/task.rb",
46
40
  "lib/gator/util.rb",
47
- "spec/spec_helper.rb"
41
+ "spec/command_spec.rb",
42
+ "spec/config_spec.rb",
43
+ "spec/fixtures/empty_gator_project/gator.rb",
44
+ "spec/project_spec.rb",
45
+ "spec/runner_spec.rb",
46
+ "spec/spec_helper.rb",
47
+ "spec/task_spec.rb",
48
+ "spec/util_spec.rb"
48
49
  ]
49
50
  s.homepage = %q{http://github.com/devboy/gator}
50
51
  s.licenses = ["MIT"]
@@ -58,12 +59,14 @@ Gem::Specification.new do |s|
58
59
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
60
  s.add_runtime_dependency(%q<thor>, ["~> 0.14.6"])
60
61
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
62
+ s.add_development_dependency(%q<ci_reporter>, ["~> 1.6.5"])
61
63
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
62
64
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
63
65
  s.add_development_dependency(%q<rcov>, [">= 0"])
64
66
  else
65
67
  s.add_dependency(%q<thor>, ["~> 0.14.6"])
66
68
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
69
+ s.add_dependency(%q<ci_reporter>, ["~> 1.6.5"])
67
70
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
68
71
  s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
69
72
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -71,6 +74,7 @@ Gem::Specification.new do |s|
71
74
  else
72
75
  s.add_dependency(%q<thor>, ["~> 0.14.6"])
73
76
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
77
+ s.add_dependency(%q<ci_reporter>, ["~> 1.6.5"])
74
78
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
75
79
  s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
76
80
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -4,5 +4,4 @@ require 'gator/util'
4
4
  require 'gator/command'
5
5
  require 'gator/task'
6
6
  require 'gator/runner'
7
- require 'gator/commands'
8
- require 'gator/generators'
7
+ require 'gator/commands'
@@ -1,12 +1,73 @@
1
1
  module Gator
2
- class Command < Thor
3
2
 
4
- def self.define( definition )
5
- @definition = d = definition
6
- d[:on].register self, d[:as], d[:usage], d[:description], d[:options] || {}
7
- d[:on].map [ d[:short] ] => d[:as] unless d[:short].nil?
3
+ module ActAsCommand
4
+
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
8
7
  end
9
8
 
9
+ module ClassMethods
10
+
11
+ attr_reader :definition, :parent
12
+
13
+ def define(definition)
14
+ @definition = definition
15
+ end
16
+
17
+ def parent_command=(klass)
18
+ @parent = klass
19
+ end
20
+
21
+ end
22
+
23
+ def parent
24
+ self.class.parent
25
+ end
26
+
27
+ def get_subcommand(*args)
28
+ nil
29
+ end
30
+
31
+ end
32
+
33
+ module ActAsCommandCollection
34
+
35
+ def self.included(base)
36
+ base.extend(ClassMethods)
37
+ end
38
+
39
+ module ClassMethods
40
+
41
+ def subcommand_classes
42
+ @subcommand_classes ||= {}
43
+ end
44
+
45
+ def register_subcommand(klass)
46
+ d = klass.definition
47
+ register klass, d[:command], d[:usage], d[:description], d[:options] || {}
48
+ map [d[:short]] => d[:command] unless d[:short].nil?
49
+ subcommand_classes[d[:command]] = klass
50
+ klass.parent_command = self
51
+ end
52
+
53
+ def get_subcommand(*args)
54
+ arg = args.shift
55
+ klass = subcommand_classes[arg.to_s]
56
+ until args.empty? do
57
+ arg = args.shift
58
+ klass = klass.subcommand_classes[arg]
59
+ end
60
+ klass
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ class Command < Thor
68
+ include ActAsCommand
69
+ include ActAsCommandCollection
70
+
10
71
  #The following lines fix a bug in thor see: https://github.com/wycats/thor/pull/150
11
72
  class << self
12
73
  def register(klass, subcommand_name, usage, description, options={})
@@ -1 +1,5 @@
1
- Dir.glob( File.join( File.dirname(__FILE__), "commands", "*.rb" ) ).each { |rb| require rb }
1
+ require File.dirname(__FILE__) + '/commands/project'
2
+ require File.dirname(__FILE__) + '/commands/generate'
3
+
4
+ Gator::Runner.register_subcommand Gator::ProjectCommand
5
+ Gator::Runner.register_subcommand Gator::GenerateCommand
@@ -2,7 +2,7 @@ require 'thor/actions'
2
2
 
3
3
  module Gator
4
4
  class GenerateCommand < Command
5
- define :on => Gator::Runner, :as => "generate", :short => "g",
5
+ define :command => "generate", :short => "g",
6
6
  :usage => "generate TASK", :description => "Generators."
7
7
  end
8
8
  end
@@ -1,15 +1,13 @@
1
1
  require "thor"
2
2
  require "thor/actions"
3
3
  require "fileutils"
4
- require "gator/command"
5
- require "gator/config"
6
4
 
7
5
  module Gator
8
6
  class ProjectCommand < Command
9
7
  include Thor::Actions
10
8
  include Gator::Configuration
11
9
 
12
- define :on => Gator::Runner, :as => "project", :short => "p",
10
+ define :command => "project", :short => "p",
13
11
  :usage => "project TASK", :description => "Set of tasks to manage project templates."
14
12
 
15
13
  def self.source_root
@@ -3,13 +3,7 @@ require "thor/actions"
3
3
 
4
4
  module Gator
5
5
  class Task < Thor::Group
6
+ include ActAsCommand
6
7
  include Thor::Actions
7
-
8
- def self.define( definition )
9
- @definition = d = definition
10
- d[:on].register self, d[:as], d[:usage], d[:description], d[:options] || {}
11
- d[:on].map [ d[:short] ] => d[:as] unless d[:short].nil?
12
- end
13
-
14
8
  end
15
9
  end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+
4
+ describe Gator::ActAsCommand do
5
+
6
+ it "should have some tests"
7
+
8
+ end
9
+
10
+ describe Gator::ActAsCommandCollection do
11
+
12
+ it "should have some tests"
13
+
14
+ end
15
+
16
+ describe Gator::Command do
17
+
18
+ it "should have some tests"
19
+
20
+ end
@@ -0,0 +1,14 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+
4
+ describe Gator::Configuration do
5
+
6
+ it "should have some tests"
7
+
8
+ end
9
+
10
+ describe Gator::GatorConfiguration do
11
+
12
+ it "should have some tests"
13
+
14
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+
4
+ describe Gator::Project do
5
+
6
+ it "should have some tests"
7
+
8
+ end
9
+
10
+ describe Gator::Project::Layout do
11
+
12
+ it "should have some tests"
13
+ it "could be the tests from the buildr project"
14
+
15
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+
4
+ describe Gator::Runner do
5
+
6
+ it "should have some tests"
7
+
8
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+
4
+ describe Gator::Task do
5
+
6
+ it "should have some tests"
7
+
8
+ end
@@ -0,0 +1,60 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+
4
+ describe Gator::Util do
5
+
6
+ it "should contain the correct filenames" do
7
+ Gator::Util.gator_files.include?("gator").should == true
8
+ Gator::Util.gator_files.include?("gator.rb").should == true
9
+ end
10
+
11
+ it "should contain the correct filenames for directory" do
12
+ Gator::Util.gator_files_for("testdir").include?("testdir/gator").should == true
13
+ Gator::Util.gator_files_for("testdir").include?("testdir/gator.rb").should == true
14
+ end
15
+
16
+ it "should provide the correct gator root directory" do
17
+ Gator::Util.gator_root.should == File.join(File.expand_path("~"), ".gator")
18
+ end
19
+
20
+ it "should provide the correct project template directory" do
21
+ Gator::Util.project_template_root.should == File.join(Gator::Util.gator_root, "templates", "projects")
22
+ end
23
+
24
+ it "should load a rubyfile correctly"
25
+
26
+ it "should find the gator project directory from project base directory" do
27
+ project_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/empty_gator_project')
28
+ Gator::Util.find_gator_project(project_dir).should == project_dir
29
+ end
30
+
31
+ it "should find the gator project directory from a project subdirectory" do
32
+ project_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/empty_gator_project')
33
+ sub_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/empty_gator_project/sub_dir')
34
+ Gator::Util.find_gator_project(sub_dir).should == project_dir
35
+ end
36
+
37
+ it "should find the gator.rb file from project base directory" do
38
+ project_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/empty_gator_project')
39
+ file = File.join(project_dir, "gator.rb")
40
+ Gator::Util.find_gator_project_file(project_dir).should == file
41
+ end
42
+
43
+ it "should find the gator.rb file from a project subdirectory" do
44
+ project_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/empty_gator_project')
45
+ sub_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/empty_gator_project/sub_dir')
46
+ file = File.join(project_dir, "gator.rb")
47
+ Gator::Util.find_gator_project_file(sub_dir).should == file
48
+ end
49
+
50
+ it "should not find a gator project in a project without gator.rb from the its base directory" do
51
+ project_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/no_gator_file')
52
+ Gator::Util.find_gator_project(project_dir).should == nil
53
+ end
54
+
55
+ it "should not find a gator project in a project without gator.rb from the a subdirectory" do
56
+ project_dir = File.expand_path(File.dirname(__FILE__) + '/fixtures/no_gator_file/subdir')
57
+ Gator::Util.find_gator_project(project_dir).should == nil
58
+ end
59
+
60
+ 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.14.pre
4
+ version: 0.0.16.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-06 00:00:00.000000000 +02:00
12
+ date: 2011-07-11 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: &2157356460 !ruby/object:Gem::Requirement
17
+ requirement: &2155529440 !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: *2157356460
25
+ version_requirements: *2155529440
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2157355940 !ruby/object:Gem::Requirement
28
+ requirement: &2155528920 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,21 @@ dependencies:
33
33
  version: 2.3.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2157355940
36
+ version_requirements: *2155528920
37
+ - !ruby/object:Gem::Dependency
38
+ name: ci_reporter
39
+ requirement: &2155528440 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.6.5
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *2155528440
37
48
  - !ruby/object:Gem::Dependency
38
49
  name: bundler
39
- requirement: &2157355400 !ruby/object:Gem::Requirement
50
+ requirement: &2155527940 !ruby/object:Gem::Requirement
40
51
  none: false
41
52
  requirements:
42
53
  - - ~>
@@ -44,10 +55,10 @@ dependencies:
44
55
  version: 1.0.0
45
56
  type: :development
46
57
  prerelease: false
47
- version_requirements: *2157355400
58
+ version_requirements: *2155527940
48
59
  - !ruby/object:Gem::Dependency
49
60
  name: jeweler
50
- requirement: &2157354800 !ruby/object:Gem::Requirement
61
+ requirement: &2155527460 !ruby/object:Gem::Requirement
51
62
  none: false
52
63
  requirements:
53
64
  - - ~>
@@ -55,10 +66,10 @@ dependencies:
55
66
  version: 1.6.2
56
67
  type: :development
57
68
  prerelease: false
58
- version_requirements: *2157354800
69
+ version_requirements: *2155527460
59
70
  - !ruby/object:Gem::Dependency
60
71
  name: rcov
61
- requirement: &2157346500 !ruby/object:Gem::Requirement
72
+ requirement: &2155526940 !ruby/object:Gem::Requirement
62
73
  none: false
63
74
  requirements:
64
75
  - - ! '>='
@@ -66,7 +77,7 @@ dependencies:
66
77
  version: '0'
67
78
  type: :development
68
79
  prerelease: false
69
- version_requirements: *2157346500
80
+ version_requirements: *2155526940
70
81
  description: gator - the friendly code-generator
71
82
  email: dominic.graefen@gmail.com
72
83
  executables:
@@ -91,17 +102,18 @@ files:
91
102
  - lib/gator/commands/generate.rb
92
103
  - lib/gator/commands/project.rb
93
104
  - lib/gator/config.rb
94
- - lib/gator/generators.rb
95
- - lib/gator/generators/as3/ClassTemplate.as.tt
96
- - lib/gator/generators/as3/class_generator.rb
97
- - lib/gator/generators/as3/collections.rb
98
- - lib/gator/generators/as3/test/ClassTemplate.as.tt
99
- - lib/gator/generators/as3/test/class_test_generator.rb
100
105
  - lib/gator/project.rb
101
106
  - lib/gator/runner.rb
102
107
  - lib/gator/task.rb
103
108
  - lib/gator/util.rb
109
+ - spec/command_spec.rb
110
+ - spec/config_spec.rb
111
+ - spec/fixtures/empty_gator_project/gator.rb
112
+ - spec/project_spec.rb
113
+ - spec/runner_spec.rb
104
114
  - spec/spec_helper.rb
115
+ - spec/task_spec.rb
116
+ - spec/util_spec.rb
105
117
  has_rdoc: true
106
118
  homepage: http://github.com/devboy/gator
107
119
  licenses:
@@ -118,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
130
  version: '0'
119
131
  segments:
120
132
  - 0
121
- hash: -355308578619065228
133
+ hash: -2787342404688120478
122
134
  required_rubygems_version: !ruby/object:Gem::Requirement
123
135
  none: false
124
136
  requirements:
@@ -1,2 +0,0 @@
1
- require File.dirname(__FILE__) + '/generators/as3/collections'
2
- Dir.glob( File.join( File.dirname(__FILE__), "generators", "**", "*.rb" ) ).each { |rb| require rb }
@@ -1,9 +0,0 @@
1
- package <%= package_name %>
2
- {
3
- public class <%= class_name %>
4
- {
5
- public function <%= class_name %>()
6
- {
7
- }
8
- }
9
- }
@@ -1,47 +0,0 @@
1
- module Gator
2
- module AS3
3
- class ClassGenerator < Task
4
- include Gator::Project
5
-
6
- define :on => Gator::AS3::GeneratorCollection, :as => "klass",
7
- :usage => "generate as3 klass CLASS_NAME", :description => "Creates AS3 class."
8
-
9
- argument :classname
10
-
11
- def self.source_root
12
- File.dirname __FILE__
13
- end
14
-
15
- def generate
16
- src = project.path(:src, :main, :as3)
17
- @package_name, @class_name = split_class_name(classname)
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::TestGeneratorCollection, "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
@@ -1,15 +0,0 @@
1
- module Gator
2
- module AS3
3
-
4
- class GeneratorCollection < Gator::Command
5
- define :on => Gator::GenerateCommand, :as => "as3",
6
- :usage => "generate as3 GENERATOR", :description => "Generators for AS3."
7
- end
8
-
9
- class TestGeneratorCollection < Gator::Command
10
- define :on => GeneratorCollection, :as => "test",
11
- :usage => "generate as3 test GENERATOR", :description => "TestGenerators for AS3."
12
- end
13
-
14
- end
15
- end
@@ -1,9 +0,0 @@
1
- package <%= package_name %>
2
- {
3
- public class <%= class_name %>
4
- {
5
- public function <%= class_name %>()
6
- {
7
- }
8
- }
9
- }
@@ -1,48 +0,0 @@
1
- module Gator
2
- module AS3
3
- class ClassTestGenerator < Task
4
- include Gator::Project
5
-
6
- define :on => Gator::AS3::TestGeneratorCollection, :as => "klass",
7
- :usage => "generate as3 test klass CLASS_NAME", :description => "Creates AS3 class test."
8
-
9
- argument :classname
10
-
11
- def self.source_root
12
- File.dirname __FILE__
13
- end
14
-
15
- def generate
16
- src = project.path(:src, :test, :as3)
17
- @package_name, @class_name = split_class_name(classname)
18
- @class_name += "Test"
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
-
22
- invoke Gator::AS3::GeneratorCollection, "klass"
23
- end
24
-
25
- no_tasks {
26
-
27
- def package_name
28
- @package_name
29
- end
30
-
31
- def class_name
32
- @class_name
33
- end
34
-
35
- }
36
-
37
- protected
38
-
39
- def split_class_name(class_name)
40
- pieces = class_name.split "."
41
- class_name = pieces.pop
42
- package_name = pieces.join "."
43
- return package_name, class_name
44
- end
45
-
46
- end
47
- end
48
- end