gator 0.0.3.pre → 0.0.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/gator.gemspec +1 -1
- data/lib/core/configuration/configuration.rb +1 -1
- data/lib/core/project/layout.rb +74 -72
- data/lib/core/project/project.rb +0 -8
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4.pre
|
data/gator.gemspec
CHANGED
@@ -24,7 +24,7 @@ module Gator
|
|
24
24
|
def load_project_configuration
|
25
25
|
config_file = File.find_file_upwards("gator_config.rb") || File.join( ".gator","gator_config.rb")
|
26
26
|
ConfigurationGenerator.new.create_configuration config_file unless File.exists? config_file
|
27
|
-
Gator.
|
27
|
+
Gator.base_dir = File.expand_path( File.dirname( File.dirname( config_file ) ) )
|
28
28
|
load config_file
|
29
29
|
end
|
30
30
|
|
data/lib/core/project/layout.rb
CHANGED
@@ -1,87 +1,89 @@
|
|
1
|
-
|
1
|
+
module Gator
|
2
|
+
# THIS CLASS IS STOLEN FROM BUILDR
|
2
3
|
|
3
|
-
# Symbolic mapping for directory layout. Used for both the default and custom layouts.
|
4
|
-
#
|
5
|
-
# For example, the default layout maps [:source, :main, :java] to 'src/main/java', and
|
6
|
-
# [:target, :main, :classes] to 'target/classes'. You can use this to change the layout
|
7
|
-
# of your projects.
|
8
|
-
#
|
9
|
-
# To map [:source, :main] into the 'sources' directory:
|
10
|
-
# my_layout = Layout.new
|
11
|
-
# my_layout[:source, :main] = 'sources'
|
12
|
-
#
|
13
|
-
# define 'foo', :layout=>my_layout do
|
14
|
-
# ...
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# To map [:source, :main, :java] to 'java/main':
|
18
|
-
# class MainLast < Layout
|
19
|
-
# def expand(*args)
|
20
|
-
# if args[0..1] == [:source, :main]
|
21
|
-
# super args[2], :main, *args[3,]
|
22
|
-
# else
|
23
|
-
# super
|
24
|
-
# end
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
#
|
28
|
-
# define 'foo', :layout=>MainLast do
|
29
|
-
# ...
|
30
|
-
# end
|
31
|
-
class Layout
|
4
|
+
# Symbolic mapping for directory layout. Used for both the default and custom layouts.
|
5
|
+
#
|
6
|
+
# For example, the default layout maps [:source, :main, :java] to 'src/main/java', and
|
7
|
+
# [:target, :main, :classes] to 'target/classes'. You can use this to change the layout
|
8
|
+
# of your projects.
|
9
|
+
#
|
10
|
+
# To map [:source, :main] into the 'sources' directory:
|
11
|
+
# my_layout = Layout.new
|
12
|
+
# my_layout[:source, :main] = 'sources'
|
13
|
+
#
|
14
|
+
# define 'foo', :layout=>my_layout do
|
15
|
+
# ...
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# To map [:source, :main, :java] to 'java/main':
|
19
|
+
# class MainLast < Layout
|
20
|
+
# def expand(*args)
|
21
|
+
# if args[0..1] == [:source, :main]
|
22
|
+
# super args[2], :main, *args[3,]
|
23
|
+
# else
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# define 'foo', :layout=>MainLast do
|
30
|
+
# ...
|
31
|
+
# end
|
32
|
+
class Layout
|
32
33
|
|
33
|
-
|
34
|
+
class << self
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
# Default layout used by new projects.
|
37
|
+
attr_accessor :default
|
37
38
|
|
38
|
-
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
def initialize #:nodoc:
|
42
|
+
@mapping = {}
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
# Expands list of symbols and path names into a full path, for example:
|
46
|
+
# puts default.expand(:source, :main, :java)
|
47
|
+
# => "src/main/java"
|
48
|
+
def expand(*args)
|
49
|
+
args = args.compact.reject { |s| s.to_s.empty? }.map(&:to_sym)
|
50
|
+
return '' if args.empty?
|
51
|
+
@mapping[args] ||= File.join(*[expand(*args[0..-2]), args.last.to_s].reject(&:empty?)) if args.size > 1
|
52
|
+
return @mapping[args] || args.first.to_s
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
# Resolves a list of symbols into a path.
|
56
|
+
def [](*args)
|
57
|
+
@mapping[args.map(&:to_sym)]
|
58
|
+
end
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
# Specifies the path resolved from a list of symbols.
|
61
|
+
def []=(*args)
|
62
|
+
@mapping[args[0...-1].map(&:to_sym)] = args.last
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
def initialize_copy(copy)
|
66
|
+
copy.instance_variable_set :@mapping, @mapping.clone
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
# Default layout has the following properties:
|
70
|
+
# * :source maps to the 'src' directory.
|
71
|
+
# * Anything under :source maps verbatim (e.g. :source, :main becomes 'src/main')
|
72
|
+
# * :target maps to the 'target' directory.
|
73
|
+
# * :target, :main maps to the 'target' directory as well.
|
74
|
+
# * Anything under :target, :main maps verbatim (e.g. :target, :main, :classes becomes 'target/classes')
|
75
|
+
# * Anything else under :target also maps verbatim (e.g. :target, :test becomes 'target/test')
|
76
|
+
class Default < Layout
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
def initialize
|
79
|
+
super
|
80
|
+
self[:source] = 'src'
|
81
|
+
self[:target, :main] = 'target'
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
+
self.default = Default.new
|
86
87
|
|
88
|
+
end
|
87
89
|
end
|
data/lib/core/project/project.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4.pre
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dominic Graefen
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
117
|
+
hash: 1652915193245958756
|
118
118
|
segments:
|
119
119
|
- 0
|
120
120
|
version: "0"
|