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 CHANGED
@@ -1 +1 @@
1
- 0.0.3.pre
1
+ 0.0.4.pre
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gator}
8
- s.version = "0.0.3.pre"
8
+ s.version = "0.0.4.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"]
@@ -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.project.base_dir = File.dirname( File.dirname( config_file ) )
27
+ Gator.base_dir = File.expand_path( File.dirname( File.dirname( config_file ) ) )
28
28
  load config_file
29
29
  end
30
30
 
@@ -1,87 +1,89 @@
1
- # THIS CLASS IS STOLEN FROM BUILDR
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
- class << self
34
+ class << self
34
35
 
35
- # Default layout used by new projects.
36
- attr_accessor :default
36
+ # Default layout used by new projects.
37
+ attr_accessor :default
37
38
 
38
- end
39
+ end
39
40
 
40
- def initialize #:nodoc:
41
- @mapping = {}
42
- end
41
+ def initialize #:nodoc:
42
+ @mapping = {}
43
+ end
43
44
 
44
- # Expands list of symbols and path names into a full path, for example:
45
- # puts default.expand(:source, :main, :java)
46
- # => "src/main/java"
47
- def expand(*args)
48
- args = args.compact.reject { |s| s.to_s.empty? }.map(&:to_sym)
49
- return '' if args.empty?
50
- @mapping[args] ||= File.join(*[expand(*args[0..-2]), args.last.to_s].reject(&:empty?)) if args.size > 1
51
- return @mapping[args] || args.first.to_s
52
- end
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
- # Resolves a list of symbols into a path.
55
- def [](*args)
56
- @mapping[args.map(&:to_sym)]
57
- end
55
+ # Resolves a list of symbols into a path.
56
+ def [](*args)
57
+ @mapping[args.map(&:to_sym)]
58
+ end
58
59
 
59
- # Specifies the path resolved from a list of symbols.
60
- def []=(*args)
61
- @mapping[args[0...-1].map(&:to_sym)] = args.last
62
- end
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
- def initialize_copy(copy)
65
- copy.instance_variable_set :@mapping, @mapping.clone
66
- end
65
+ def initialize_copy(copy)
66
+ copy.instance_variable_set :@mapping, @mapping.clone
67
+ end
67
68
 
68
- # Default layout has the following properties:
69
- # * :source maps to the 'src' directory.
70
- # * Anything under :source maps verbatim (e.g. :source, :main becomes 'src/main')
71
- # * :target maps to the 'target' directory.
72
- # * :target, :main maps to the 'target' directory as well.
73
- # * Anything under :target, :main maps verbatim (e.g. :target, :main, :classes becomes 'target/classes')
74
- # * Anything else under :target also maps verbatim (e.g. :target, :test becomes 'target/test')
75
- class Default < Layout
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
- def initialize
78
- super
79
- self[:source] = 'src'
80
- self[:target, :main] = 'target'
81
- end
78
+ def initialize
79
+ super
80
+ self[:source] = 'src'
81
+ self[:target, :main] = 'target'
82
+ end
82
83
 
83
- end
84
+ end
84
85
 
85
- self.default = Default.new
86
+ self.default = Default.new
86
87
 
88
+ end
87
89
  end
@@ -8,14 +8,6 @@ module Gator
8
8
  @layout = Layout.default
9
9
  end
10
10
 
11
- def base_dir
12
- @base_dir
13
- end
14
-
15
- def base_dir=( dir )
16
- @base_dir = dir
17
- end
18
-
19
11
  def path(*args)
20
12
  File.join( Gator.base_dir, layout.expand(*args) )
21
13
  end
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.3.pre
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: 1808113828780164832
117
+ hash: 1652915193245958756
118
118
  segments:
119
119
  - 0
120
120
  version: "0"