zuk-picnic 0.8.0.20090318 → 0.8.0.20090427

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/Manifest.txt +26 -27
  2. data/lib/picnic/cli.rb +2 -0
  3. data/lib/picnic/conf.rb +21 -5
  4. data/lib/picnic.rb +1 -1
  5. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/CHANGELOG +0 -0
  6. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/COPYING +0 -0
  7. data/vendor/camping-2.0.20090421/README +82 -0
  8. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/Rakefile +9 -3
  9. data/vendor/camping-2.0.20090421/bin/camping +97 -0
  10. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/doc/camping.1.gz +0 -0
  11. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/examples/README +0 -0
  12. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/examples/blog.rb +0 -0
  13. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/examples/campsh.rb +0 -0
  14. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/examples/tepee.rb +0 -0
  15. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/extras/Camping.gif +0 -0
  16. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/extras/permalink.gif +0 -0
  17. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/lib/camping/ar/session.rb +0 -0
  18. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/lib/camping/ar.rb +0 -0
  19. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/lib/camping/mab.rb +0 -0
  20. data/vendor/camping-2.0.20090421/lib/camping/reloader.rb +184 -0
  21. data/vendor/camping-2.0.20090421/lib/camping/server.rb +159 -0
  22. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/lib/camping/session.rb +1 -0
  23. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/lib/camping-unabridged.rb +53 -61
  24. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/lib/camping.rb +23 -25
  25. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/setup.rb +0 -0
  26. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/test/apps/env_debug.rb +0 -0
  27. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/test/apps/forms.rb +0 -0
  28. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/test/apps/misc.rb +0 -0
  29. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/test/apps/sessions.rb +0 -0
  30. data/vendor/{camping-2.0.20090212 → camping-2.0.20090421}/test/test_camping.rb +0 -0
  31. metadata +28 -29
  32. data/vendor/camping-2.0.20090212/README +0 -119
  33. data/vendor/camping-2.0.20090212/bin/camping +0 -99
  34. data/vendor/camping-2.0.20090212/extras/flipbook_rdoc.rb +0 -491
  35. data/vendor/camping-2.0.20090212/lib/camping/reloader.rb +0 -163
  36. data/vendor/camping-2.0.20090212/lib/camping/server.rb +0 -158
data/Manifest.txt CHANGED
@@ -17,30 +17,29 @@ picnic.gemspec
17
17
  setup.rb
18
18
  test/picnic_test.rb
19
19
  test/test_helper.rb
20
- vendor/camping-2.0.20090212/CHANGELOG
21
- vendor/camping-2.0.20090212/COPYING
22
- vendor/camping-2.0.20090212/README
23
- vendor/camping-2.0.20090212/Rakefile
24
- vendor/camping-2.0.20090212/bin/camping
25
- vendor/camping-2.0.20090212/doc/camping.1.gz
26
- vendor/camping-2.0.20090212/examples/README
27
- vendor/camping-2.0.20090212/examples/blog.rb
28
- vendor/camping-2.0.20090212/examples/campsh.rb
29
- vendor/camping-2.0.20090212/examples/tepee.rb
30
- vendor/camping-2.0.20090212/extras/Camping.gif
31
- vendor/camping-2.0.20090212/extras/flipbook_rdoc.rb
32
- vendor/camping-2.0.20090212/extras/permalink.gif
33
- vendor/camping-2.0.20090212/lib/camping-unabridged.rb
34
- vendor/camping-2.0.20090212/lib/camping.rb
35
- vendor/camping-2.0.20090212/lib/camping/ar.rb
36
- vendor/camping-2.0.20090212/lib/camping/ar/session.rb
37
- vendor/camping-2.0.20090212/lib/camping/mab.rb
38
- vendor/camping-2.0.20090212/lib/camping/reloader.rb
39
- vendor/camping-2.0.20090212/lib/camping/server.rb
40
- vendor/camping-2.0.20090212/lib/camping/session.rb
41
- vendor/camping-2.0.20090212/setup.rb
42
- vendor/camping-2.0.20090212/test/apps/env_debug.rb
43
- vendor/camping-2.0.20090212/test/apps/forms.rb
44
- vendor/camping-2.0.20090212/test/apps/misc.rb
45
- vendor/camping-2.0.20090212/test/apps/sessions.rb
46
- vendor/camping-2.0.20090212/test/test_camping.rb
20
+ vendor/camping-2.0.20090421/CHANGELOG
21
+ vendor/camping-2.0.20090421/COPYING
22
+ vendor/camping-2.0.20090421/README
23
+ vendor/camping-2.0.20090421/Rakefile
24
+ vendor/camping-2.0.20090421/bin/camping
25
+ vendor/camping-2.0.20090421/doc/camping.1.gz
26
+ vendor/camping-2.0.20090421/examples/README
27
+ vendor/camping-2.0.20090421/examples/blog.rb
28
+ vendor/camping-2.0.20090421/examples/campsh.rb
29
+ vendor/camping-2.0.20090421/examples/tepee.rb
30
+ vendor/camping-2.0.20090421/extras/Camping.gif
31
+ vendor/camping-2.0.20090421/extras/permalink.gif
32
+ vendor/camping-2.0.20090421/lib/camping-unabridged.rb
33
+ vendor/camping-2.0.20090421/lib/camping.rb
34
+ vendor/camping-2.0.20090421/lib/camping/ar.rb
35
+ vendor/camping-2.0.20090421/lib/camping/ar/session.rb
36
+ vendor/camping-2.0.20090421/lib/camping/mab.rb
37
+ vendor/camping-2.0.20090421/lib/camping/reloader.rb
38
+ vendor/camping-2.0.20090421/lib/camping/server.rb
39
+ vendor/camping-2.0.20090421/lib/camping/session.rb
40
+ vendor/camping-2.0.20090421/setup.rb
41
+ vendor/camping-2.0.20090421/test/apps/env_debug.rb
42
+ vendor/camping-2.0.20090421/test/apps/forms.rb
43
+ vendor/camping-2.0.20090421/test/apps/misc.rb
44
+ vendor/camping-2.0.20090421/test/apps/sessions.rb
45
+ vendor/camping-2.0.20090421/test/test_camping.rb
data/lib/picnic/cli.rb CHANGED
@@ -156,6 +156,8 @@ module Picnic
156
156
  at_exit { File.delete($PID_FILE) if File.exist?($PID_FILE) }
157
157
  end
158
158
 
159
+ $CONF.database = :unused if $CONF.database.blank?
160
+
159
161
  server = Picnic::Server::Base.new($CONF, [options[:app_file]])
160
162
  server.start
161
163
  end
data/lib/picnic/conf.rb CHANGED
@@ -25,18 +25,34 @@ module Picnic
25
25
  # Read a configuration option.
26
26
  #
27
27
  # For example:
28
- # puts Conf[:server]
28
+ # puts conf[:server]
29
29
  def [](key)
30
30
  @conf[key]
31
31
  end
32
32
 
33
- # Another way of reading a configuration option.
33
+ # Set a configuration option.
34
+ #
35
+ # For example:
36
+ # conf[:server] = 'mongrel'
37
+ def []=(key, value)
38
+ @conf[key] = value
39
+ end
40
+
41
+ # Another way of reading or writing a configuration option.
34
42
  #
35
43
  # The following statements are equivalent:
36
- # puts Conf[:server]
37
- # puts Conf.server
44
+ # puts conf[:server]
45
+ # puts conf.server
46
+ #
47
+ # These are also equivalent:
48
+ # conf[:server] = 'mongrel'
49
+ # conf.server = 'mongrel'
38
50
  def method_missing(method, *args)
39
- self[method]
51
+ if method.to_s =~ /(.*?)=$/
52
+ self[$~[1]] = args.first
53
+ else
54
+ self[method]
55
+ end
40
56
  end
41
57
 
42
58
  # Needs to be defined when we have a custom method_missing().
data/lib/picnic.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'activesupport'
3
3
 
4
4
  $: << File.dirname(__FILE__)
5
- $: << File.dirname(__FILE__) + "/../vendor/camping-2.0.20090212/lib"
5
+ $: << File.dirname(__FILE__) + "/../vendor/camping-2.0.20090421/lib"
6
6
 
7
7
  require "camping"
8
8
 
@@ -0,0 +1,82 @@
1
+ == Camping, a Microframework
2
+
3
+ Camping is a web framework which consistently stays at less than 3kb of code.
4
+ You can probably view the complete source code on a single page. But, you
5
+ know, it's so small that, if you think about it, what can it really do?
6
+
7
+ The idea here is to store a complete fledgling web application in a single
8
+ file like many small CGIs. But to organize it as a Model-View-Controller
9
+ application like Rails does. You can then easily move it to Rails once you've
10
+ got it going.
11
+
12
+ == A Camping Skeleton
13
+
14
+ A skeletal Camping blog could look like this:
15
+
16
+ require 'camping'
17
+
18
+ Camping.goes :Blog
19
+
20
+ module Blog::Models
21
+ class Post < Base; belongs_to :user; end
22
+ class Comment < Base; belongs_to :user; end
23
+ class User < Base; end
24
+ end
25
+
26
+ module Blog::Controllers
27
+ class Index < R '/'
28
+ def get
29
+ @posts = Post.find :all
30
+ render :index
31
+ end
32
+ end
33
+ end
34
+
35
+ module Blog::Views
36
+ def layout
37
+ html do
38
+ body do
39
+ self << yield
40
+ end
41
+ end
42
+ end
43
+
44
+ def index
45
+ for post in @posts
46
+ h1 post.title
47
+ end
48
+ end
49
+ end
50
+
51
+ == Installation
52
+
53
+ Interested yet? Luckily it's quite easy to install Camping. We'll be using a tool called RubyGems, so if you don't have that installed yet, go grab it! Once that's sorted out, open up a Terminal or Command Line and enter:
54
+
55
+ * <tt>gem install camping</tt>
56
+
57
+ Or for the bleeding edge:
58
+
59
+ * <tt>gem install camping --source http://gems.judofyr.net</tt>
60
+
61
+ This will download everything you need and get you all set up. If you're installing camping manually, you'll need to make sure you have 'rack' installed as well, the interface Camping uses to talk to your web server. You'll also need 'markaby' for the views, and 'activerecord' if you're going to be using databases.
62
+
63
+ == Learning
64
+
65
+ * Start by reading the documentation in {the Camping module}[link:classes/Camping.html]
66
+ - it should get you started pretty quick.
67
+ * {The wiki}[http://wiki.github.com/why/camping] is the place for all tiny,
68
+ useful tricks that we've collected over the years. Don't be afraid to
69
+ share your own discoveries; the more, the better!
70
+ * Still wondering? Subscribe to {the mailing list}[http://rubyforge.org/mailman/listinfo/camping-list].
71
+ This is where it's all happening! Don't worry, though, the volume is just
72
+ as micro as Camping itself.
73
+
74
+ == Authors
75
+
76
+ Camping was originally started by{why the lucky stiff}[http://en.wikipedia.org/wiki/Why_the_lucky_stiff],
77
+ but is now maintained by the _community_. This simply means that if we like your
78
+ patch, it will be applied. Everything is managed through {the mailing list}[http://rubyforge.org/mailman/listinfo/camping-list],
79
+ so just subscribe and you'll become a contributor too. Remember: writing the
80
+ code is just half the job, without some serious thinking from you we won't get
81
+ any further.
82
+
@@ -4,6 +4,14 @@ require 'rake/gempackagetask'
4
4
  require 'rake/rdoctask'
5
5
  require 'rake/testtask'
6
6
  require 'fileutils'
7
+ begin
8
+ gem 'rdoc', '~> 2.2.0'
9
+ require 'rdoc'
10
+ $:.unshift 'extras'
11
+ rescue Gem::LoadError
12
+ puts "RDoc 2.2 required to build docs"
13
+ puts "Please run `gem install rdoc --version 2.2`"
14
+ end
7
15
  include FileUtils
8
16
 
9
17
  NAME = "camping"
@@ -30,7 +38,7 @@ end
30
38
  Rake::RDocTask.new do |rdoc|
31
39
  rdoc.rdoc_dir = 'doc/rdoc'
32
40
  rdoc.options += RDOC_OPTS
33
- rdoc.template = "extras/flipbook_rdoc.rb"
41
+ rdoc.template = "flipbook"
34
42
  rdoc.main = "README"
35
43
  rdoc.title = "Camping, the Documentation"
36
44
  rdoc.rdoc_files.add ['README', 'CHANGELOG', 'COPYING', 'lib/camping.rb', 'lib/camping/*.rb']
@@ -41,7 +49,6 @@ task :after_doc do
41
49
  mv "lib/camping-mural.rb", "lib/camping.rb"
42
50
  cp "extras/Camping.gif", "doc/rdoc/"
43
51
  cp "extras/permalink.gif", "doc/rdoc/"
44
- sh %{scp -r doc/rdoc/* #{ENV['USER']}@rubyforge.org:/var/www/gforge-projects/camping/}
45
52
  end
46
53
 
47
54
  spec =
@@ -61,7 +68,6 @@ spec =
61
68
 
62
69
  s.add_dependency('markaby', '>=0.5')
63
70
  s.add_dependency('rack', '>=0.3')
64
- s.add_dependency('metaid')
65
71
  s.required_ruby_version = '>= 1.8.2'
66
72
 
67
73
  s.files = %w(COPYING README Rakefile) +
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ trap("INT") { exit }
4
+ require 'optparse'
5
+ require 'ostruct'
6
+ require 'stringio'
7
+ require 'yaml'
8
+
9
+ $:.unshift File.dirname(__FILE__) + "/../lib"
10
+ require 'camping'
11
+ require 'camping/server'
12
+
13
+ conf = OpenStruct.new(:host => '0.0.0.0', :port => 3301)
14
+
15
+ # Setup paths
16
+ if home = ENV['HOME'] # POSIX
17
+ db_path = File.join(home, '.camping.db')
18
+ rc_path = File.join(home, '.campingrc')
19
+ elsif home = ENV['APPDATA'] # MSWIN
20
+ db_path = File.join(home, 'Camping.db')
21
+ rc_path = File.join(home, 'Campingrc')
22
+ end
23
+
24
+ # Parse options
25
+ opts = OptionParser.new do |opts|
26
+ opts.banner = "Usage: camping app1.rb, app2.rb..."
27
+ opts.define_head "#{File.basename($0)}, the microframework ON-button for ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
28
+ opts.separator ""
29
+ opts.separator "Specific options:"
30
+
31
+ opts.on("-h", "--host HOSTNAME", "Host for web server to bind to (default is all IPs)") { |conf.host| }
32
+ opts.on("-p", "--port NUM", "Port for web server (defaults to #{conf.port})") { |conf.port| }
33
+ opts.on("-d", "--database FILE", "SQLite3 database path (defaults to #{db_path ? db_path : '<none>'})") { |db_path| conf.database = {:adapter => 'sqlite3', :database => db_path} }
34
+ opts.on("-C", "--console", "Run in console mode with IRB") { conf.server = "console" }
35
+ server_list = ["mongrel", "webrick", "console"]
36
+ opts.on("-s", "--server NAME", server_list, "Server to force (#{server_list.join(', ')})") { |conf.server| }
37
+
38
+ opts.separator ""
39
+ opts.separator "Common options:"
40
+
41
+ # No argument, shows at tail. This will print an options summary.
42
+ # Try it and see!
43
+ opts.on_tail("-?", "--help", "Show this message") do
44
+ puts opts
45
+ exit
46
+ end
47
+
48
+ # Another typical switch to print the version.
49
+ opts.on_tail("-v", "--version", "Show version") do
50
+ puts Gem.loaded_specs['camping'].version
51
+ exit
52
+ end
53
+ end
54
+
55
+ begin
56
+ opts.parse! ARGV
57
+ rescue OptionParser::ParseError => ex
58
+ STDERR.puts "!! #{ex.message}"
59
+ puts "** use `#{File.basename($0)} --help` for more details..."
60
+ exit 1
61
+ end
62
+
63
+ if ARGV.length < 1
64
+ puts opts
65
+ exit 1
66
+ end
67
+
68
+ # Load configuration if any
69
+ if rc_path and File.exists?(rc_path)
70
+ YAML.load_file(rc_path).each do |k,v|
71
+ conf.send("#{k}=", v) unless conf.send(k)
72
+ end
73
+ puts "** conf file #{rc_path} loaded"
74
+ end
75
+
76
+ # Default db
77
+ if conf.database.nil? and db_path
78
+ conf.database = { :adapter => 'sqlite3', :database => db_path }
79
+ end
80
+
81
+
82
+ # get a copy of the paths to pass to the server
83
+ paths = ARGV.dup
84
+
85
+ # Check that mongrel exists
86
+ if conf.server.nil? || conf.server == "mongrel"
87
+ begin
88
+ require 'mongrel'
89
+ conf.server = "mongrel"
90
+ rescue LoadError
91
+ puts "!! could not load mongrel. Falling back to webrick."
92
+ conf.server = "webrick"
93
+ end
94
+ end
95
+
96
+ server = Camping::Server.new(conf, paths)
97
+ server.start
@@ -0,0 +1,184 @@
1
+ module Camping
2
+ # == The Camping Reloader
3
+ #
4
+ # Camping apps are generally small and predictable. Many Camping apps are
5
+ # contained within a single file. Larger apps are split into a handful of
6
+ # other Ruby libraries within the same directory.
7
+ #
8
+ # Since Camping apps (and their dependencies) are loaded with Ruby's require
9
+ # method, there is a record of them in $LOADED_FEATURES. Which leaves a
10
+ # perfect space for this class to manage auto-reloading an app if any of its
11
+ # immediate dependencies changes.
12
+ #
13
+ # == Wrapping Your Apps
14
+ #
15
+ # Since bin/camping and the Camping::Server class already use the Reloader,
16
+ # you probably don't need to hack it on your own. But, if you're rolling your
17
+ # own situation, here's how.
18
+ #
19
+ # Rather than this:
20
+ #
21
+ # require 'yourapp'
22
+ #
23
+ # Use this:
24
+ #
25
+ # require 'camping/reloader'
26
+ # reloader = Camping::Reloader.new('/path/to/yourapp.rb')
27
+ # blog = reloader.apps[:Blog]
28
+ # wiki = reloader.apps[:Wiki]
29
+ #
30
+ # The <tt>blog</tt> and <tt>wiki</tt> objects will behave exactly like your
31
+ # Blog and Wiki, but they will update themselves if yourapp.rb changes.
32
+ #
33
+ # You can also give Reloader more than one script.
34
+ class Reloader
35
+ attr_reader :scripts
36
+
37
+ # This is a simple wrapper which causes the script to reload (if needed)
38
+ # on any method call. Then the method call will be forwarded to the
39
+ # app.
40
+ class App # :nodoc:
41
+ instance_methods.each { |m| undef_method m unless m =~ /^__/ }
42
+ attr_accessor :app, :script
43
+
44
+ def initialize(script)
45
+ @script = script
46
+ end
47
+
48
+ # Reloads if needed, before calling the method on the app.
49
+ def method_missing(meth, *args, &blk)
50
+ @script.reload!
51
+ @app.send(meth, *args, &blk)
52
+ end
53
+ end
54
+
55
+ # This class is doing all the hard work; however, it only works on
56
+ # single files. Reloader just wraps up support for multiple scripts
57
+ # and hides away some methods you normally won't need.
58
+ class Script # :nodoc:
59
+ attr_reader :apps, :file, :dir, :extras
60
+
61
+ def initialize(file)
62
+ @file = File.expand_path(file)
63
+ @dir = File.dirname(@file)
64
+ @extras = File.join(@dir, File.basename(@file, ".rb"))
65
+ @mtime = Time.at(0)
66
+ @requires = []
67
+ @apps = {}
68
+ end
69
+
70
+ # Loads the apps availble in this script. Use <tt>apps</tt> to get
71
+ # the loaded apps.
72
+ def load_apps
73
+ all_requires = $LOADED_FEATURES.dup
74
+ all_apps = Camping::Apps.dup
75
+
76
+ begin
77
+ load(@file)
78
+ rescue Exception => e
79
+ puts "!! Error loading #{@file}:"
80
+ puts "#{e.class}: #{e.message}"
81
+ puts e.backtrace
82
+ puts "!! Error loading #{@file}, see backtrace above"
83
+ end
84
+
85
+ @requires = ($LOADED_FEATURES - all_requires).map do |req|
86
+ full = full_path(req)
87
+ full if full == @file or full.index(@extras) == 0
88
+ end
89
+
90
+ @mtime = mtime
91
+
92
+ new_apps = (Camping::Apps - all_apps)
93
+ old_apps = @apps.dup
94
+ @apps = new_apps.inject({}) do |hash, app|
95
+ key = app.name.to_sym
96
+ hash[key] = (old = old_apps[key]) || App.new(self)
97
+ hash[key].app = app
98
+ app.create if app.respond_to?(:create) && !old
99
+ hash
100
+ end
101
+ self
102
+ end
103
+
104
+ # Removes all the apps defined in this script.
105
+ def remove_apps
106
+ @apps.each do |name, app|
107
+ Camping::Apps.delete(app.app)
108
+ Object.send :remove_const, name
109
+ end
110
+ end
111
+
112
+ # Reloads the file if needed. No harm is done by calling this multiple
113
+ # times, so feel free call just to be sure.
114
+ def reload!
115
+ return if @mtime >= mtime
116
+ remove_apps
117
+ load_apps
118
+ end
119
+
120
+ # Checks if both scripts watches the same file.
121
+ def ==(other)
122
+ @file == other.file
123
+ end
124
+
125
+ private
126
+
127
+ def mtime
128
+ (@requires + [@file]).compact.map do |fname|
129
+ File.mtime(fname)
130
+ end.reject{|t| t > Time.now }.max
131
+ end
132
+
133
+ # Figures out the full path of a required file.
134
+ def full_path(req)
135
+ dir = File.expand_path($LOAD_PATH.detect { |l| File.exists?(File.join(l, req)) })
136
+ File.join(dir, req)
137
+ end
138
+ end
139
+
140
+ # Creates the reloader, assigns a +script+ to it and initially loads the
141
+ # application. Pass in the full path to the script, otherwise the script
142
+ # will be loaded relative to the current working directory.
143
+ def initialize(*scripts)
144
+ @scripts = []
145
+ update(*scripts)
146
+ end
147
+
148
+ # Updates the reloader to only use the scripts provided:
149
+ #
150
+ # reloader.update("examples/blog.rb", "examples/wiki.rb")
151
+ def update(*scripts)
152
+ old = @scripts.dup
153
+ clear
154
+ @scripts = scripts.map do |script|
155
+ s = Script.new(script)
156
+ if pos = old.index(s)
157
+ # We already got a script, so we use the old (which might got a mtime)
158
+ old[pos]
159
+ else
160
+ s.load_apps
161
+ end
162
+ end
163
+ end
164
+
165
+ # Removes all the scripts from the reloader.
166
+ def clear
167
+ @scrips = []
168
+ end
169
+
170
+ # Simply calls reload! on all the Script objects.
171
+ def reload!
172
+ @scripts.each { |script| script.reload! }
173
+ end
174
+
175
+ # Returns a Hash of all the apps available in the scripts, where the key
176
+ # would be the name of the app (the one you gave to Camping.goes) and the
177
+ # value would be the app (wrapped inside App).
178
+ def apps
179
+ @scripts.inject({}) do |hash, script|
180
+ hash.merge(script.apps)
181
+ end
182
+ end
183
+ end
184
+ end