vegas 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1 @@
1
- .DS_Store
1
+
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.1.2 2009-12-28
2
+
3
+ * New
4
+ * method: #load_config_file(path) reads a file and then eval's its contents within the scope of the app.
5
+ * options: :before_run can take a Proc which is called after the options are parsed and before the app is run
6
+
1
7
  == 0.1.1 2009-11-18
2
8
 
3
9
  * Repackaged with Jeweler, fixed dependency issues and removed other dev artifacts
data/lib/vegas.rb CHANGED
@@ -8,7 +8,7 @@ end
8
8
  $LOAD_PATH.unshift File.dirname(__FILE__)
9
9
 
10
10
  module Vegas
11
- VERSION = "0.1.1"
11
+ VERSION = "0.1.2"
12
12
  WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i)
13
13
 
14
14
  autoload :Runner, 'vegas/runner'
data/lib/vegas/runner.rb CHANGED
@@ -28,7 +28,8 @@ module Vegas
28
28
 
29
29
  @rack_handler = @app.respond_to?(:detect_rack_handler) ?
30
30
  @app.send(:detect_rack_handler) : Rack::Handler.get('thin')
31
- # load options from opt parser
31
+
32
+ # load options from opt parser
32
33
  @args = define_options do |opts|
33
34
  if block_given?
34
35
  opts.separator ''
@@ -36,10 +37,19 @@ module Vegas
36
37
  yield(self, opts, app)
37
38
  end
38
39
  end
40
+
41
+ # Call before run if before_run is a Proc
42
+ if before_run = options.delete(:before_run) and
43
+ before_run.is_a?(Proc)
44
+ before_run.call(self)
45
+ end
39
46
 
40
47
  # set app options
41
48
  @host = options[:host] || HOST
42
- @app.set(options) if @app.respond_to?(:set)
49
+ if @app.respond_to?(:set)
50
+ @app.set(options)
51
+ @app.set(:vegas, self)
52
+ end
43
53
  # initialize app dir
44
54
  FileUtils.mkdir_p(app_dir)
45
55
  return if options[:start] === false
@@ -182,6 +192,15 @@ module Vegas
182
192
  logger.info "#{app_name} not running!"
183
193
  end
184
194
  end
195
+
196
+ # Loads a config file at config_path and evals it in the context of the @app.
197
+ def load_config_file(config_path)
198
+ abort "Can not find config file at #{config_path}" if !File.readable?(config_path)
199
+ config = File.read(config_path)
200
+ # trim off anything after __END__
201
+ config.sub!(/^__END__\n.*/, '')
202
+ @app.module_eval(config)
203
+ end
185
204
 
186
205
  def self.logger=(logger)
187
206
  @logger = logger
Binary file
data/vegas.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vegas}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Quint"]
12
- s.date = %q{2009-11-18}
12
+ s.date = %q{2009-12-28}
13
13
  s.description = %q{Vegas aims to solve the simple problem of creating executable versions of Sinatra/Rack apps. It includes a class Vegas::Runner that wraps Rack/Sinatra applications and provides a simple command line interface and launching mechanism.}
14
14
  s.email = ["aaron@quirkey.com"]
15
15
  s.extra_rdoc_files = [
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "lib/vegas.rb",
26
26
  "lib/vegas/runner.rb",
27
+ "pkg/vegas-0.1.1.gem",
27
28
  "test/apps.rb",
28
29
  "test/test_app/bin/test_app",
29
30
  "test/test_app/bin/test_rack_app",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vegas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-18 00:00:00 -05:00
12
+ date: 2009-12-28 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,7 @@ files:
60
60
  - Rakefile
61
61
  - lib/vegas.rb
62
62
  - lib/vegas/runner.rb
63
+ - pkg/vegas-0.1.1.gem
63
64
  - test/apps.rb
64
65
  - test/test_app/bin/test_app
65
66
  - test/test_app/bin/test_rack_app