bakery 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,23 @@
1
+ **Boost Software License** - Version 1.0 - August 17th, 2003
2
+
3
+ Permission is hereby granted, free of charge, to any person or organization
4
+ obtaining a copy of the software and accompanying documentation covered by
5
+ this license (the "Software") to use, reproduce, display, distribute,
6
+ execute, and transmit the Software, and to prepare derivative works of the
7
+ Software, and to permit third-parties to whom the Software is furnished to
8
+ do so, all subject to the following:
9
+
10
+ The copyright notices in the Software and this entire statement, including
11
+ the above license grant, this restriction and the following disclaimer,
12
+ must be included in all copies of the Software, in whole or in part, and
13
+ all derivative works of the Software, unless such copies or derivative
14
+ works are solely in the form of machine-executable object code generated by
15
+ a source language processor.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20
+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21
+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ DEALINGS IN THE SOFTWARE.
File without changes
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # Copyright (c) 2013
5
+ # Nathan Currier
6
+ #
7
+ # Use, modification, and distribution are all subject to the
8
+ # Boost Software License, Version 1.0. (See the accompanying
9
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
10
+ #
11
+ # <description>
12
+ #
13
+
14
+ require 'fileutils'
15
+
16
+ require 'bakery'
17
+
18
+ if ARGV.include?('-v') || ARGV.include?('--version')
19
+ require 'bakery/version'
20
+
21
+ puts "Bakery v#{Bakery::VERSION}"
22
+ puts 'Copyright (c) 2013'
23
+ puts 'Nathan Currier'
24
+ exit 0
25
+ end
26
+
27
+ bake_init = Proc.new do
28
+ Bakery.addCake
29
+
30
+ # use default ingredients if an ingredients file is not provided
31
+ if File.exists?(dir = File.join(Bakery::ROOT_DIR, '.ingredients'))
32
+ load dir
33
+ else
34
+ use_defaults
35
+ end
36
+
37
+ load File.join(Bakery::ROOT_DIR, '.recipe')
38
+ end
39
+
40
+ if ARGV[0]
41
+ if !Dir.exists? ARGV[0]
42
+ FileUtils.mkdir_p ARGV[0]
43
+ end
44
+
45
+ Dir.chdir ARGV[0], &bake_init
46
+ else
47
+ bake_init.call
48
+ end
49
+
@@ -0,0 +1,32 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ require 'bakery/bakery'
13
+ require 'bakery/cake'
14
+ require 'bakery/detail/global_function'
15
+ require 'bakery/detail/load'
16
+ require 'bakery/detail/dispatcher'
17
+ require 'bakery/detail/search'
18
+ require 'bakery/icing'
19
+ require 'bakery/ingredient'
20
+
21
+ module Bakery
22
+ ROOT_DIR = Dir.pwd
23
+
24
+ LIB_DIR = File.dirname __FILE__
25
+
26
+ INGREDIENTS_DIR = File.join LIB_DIR, 'bakery', 'ingredients'
27
+ INGREDIENTS_DETAIL_DIR = File.join INGREDIENTS_DIR, 'detail'
28
+
29
+ ICING_SEARCH = PathSearch.new [ Dir.home, File.join(Dir.home, '.bakery'), File.join('/', 'etc', 'bakery') ]
30
+ ICING_SEARCH.defaultExts = [ 'icing' ]
31
+ end
32
+
@@ -0,0 +1,72 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ @cakes = Array.new
14
+ @markers = Array.new
15
+ @defaultIcing = Hash.new
16
+ @currentCake = nil
17
+
18
+ class << self
19
+ def removeMarkerLayerFromStack path
20
+ # remove all markers that are in the current directory
21
+ @markers.select! { |marker|
22
+ !marker.getPath.start_with? path
23
+ }
24
+
25
+ if @currentCake.root == path
26
+ @currentCake = @currentCake.parent
27
+ end
28
+ end
29
+
30
+ def getLatestMarkerOfType type
31
+ @markers.reverse_each { |marker|
32
+ if marker.is_a? type
33
+ return marker
34
+ end
35
+ }
36
+
37
+ nil
38
+ end
39
+
40
+ def icing
41
+ @defaultIcing
42
+ end
43
+
44
+ def markers
45
+ @markers
46
+ end
47
+
48
+ def cakes
49
+ @cakes
50
+ end
51
+
52
+ def [] symbol
53
+ if icing = getCake.icing[symbol]
54
+ icing
55
+ else
56
+ @defaultIcing[symbol]
57
+ end
58
+ end
59
+
60
+ def addCake
61
+ cake = Cake.new @currentCake
62
+
63
+ @cakes.push cake
64
+ @currentCake = cake
65
+ end
66
+
67
+ def getCake
68
+ @currentCake
69
+ end
70
+ end
71
+ end
72
+
@@ -0,0 +1,33 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ class Cake
14
+ def initialize parent
15
+ @parent = parent
16
+ @root = Dir.pwd
17
+ @icing = Hash.new
18
+ end
19
+
20
+ def root
21
+ @root
22
+ end
23
+
24
+ def icing
25
+ @icing
26
+ end
27
+
28
+ def parent
29
+ @parent
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Dispatcher
13
+ def self.included base
14
+ base.extend InitializeWithBlock
15
+ end
16
+
17
+ module InitializeWithBlock
18
+ def new *args, &block
19
+ obj = self.allocate
20
+ obj.send :initialize, *args, &block
21
+ obj
22
+ end
23
+ end
24
+
25
+ def dispatch &block
26
+ if block
27
+ self.instance_eval &block
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,17 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ class Object
13
+ def global_function name, &block
14
+ self.class.send :define_method, name, &block
15
+ end
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ def load_if_exists name
13
+ if File.exists? name
14
+ load name
15
+ end
16
+ end
17
+
@@ -0,0 +1,108 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ class PathSearch
13
+ protected
14
+ @defaultExts = [ ]
15
+ @paths = [ ]
16
+ private
17
+ def searchAllPaths filename
18
+ base = File.basename filename
19
+ paths.each { |dir|
20
+ if File.exist?(File.join dir, base)
21
+ return File.join dir, base
22
+ end
23
+ }
24
+
25
+ nil
26
+ end
27
+
28
+ def searchWithExts filename
29
+ defaultExts.each { |ext|
30
+ file = "#{filename}.#{ext}"
31
+ found = searchAllPaths file
32
+ if found != nil
33
+ return found
34
+ end
35
+ }
36
+
37
+ nil
38
+ end
39
+ public
40
+ def search filename
41
+ if File.exist? filename
42
+ file = filename
43
+ end
44
+
45
+ if file == nil
46
+ file = searchAllPaths File.basename(filename)
47
+ end
48
+
49
+ if file == nil
50
+ file = searchWithExts File.basename(filename, File.extname(filename))
51
+ end
52
+
53
+ if block_given?
54
+ if file != nil
55
+ yield file
56
+ else
57
+ stderr.puts "[WARNING] #{filename} was not found while searching in #{paths}."
58
+ end
59
+ end
60
+
61
+ file
62
+ end
63
+
64
+ def initialize paths = [ ]
65
+ @paths = paths
66
+ end
67
+
68
+ def addSearchDirectory dir
69
+ if File.exist?(dir) && File.directory?(dir) && !@paths.include?(dir)
70
+ @paths << dir
71
+ end
72
+ end
73
+
74
+ attr_accessor :paths, :defaultExts
75
+ end
76
+
77
+ =begin
78
+ base_search = File.basename(file, File.extname(file))
79
+
80
+ for dir in Bakery::SEARCH_DIRS
81
+ if defaultExts.empty?
82
+ if File.exist? base_search
83
+ return File.join dir, base_search
84
+ end
85
+ else
86
+ for ext in defaultExts
87
+ check_file = File.join dir, "#{base_search}.#{ext}"
88
+ if File.exist? check_file
89
+ return check_file
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ nil
96
+ end
97
+
98
+ def loadIcing name
99
+ file = search name, 'icing'
100
+ if file
101
+ load file
102
+ else
103
+ puts "[WARNING] #{name} was not found in Bakery::SEARCH_DIRS: #{Bakery::SEARCH_DIRS}."
104
+ end
105
+ end
106
+ end
107
+ =end
108
+
@@ -0,0 +1,65 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ def name n
13
+ Bakery.getCake.icing[:name] = n
14
+ end
15
+
16
+ def authors *names
17
+ if Bakery.getCake.icing[:authors] == nil
18
+ Bakery.getCake.icing[:authors] = Array.new
19
+ end
20
+
21
+ Bakery.getCake.icing[:authors].concat names
22
+ end
23
+
24
+ alias :author :authors
25
+
26
+ def description *desc
27
+ if Bakery.getCake.icing[:description] == nil
28
+ Bakery.getCake.icing[:description] = Array.new
29
+ end
30
+
31
+ Bakery.getCake.icing[:description].concat desc
32
+ end
33
+
34
+ def summary *sum
35
+ if Bakery.getCake.icing[:summary] == nil
36
+ Bakery.getCake.icing[:summary] = Array.new
37
+ end
38
+
39
+ Bakery.getCake.icing[:summary].concat sum
40
+ end
41
+
42
+ def copyright *lines
43
+ Bakery.getCake.icing[:copyright] = lines
44
+ end
45
+
46
+ def defaultAuthors *names
47
+ Bakery.icing[:authors] = names
48
+ end
49
+
50
+ alias :defaultAuthor :defaultAuthors
51
+
52
+ def defaultCopyright *lines
53
+ Bakery.icing[:copyright] = lines
54
+ end
55
+
56
+ def defaultDescription *desc
57
+ Bakery.icing[:description] = desc
58
+ end
59
+
60
+ def loadIcing filename
61
+ Bakery::ICING_SEARCH.search(filename) { |file|
62
+ load file
63
+ }
64
+ end
65
+
@@ -0,0 +1,25 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ def ingredients associations
13
+ associations.each_pair { |func, klass|
14
+ global_function func do |*args, &block|
15
+ klass.new *args, &block
16
+ end
17
+ }
18
+ end
19
+
20
+ alias :ingredient :ingredients
21
+
22
+ def use_defaults
23
+ load File.join(Bakery::LIB_DIR, 'default.ingredients')
24
+ end
25
+
@@ -0,0 +1,117 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ module Cpp
15
+ class File < Bakery::Ingredient::File
16
+ def toBlockCommentLine line
17
+ " *#{super line}"
18
+ end
19
+
20
+ def initialize filename, *args, &block
21
+ super filename, *args do
22
+ unless args.include? :no_copyright
23
+ puts '/*!'
24
+ insertCopyrightNotice
25
+ puts '**/'
26
+ puts ''
27
+ end
28
+
29
+ dispatch &block
30
+ end
31
+ end
32
+ end
33
+
34
+ class SourceFile < File
35
+ def initialize filename, *args, &block
36
+ super filename, *args do
37
+ if args.include? :main
38
+ if args.include? :vita
39
+ puts '#include <vita.hpp>'
40
+ puts ''
41
+ puts 'int main(Ortus& ortus, Orcus& orcus)'
42
+ else
43
+ puts 'int main(int argc, char** argv, char** env)'
44
+ end
45
+
46
+ puts '{'
47
+ puts ' return 0;'
48
+ puts '}'
49
+ puts ''
50
+ end
51
+
52
+ dispatch &block
53
+ end
54
+ end
55
+ end
56
+
57
+ class HeaderFile < File
58
+ def initialize filename, *args, &block
59
+ super filename, *args do
60
+ guard = Bakery.getLatestMarkerOfType Bakery::Ingredient::Cpp::HeaderMarker
61
+
62
+ guard_name = "#{guard ? guard.getProject : ''}_#{filename.gsub(/\./, '_')}".split(/[\/\\]/).join('_').upcase
63
+
64
+ puts "#ifndef #{guard_name}"
65
+ puts "#define #{guard_name}"
66
+ puts ''
67
+ puts "#endif // #{guard_name}"
68
+ puts ''
69
+
70
+ dispatch &block
71
+ end
72
+ end
73
+ end
74
+
75
+ class TestFile < File
76
+ def initialize filename, *args, &block
77
+ super filename, *args do
78
+ puts '#include <gtest/gtest.h>'
79
+ puts ''
80
+
81
+ if args.include? :main
82
+ if args.include? :vita
83
+ puts '#include <vita.hpp>'
84
+ puts ''
85
+ puts 'int main(Ortus& ortus, Orcus& orcus)'
86
+ puts '{'
87
+ puts ' testing::InitGoogleTest(ortus);'
88
+ else
89
+ puts 'int main(int argc, char** argv)'
90
+ puts '{'
91
+ puts ' testing::InitGoogleTest(&argc, argv);'
92
+ end
93
+
94
+ puts ''
95
+ puts ' return RUN_ALL_TESTS();'
96
+ puts '}'
97
+ puts ''
98
+ end
99
+
100
+ dispatch &block
101
+ end
102
+ end
103
+ end
104
+
105
+ class HeaderMarker < Bakery::Ingredient::Marker
106
+ def initialize *args, &block
107
+ super *args, &block
108
+ end
109
+
110
+ def getProject
111
+ Dir.pwd.gsub /^#{Regexp.quote @wd}[\/\\]?/, ''
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ class Build < Bakery::Ingredient::File
15
+ def initialize *args, &block
16
+ if args.include? :cmake
17
+ super 'CMakeList.txt', *args, &block
18
+ elsif args.include? :make
19
+ super 'makefile', *args, &block
20
+ elsif args.include? :rake
21
+ super 'rakefile', *args, &block
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,39 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ require 'fileutils'
13
+
14
+ module Bakery
15
+ module Ingredient
16
+ class Dir < Dir
17
+ include Dispatcher
18
+
19
+ def initialize path, *args, &block
20
+ if !Dir.exists? path
21
+ if args.include? :create_recursive
22
+ FileUtils.mkdir_p path
23
+ else
24
+ FileUtils.mkdir path
25
+ end
26
+ end
27
+
28
+ super path
29
+
30
+ Dir.chdir path do
31
+ dispatch &block
32
+
33
+ Bakery.removeMarkerLayerFromStack Dir.pwd
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,63 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ class File < File
15
+ include Dispatcher
16
+
17
+ def toBlockCommentLine line
18
+ "#{line.empty? ? '' : ' '}#{line}"
19
+ end
20
+
21
+ # TODO try cleaning this up...
22
+ def insertCopyrightNotice
23
+ Bakery[:copyright].each { |line|
24
+ if line.is_a? Proc
25
+ lines = line.call
26
+ if lines.is_a? Array
27
+ lines.each { |called_line|
28
+ puts toBlockCommentLine called_line
29
+ }
30
+ else
31
+ puts toBlockCommentLine lines
32
+ end
33
+ else
34
+ puts toBlockCommentLine line
35
+ end
36
+ }
37
+ end
38
+
39
+ def initialize filename, *args, &block
40
+ already_exists = File.exist? filename
41
+
42
+ if !already_exists || args.include?(:always_overwrite)
43
+ super filename, 'w+'
44
+
45
+ dispatch &block
46
+ else
47
+ super filename, 'a+'
48
+
49
+ if args.include?(:always_append)
50
+ dispatch &block
51
+ end
52
+ end
53
+ end
54
+
55
+ def from filename
56
+ ICING_SEARCH.search(filename) { |file|
57
+ FileUtils.cp file, path
58
+ }
59
+ end
60
+ end
61
+ end
62
+ end
63
+
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ class Marker
15
+ def initialize *args, &block
16
+ @wd = Dir.pwd
17
+
18
+ Bakery.markers << self
19
+ end
20
+
21
+ def getPath
22
+ @wd
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,46 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ class Project < Dir
15
+ def initialize name, *args, &block
16
+ if name.is_a? Hash
17
+ fail "Project Argument Error" if name.size != 1
18
+
19
+ projname, recipe = name.map { |k, v| [k, v] }.first
20
+ else
21
+ projname, recipe = name.to_s, nil
22
+ end
23
+
24
+ super projname, *args do
25
+ Bakery.addCake
26
+
27
+ if recipe
28
+ # if an external recipe is specified, load it
29
+ extern_recipe_loc = File.join(Bakery::ROOT_DIR, recipe)
30
+ load extern_recipe_loc
31
+ end
32
+
33
+ local_recipe_loc = File.join(Dir.pwd, '.recipe')
34
+
35
+ # load .recipe if it isn't the external recipe and it exists
36
+ if local_recipe_loc != extern_recipe_loc
37
+ load_if_exists local_recipe_loc
38
+ end
39
+
40
+ dispatch &block
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+
@@ -0,0 +1,39 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ class ScriptFile < Bakery::Ingredient::File
15
+ def toBlockCommentLine line
16
+ "##{super line}"
17
+ end
18
+
19
+ def initialize filename, shebang, *args, &block
20
+ super filename, *args do
21
+ if args.include? :shebang
22
+ puts "#!/usr/bin/env #{shebang}"
23
+ puts ''
24
+ end
25
+
26
+ unless args.include? :no_copyright
27
+ puts '#'
28
+ insertCopyrightNotice
29
+ puts '#'
30
+ puts ''
31
+ end
32
+
33
+ dispatch &block
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,32 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ module Ruby
15
+ class ScriptFile < Bakery::Ingredient::ScriptFile
16
+ def initialize filename, *args, &block
17
+ super filename, 'ruby', *args do
18
+ if args.include? :main
19
+ puts 'if __FILE__ == $PROGRAM_NAME'
20
+ puts ''
21
+ puts 'end'
22
+ puts ''
23
+ end
24
+
25
+ dispatch &block
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,47 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ module Ingredient
14
+ module Shell
15
+ class BashScriptFile < Bakery::Ingredient::ScriptFile
16
+ def initialize filename, *args, &block
17
+ super filename, 'bash', *args, &block
18
+ end
19
+ end
20
+
21
+ class ShScriptFile < Bakery::Ingredient::ScriptFile
22
+ def initialize filename, *args, &block
23
+ super filename, 'sh', *args, &block
24
+ end
25
+ end
26
+
27
+ class TcshScriptFile < Bakery::Ingredient::ScriptFile
28
+ def initialize filename, *args, &block
29
+ super filename, 'tcsh', *args, &block
30
+ end
31
+ end
32
+
33
+ class CshScriptFile < Bakery::Ingredient::ScriptFile
34
+ def initialize filename, *args, &block
35
+ super filename, 'csh', *args, &block
36
+ end
37
+ end
38
+
39
+ class ZshScriptFile < Bakery::Ingredient::File
40
+ def initialize filename, *args, &block
41
+ super filename, 'zsh', *args, &block
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
@@ -0,0 +1,15 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ module Bakery
13
+ VERSION = '0.4.0'
14
+ end
15
+
@@ -0,0 +1,24 @@
1
+ #
2
+ # Copyright (c) 2013
3
+ # Nathan Currier
4
+ #
5
+ # Use, modification, and distribution are all subject to the
6
+ # Boost Software License, Version 1.0. (See the accompanying
7
+ # file LICENSE.md or at http://rideliner.tk/LICENSE.html).
8
+ #
9
+ # <description>
10
+ #
11
+
12
+ load File.join(Bakery::INGREDIENTS_DETAIL_DIR, 'file.ingredient')
13
+ load File.join(Bakery::INGREDIENTS_DETAIL_DIR, 'dir.ingredient')
14
+ load File.join(Bakery::INGREDIENTS_DETAIL_DIR, 'project.ingredient')
15
+ load File.join(Bakery::INGREDIENTS_DETAIL_DIR, 'marker.ingredient')
16
+ load File.join(Bakery::INGREDIENTS_DETAIL_DIR, 'build.ingredient')
17
+ load File.join(Bakery::INGREDIENTS_DETAIL_DIR, 'script.ingredient')
18
+
19
+ ingredient :file => Bakery::Ingredient::File
20
+ ingredient :dir => Bakery::Ingredient::Dir
21
+ ingredient :marker => Bakery::Ingredient::Marker
22
+ ingredient :project => Bakery::Ingredient::Project
23
+ ingredient :build => Bakery::Ingredient::Build
24
+
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bakery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Nathan Currier
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-10-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Design the layout of a project and have it ready for coding.
15
+ email: nathan.currier@gmail.com
16
+ executables:
17
+ - bake
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/bake
22
+ - lib/bakery/version.rb
23
+ - lib/bakery/ingredients/ruby.ingredient
24
+ - lib/bakery/ingredients/c++.ingredient
25
+ - lib/bakery/ingredients/detail/dir.ingredient
26
+ - lib/bakery/ingredients/detail/script.ingredient
27
+ - lib/bakery/ingredients/detail/marker.ingredient
28
+ - lib/bakery/ingredients/detail/file.ingredient
29
+ - lib/bakery/ingredients/detail/build.ingredient
30
+ - lib/bakery/ingredients/detail/project.ingredient
31
+ - lib/bakery/ingredients/shell.ingredient
32
+ - lib/bakery/detail/load.rb
33
+ - lib/bakery/detail/global_function.rb
34
+ - lib/bakery/detail/search.rb
35
+ - lib/bakery/detail/dispatcher.rb
36
+ - lib/bakery/ingredient.rb
37
+ - lib/bakery/icing.rb
38
+ - lib/bakery/bakery.rb
39
+ - lib/bakery/cake.rb
40
+ - lib/default.ingredients
41
+ - lib/bakery.rb
42
+ - LICENSE.md
43
+ - README.md
44
+ homepage: http://rideliner.tk
45
+ licenses:
46
+ - Boost
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 1.8.23
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Project management made simple.
69
+ test_files: []