groove 0.1.2 → 0.1.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/groove.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{groove}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Croak"]
12
- s.date = %q{2009-12-31}
12
+ s.date = %q{2010-01-05}
13
13
  s.default_executable = %q{groove}
14
14
  s.description = %q{Generator to create a Sinatra, MongoDB, Effigy, and Hoptoad web app.}
15
15
  s.email = %q{dcroak@thoughtbot.com}
@@ -25,11 +25,7 @@ Gem::Specification.new do |s|
25
25
  "bin/groove",
26
26
  "groove.gemspec",
27
27
  "install.rb",
28
- "lib/groove.rb",
29
- "lib/groove/effigy.rb",
30
- "lib/groove/hoptoad.rb",
31
- "lib/groove/mongo.rb",
32
- "lib/groove/sinatra.rb"
28
+ "lib/groove.rb"
33
29
  ]
34
30
  s.homepage = %q{http://github.com/dancroak/groove}
35
31
  s.rdoc_options = ["--charset=UTF-8"]
data/lib/groove.rb CHANGED
@@ -1,16 +1,49 @@
1
+ require 'rubygems'
2
+ require 'x'
3
+ require 'sinatra'
4
+ require 'mongo'
5
+ require 'effigy'
6
+ require 'rack_hoptoad'
7
+
8
+ configure :production do
9
+ enable :raise_errors
10
+ end
11
+
12
+ module Sinatra
13
+ module Templates
14
+ def effigy(name)
15
+ root = File.join File.dirname(__FILE__)
16
+ require File.join(root, "views", "#{name}.rb")
17
+ template = File.read File.join(root, "templates", "#{name}.html")
18
+ view = Object.const_get("#{name}_view".camel_case).new
19
+ view.render(template)
20
+ end
21
+ end
22
+ end
23
+
24
+ include Mongo
25
+
1
26
  class Groove
2
27
  class << self
3
28
  attr_accessor :config
4
- end
5
29
 
6
- def initialize
7
- @@config = { :db => 'app', :db_url => 'localhost', :hoptoad => '1234' }
30
+ def on(config)
31
+ self.config = { :db => 'app', :db_url => 'localhost', :hoptoad => '1234' }
32
+ self.config.merge(config)
33
+
34
+ mongo
35
+ hoptoad
36
+ end
37
+
38
+ def mongo
39
+ DB = Connection.new(config[:db_url]).db(config[:db])
40
+ if config[:db_user] && config[:db_password]
41
+ DB.authenticate(config[:db_user], config[:db_password])
42
+ end
43
+ end
44
+
45
+ def hoptoad
46
+ use Rack::HoptoadNotifier, config[:hoptoad]
47
+ end
8
48
  end
9
49
  end
10
-
11
- require 'rubygems'
12
- require 'x'
13
- require 'groove/sinatra'
14
- require 'groove/mongo'
15
- require 'groove/effigy'
16
- require 'groove/hoptoad'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groove
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-31 00:00:00 -05:00
12
+ date: 2010-01-05 00:00:00 -05:00
13
13
  default_executable: groove
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -99,10 +99,6 @@ files:
99
99
  - groove.gemspec
100
100
  - install.rb
101
101
  - lib/groove.rb
102
- - lib/groove/effigy.rb
103
- - lib/groove/hoptoad.rb
104
- - lib/groove/mongo.rb
105
- - lib/groove/sinatra.rb
106
102
  has_rdoc: true
107
103
  homepage: http://github.com/dancroak/groove
108
104
  licenses: []
data/lib/groove/effigy.rb DELETED
@@ -1,13 +0,0 @@
1
- require 'effigy'
2
-
3
- module Sinatra
4
- module Templates
5
- def effigy(name)
6
- root = File.join File.dirname(__FILE__)
7
- require File.join(root, "views", "#{name}.rb")
8
- template = File.read File.join(root, "templates", "#{name}.html")
9
- view = Object.const_get("#{name}_view".camel_case).new
10
- view.render(template)
11
- end
12
- end
13
- end
@@ -1,3 +0,0 @@
1
- require 'rack_hoptoad'
2
-
3
- use Rack::HoptoadNotifier, Groove.config[:hoptoad]
data/lib/groove/mongo.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'mongo'
2
-
3
- include Mongo
4
-
5
- DB = Connection.new(Groove.config[:db_url]).db(Groove.config[:db])
6
- if Groove.config[:db_user] && Groove.config[:db_password]
7
- DB.authenticate(Groove.config[:db_user], Groove.config[:db_password])
8
- end
@@ -1,5 +0,0 @@
1
- require 'sinatra'
2
-
3
- configure :production do
4
- enable :raise_errors
5
- end