gator 0.0.21.pre → 0.0.22.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 +3 -1
- data/Rakefile +3 -6
- data/VERSION +1 -1
- data/bin/gator +2 -3
- data/gator.gemspec +52 -30
- data/lib/gator.rb +6 -8
- data/lib/gator/core.rb +19 -0
- data/lib/gator/core/application/application.rb +41 -0
- data/lib/gator/core/application/application_configuration.rb +11 -0
- data/lib/gator/core/command/act_as_command.rb +40 -0
- data/lib/gator/core/command/act_as_command_collection.rb +63 -0
- data/lib/gator/core/command/command.rb +20 -0
- data/lib/gator/{task.rb → core/command/task.rb} +1 -4
- data/lib/gator/core/configuration/act_as_configuration.rb +30 -0
- data/lib/gator/core/configuration/configuration.rb +5 -0
- data/lib/gator/core/io/paths.rb +21 -0
- data/lib/gator/core/io/project_file_locator.rb +28 -0
- data/lib/gator/core/io/ruby_file_loader.rb +21 -0
- data/lib/gator/core/io/sandbox.rb +9 -0
- data/lib/gator/{project.rb → core/project/layout.rb} +3 -44
- data/lib/gator/core/project/project.rb +21 -0
- data/lib/gator/plugins/generators.rb +5 -0
- data/lib/gator/{generators/generator.rb → plugins/generators/act_as_template_generator.rb} +1 -5
- data/lib/gator/{commands/generate.rb → plugins/generators/generate_command.rb} +1 -1
- data/lib/gator/plugins/generators/generator.rb +6 -0
- data/lib/gator/plugins/scaffolding.rb +4 -0
- data/lib/gator/plugins/scaffolding/scaffold_command.rb +62 -0
- data/lib/gator/plugins/scaffolding/scaffolding_file_utils.rb +58 -0
- data/rake/jeweler.rb +17 -0
- data/rake/jeweler_prerelease_tasks.rb +50 -0
- data/rake/pre_release_gemspec.rb +80 -0
- data/rake/pre_release_to_git.rb +59 -0
- data/spec/core/application/application_configuration_spec.rb +21 -0
- data/spec/core/application/application_spec.rb +15 -0
- data/spec/core/command/command_spec.rb +117 -0
- data/spec/core/command/task_spec.rb +95 -0
- data/spec/core/configuration/configuration_spec.rb +55 -0
- data/spec/core/io/paths_spec.rb +44 -0
- data/spec/core/io/sandbox_spec.rb +11 -0
- data/spec/core/project/layout_spec.rb +64 -0
- data/spec/core/project/project_spec.rb +51 -0
- data/spec/fixtures/empty_gator_project/gator.rb +4 -0
- data/spec/fixtures/no_gator_file/.empty_directory +0 -0
- data/spec/plugins/scaffolding/scaffold_command_spec.rb +75 -0
- data/spec/spec_helper.rb +14 -9
- metadata +65 -36
- data/lib/gator/command.rb +0 -109
- data/lib/gator/commands.rb +0 -5
- data/lib/gator/commands/project.rb +0 -87
- data/lib/gator/config.rb +0 -23
- data/lib/gator/generators.rb +0 -1
- data/lib/gator/runner.rb +0 -21
- data/lib/gator/util.rb +0 -91
- data/spec/command_spec.rb +0 -84
- data/spec/config_spec.rb +0 -14
- data/spec/project_spec.rb +0 -15
- data/spec/runner_spec.rb +0 -9
- data/spec/task_spec.rb +0 -8
- data/spec/util_spec.rb +0 -60
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
|
4
|
+
describe Gator::Project do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
@original_pwd = Dir.pwd
|
8
|
+
@project_dir = File.expand_path(File.dirname(__FILE__) + '/../../fixtures/empty_gator_project')
|
9
|
+
Dir.chdir @project_dir
|
10
|
+
end
|
11
|
+
|
12
|
+
after :all do
|
13
|
+
Dir.chdir @original_pwd
|
14
|
+
end
|
15
|
+
|
16
|
+
before :each do
|
17
|
+
@project = Gator::Project.new
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have a name property" do
|
21
|
+
@project.should respond_to(:name)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should set and get the name property" do
|
25
|
+
@project.name= "MyProject"
|
26
|
+
@project.name.should == "MyProject"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should have a layout property" do
|
30
|
+
@project.should respond_to(:layout)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should set and get the layout property" do
|
34
|
+
layout = Gator::Layout.new
|
35
|
+
@project.layout= layout
|
36
|
+
@project.layout.should equal layout
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should initially have the default layout" do
|
40
|
+
@project.layout.should equal Gator::Layout.default
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should initially have an empty array of template roots" do
|
44
|
+
@project.template_roots.should == []
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should append the project base directory to a layout mapping" do
|
48
|
+
@project.path(:abc).should == File.join( @project_dir, "abc" )
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
File without changes
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe Gator::Scaffolding::ScaffoldCommand do
|
4
|
+
include Gator::Scaffolding
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
@scaffold_command = ScaffoldCommand.new
|
8
|
+
@file_util = @scaffold_command.send(:file_util)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should have the scaffolds home as source root" do
|
12
|
+
ScaffoldCommand.source_root.should == ScaffoldingFileUtils.new.scaffolds_home
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have the correct definition" do
|
16
|
+
definition = { :command => "scaffold", :short => "s",
|
17
|
+
:usage => "scaffold TASK", :description => "Set of tasks to manage scaffold templates." }
|
18
|
+
ScaffoldCommand.definition.should == definition
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should install a scaffold with path & name" do
|
22
|
+
path, name = "myPath", "myName"
|
23
|
+
@file_util.should_receive(:install_scaffold).with path, name
|
24
|
+
@scaffold_command.install(path, name)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should install a scaffold with path only" do
|
28
|
+
path = "myName"
|
29
|
+
@file_util.should_receive(:install_scaffold).with path, nil
|
30
|
+
@scaffold_command.install(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should uninstall a scaffold" do
|
34
|
+
name = "myProjectName"
|
35
|
+
@file_util.should_receive(:delete_scaffold).with name
|
36
|
+
@scaffold_command.uninstall(name)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should create a new directory from a template" do
|
40
|
+
name = "MyName"
|
41
|
+
scaffold = "MyScaffold"
|
42
|
+
@scaffold_command.should_receive(:directory).with @file_util.scaffold_directory(scaffold), File.expand_path(name)
|
43
|
+
@scaffold_command.new name, scaffold
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should uninstall all scaffolds" do
|
47
|
+
@file_util.should_receive(:delete_all_scaffolds)
|
48
|
+
@scaffold_command.wipe
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should uninstall all scaffolds" do
|
52
|
+
@file_util.should_receive(:delete_all_scaffolds)
|
53
|
+
@scaffold_command.wipe
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should display the installed scaffolds" do
|
57
|
+
entries = ["ScaffoldA", "ScaffoldB", "ScaffoldC"]
|
58
|
+
@file_util.stub!(:scaffold_entries).and_return entries
|
59
|
+
entries.each do |entry|
|
60
|
+
@scaffold_command.should_receive(:say).with " #{entry}"
|
61
|
+
end
|
62
|
+
@scaffold_command.list
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should display 'No templates found.' scaffold directory is empty" do
|
66
|
+
@file_util.stub!(:scaffold_entries).and_return []
|
67
|
+
@scaffold_command.should_receive(:say).with 'No templates found.', anything
|
68
|
+
@scaffold_command.list
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should have a valid file_utils object" do
|
72
|
+
@file_util.should be_a Gator::Scaffolding::ScaffoldingFileUtils
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'gator'
|
1
|
+
unless defined?(SpecHelpers)
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
require 'simplecov'
|
4
|
+
require 'simplecov-rcov'
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
7
|
+
SimpleCov.root( File.dirname( __FILE__) + '/../' )
|
8
|
+
SimpleCov.coverage_dir( File.join( "test", "coverage" ) )
|
9
|
+
SimpleCov.start
|
10
|
+
|
11
|
+
require File.dirname(__FILE__)+'/../lib/gator'
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
end
|
9
15
|
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
16
|
end
|
17
|
+
|
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.
|
4
|
+
version: 0.0.22.pre
|
5
5
|
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable: gator
|
12
|
+
date: 2011-10-12 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: thor
|
17
|
-
requirement: &
|
16
|
+
requirement: &2159010900 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: 0.14.6
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *2159010900
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: rspec
|
28
|
-
requirement: &
|
27
|
+
requirement: &2158996000 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ~>
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: 2.3.0
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *2158996000
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: ci_reporter
|
39
|
-
requirement: &
|
38
|
+
requirement: &2158995320 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ~>
|
@@ -44,10 +43,10 @@ dependencies:
|
|
44
43
|
version: 1.6.5
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *2158995320
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: bundler
|
50
|
-
requirement: &
|
49
|
+
requirement: &2158993980 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
51
|
requirements:
|
53
52
|
- - ~>
|
@@ -55,10 +54,10 @@ dependencies:
|
|
55
54
|
version: 1.0.0
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
57
|
+
version_requirements: *2158993980
|
59
58
|
- !ruby/object:Gem::Dependency
|
60
59
|
name: jeweler
|
61
|
-
requirement: &
|
60
|
+
requirement: &2158992680 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
62
|
requirements:
|
64
63
|
- - ~>
|
@@ -66,10 +65,10 @@ dependencies:
|
|
66
65
|
version: 1.6.2
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
68
|
+
version_requirements: *2158992680
|
70
69
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
72
|
-
requirement: &
|
70
|
+
name: simplecov
|
71
|
+
requirement: &2158991160 !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
74
73
|
requirements:
|
75
74
|
- - ! '>='
|
@@ -77,7 +76,18 @@ dependencies:
|
|
77
76
|
version: '0'
|
78
77
|
type: :development
|
79
78
|
prerelease: false
|
80
|
-
version_requirements: *
|
79
|
+
version_requirements: *2158991160
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: simplecov-rcov
|
82
|
+
requirement: &2158989020 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2158989020
|
81
91
|
description: gator - the friendly code-generator
|
82
92
|
email: dominic.graefen@gmail.com
|
83
93
|
executables:
|
@@ -97,26 +107,45 @@ files:
|
|
97
107
|
- bin/gator
|
98
108
|
- gator.gemspec
|
99
109
|
- lib/gator.rb
|
100
|
-
- lib/gator/
|
101
|
-
- lib/gator/
|
102
|
-
- lib/gator/
|
103
|
-
- lib/gator/
|
104
|
-
- lib/gator/
|
105
|
-
- lib/gator/
|
106
|
-
- lib/gator/
|
107
|
-
- lib/gator/
|
108
|
-
- lib/gator/
|
109
|
-
- lib/gator/
|
110
|
-
- lib/gator/
|
111
|
-
-
|
112
|
-
-
|
110
|
+
- lib/gator/core.rb
|
111
|
+
- lib/gator/core/application/application.rb
|
112
|
+
- lib/gator/core/application/application_configuration.rb
|
113
|
+
- lib/gator/core/command/act_as_command.rb
|
114
|
+
- lib/gator/core/command/act_as_command_collection.rb
|
115
|
+
- lib/gator/core/command/command.rb
|
116
|
+
- lib/gator/core/command/task.rb
|
117
|
+
- lib/gator/core/configuration/act_as_configuration.rb
|
118
|
+
- lib/gator/core/configuration/configuration.rb
|
119
|
+
- lib/gator/core/io/paths.rb
|
120
|
+
- lib/gator/core/io/project_file_locator.rb
|
121
|
+
- lib/gator/core/io/ruby_file_loader.rb
|
122
|
+
- lib/gator/core/io/sandbox.rb
|
123
|
+
- lib/gator/core/project/layout.rb
|
124
|
+
- lib/gator/core/project/project.rb
|
125
|
+
- lib/gator/plugins/generators.rb
|
126
|
+
- lib/gator/plugins/generators/act_as_template_generator.rb
|
127
|
+
- lib/gator/plugins/generators/generate_command.rb
|
128
|
+
- lib/gator/plugins/generators/generator.rb
|
129
|
+
- lib/gator/plugins/scaffolding.rb
|
130
|
+
- lib/gator/plugins/scaffolding/scaffold_command.rb
|
131
|
+
- lib/gator/plugins/scaffolding/scaffolding_file_utils.rb
|
132
|
+
- rake/jeweler.rb
|
133
|
+
- rake/jeweler_prerelease_tasks.rb
|
134
|
+
- rake/pre_release_gemspec.rb
|
135
|
+
- rake/pre_release_to_git.rb
|
136
|
+
- spec/core/application/application_configuration_spec.rb
|
137
|
+
- spec/core/application/application_spec.rb
|
138
|
+
- spec/core/command/command_spec.rb
|
139
|
+
- spec/core/command/task_spec.rb
|
140
|
+
- spec/core/configuration/configuration_spec.rb
|
141
|
+
- spec/core/io/paths_spec.rb
|
142
|
+
- spec/core/io/sandbox_spec.rb
|
143
|
+
- spec/core/project/layout_spec.rb
|
144
|
+
- spec/core/project/project_spec.rb
|
113
145
|
- spec/fixtures/empty_gator_project/gator.rb
|
114
|
-
- spec/
|
115
|
-
- spec/
|
146
|
+
- spec/fixtures/no_gator_file/.empty_directory
|
147
|
+
- spec/plugins/scaffolding/scaffold_command_spec.rb
|
116
148
|
- spec/spec_helper.rb
|
117
|
-
- spec/task_spec.rb
|
118
|
-
- spec/util_spec.rb
|
119
|
-
has_rdoc: true
|
120
149
|
homepage: http://github.com/devboy/gator
|
121
150
|
licenses:
|
122
151
|
- MIT
|
@@ -132,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
161
|
version: '0'
|
133
162
|
segments:
|
134
163
|
- 0
|
135
|
-
hash: -
|
164
|
+
hash: -4555161155117195479
|
136
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
166
|
none: false
|
138
167
|
requirements:
|
@@ -141,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
170
|
version: 1.3.1
|
142
171
|
requirements: []
|
143
172
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.
|
173
|
+
rubygems_version: 1.8.10
|
145
174
|
signing_key:
|
146
175
|
specification_version: 3
|
147
176
|
summary: gator - the friendly code-generator
|
data/lib/gator/command.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
module Gator
|
2
|
-
|
3
|
-
module ActAsCommand
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.extend(ClassMethods)
|
7
|
-
end
|
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 definition
|
28
|
-
self.class.definition
|
29
|
-
end
|
30
|
-
|
31
|
-
def get_subcommand(*args)
|
32
|
-
nil
|
33
|
-
end
|
34
|
-
|
35
|
-
def resolve_subcommand(command,fallback=nil)
|
36
|
-
return nil unless parent
|
37
|
-
parent.resolve_subcommand(command,fallback)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
module ActAsCommandCollection
|
43
|
-
|
44
|
-
def self.included(base)
|
45
|
-
base.extend(ClassMethods)
|
46
|
-
end
|
47
|
-
|
48
|
-
module ClassMethods
|
49
|
-
|
50
|
-
def subcommand_classes
|
51
|
-
@subcommand_classes ||= {}
|
52
|
-
end
|
53
|
-
|
54
|
-
def register_subcommand(klass)
|
55
|
-
d = klass.definition
|
56
|
-
register klass, d[:command], d[:usage], d[:description], d[:options] || {}
|
57
|
-
map [d[:short]] => d[:command] unless d[:short].nil?
|
58
|
-
subcommand_classes[d[:command]] = klass
|
59
|
-
klass.parent_command = self
|
60
|
-
end
|
61
|
-
|
62
|
-
def get_subcommand(*args)
|
63
|
-
klass = self
|
64
|
-
args.each do |arg|
|
65
|
-
return nil unless klass.subcommand_classes.has_key? arg
|
66
|
-
klass = klass.subcommand_classes[arg]
|
67
|
-
end
|
68
|
-
klass
|
69
|
-
end
|
70
|
-
|
71
|
-
def resolve_subcommand(command,fallback=nil)
|
72
|
-
|
73
|
-
parent_klass = self
|
74
|
-
klass = parent_klass.get_subcommand *command
|
75
|
-
|
76
|
-
return klass unless klass.nil?
|
77
|
-
|
78
|
-
while parent_klass.parent
|
79
|
-
parent_klass = parent_klass.parent
|
80
|
-
klass = parent_klass.get_subcommand *command
|
81
|
-
return klass unless klass.nil?
|
82
|
-
end
|
83
|
-
|
84
|
-
resolve_subcommand fallback if fallback
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
class Command < Thor
|
92
|
-
include ActAsCommand
|
93
|
-
include ActAsCommandCollection
|
94
|
-
|
95
|
-
#The following lines fix a bug in thor see: https://github.com/wycats/thor/pull/150
|
96
|
-
class << self
|
97
|
-
def register(klass, subcommand_name, usage, description, options={})
|
98
|
-
if klass <= Thor::Group
|
99
|
-
desc usage, description, options
|
100
|
-
define_method(subcommand_name) { |*args| invoke klass }
|
101
|
-
else
|
102
|
-
desc usage, description, options
|
103
|
-
subcommand subcommand_name, klass
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|