bakery 0.4.0 → 0.5.0

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/README.md CHANGED
@@ -0,0 +1,26 @@
1
+ Bakery
2
+ ======
3
+
4
+ Icing files are by default searched for in: (in order)
5
+
6
+ Dir.home
7
+ File.join(Dir.home, '.bakery')
8
+ File.join('/', 'etc', 'bakery')
9
+
10
+ More directories can be added using:
11
+
12
+ Bakery::ICING_SEARCH.addSearchDirectory "<directory>"
13
+
14
+ Files are searched for using the existing extension and all extensions in Bakery::ICING_SEARCH.defaultExts (in order). By default,
15
+
16
+ Bakery::ICING_SEARCH.defaultExts = [ 'icing' ]
17
+
18
+ Some sample icing files can be found here:
19
+ [copyright.icing][gist copyright]
20
+ [boost.license][gist boost license]
21
+
22
+ NOTE: [copyright.icing][gist copyright] and [boost.license][gist boost license] are required to execute `bake` on this project.
23
+
24
+ [gist copyright]: https://gist.github.com/rideliner/7281685#file-copyright-icing
25
+ [gist boost license]: https://gist.github.com/rideliner/7281673#file-boost-license
26
+
data/bin/bake CHANGED
@@ -12,37 +12,42 @@
12
12
  #
13
13
 
14
14
  require 'fileutils'
15
+ require 'trollop'
15
16
 
16
17
  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
18
+ require 'bakery/version'
19
+
20
+ opts = Trollop::options do
21
+ version "Bakery v#{Bakery::VERSION} (c) 2013 Nathan Currier"
22
+ banner <<-EOS
23
+ EOS
24
+ opt :recipe, "Set recipe file to bake from.", { :type => String, :default => File.join(Bakery::ROOT_DIR, '.recipe') }
25
+ opt :ingredients, "Set which ingredients to use when baking.", { :type => String, :default => File.join(Bakery::ROOT_DIR, '.ingredients') }
26
+ opt :destination, "Set the destination location.", { :type => String }
25
27
  end
26
28
 
29
+ Trollop::die :recipe, ": '#{opts[:recipe]}' must exist" unless File.exist?(opts[:recipe]) || !opts[:recipe]
30
+
27
31
  bake_init = Proc.new do
28
32
  Bakery.addCake
29
33
 
30
34
  # use default ingredients if an ingredients file is not provided
31
- if File.exists?(dir = File.join(Bakery::ROOT_DIR, '.ingredients'))
32
- load dir
35
+ if File.exists? opts[:ingredients]
36
+ load opts[:ingredients]
33
37
  else
38
+ $stdout.puts "[WARNING] Using default ingredients."
34
39
  use_defaults
35
40
  end
36
41
 
37
- load File.join(Bakery::ROOT_DIR, '.recipe')
42
+ load opts[:recipe]
38
43
  end
39
44
 
40
- if ARGV[0]
41
- if !Dir.exists? ARGV[0]
42
- FileUtils.mkdir_p ARGV[0]
45
+ if opts[:destination]
46
+ if !Dir.exists? opts[:destination]
47
+ FileUtils.mkdir_p opts[:destination]
43
48
  end
44
49
 
45
- Dir.chdir ARGV[0], &bake_init
50
+ Dir.chdir opts[:destination], &bake_init
46
51
  else
47
52
  bake_init.call
48
53
  end
@@ -74,35 +74,3 @@ public
74
74
  attr_accessor :paths, :defaultExts
75
75
  end
76
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
-
@@ -10,6 +10,6 @@
10
10
  #
11
11
 
12
12
  module Bakery
13
- VERSION = '0.4.0'
13
+ VERSION = '0.5.0'
14
14
  end
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bakery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,23 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2013-10-11 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: trollop
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
14
30
  description: Design the layout of a project and have it ready for coding.
15
31
  email: nathan.currier@gmail.com
16
32
  executables:
@@ -41,7 +57,7 @@ files:
41
57
  - lib/bakery.rb
42
58
  - LICENSE.md
43
59
  - README.md
44
- homepage: http://rideliner.tk
60
+ homepage: http://rubygems.org/gems/bakery
45
61
  licenses:
46
62
  - Boost
47
63
  post_install_message: