bang-bang 0.1.6 → 0.2.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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bang-bang (0.1.5)
4
+ bang-bang (0.1.6)
5
5
  activesupport (>= 2.0.0)
6
6
  honkster-addressable (>= 2.2.3)
7
7
  mustache
data/README.markdown CHANGED
@@ -1,25 +1,25 @@
1
- # TrueWeb
1
+ # BangBang
2
2
 
3
- TrueWeb is a lightweight Sinatra web VC stack. Currently, it doesn't have strong opinions, to allow flexibility to discover good idioms.
3
+ BangBang is a lightweight Sinatra web VC stack. Currently, it doesn't have strong opinions, to allow flexibility to discover good idioms.
4
4
 
5
5
  ## Basic Layout
6
6
 
7
- TrueWeb has a basic app structure, similar to Rails.
7
+ BangBang has a basic app structure, similar to Rails.
8
8
  Right now, no conventions are "forced" on you. This is done to allow experimentation and keep things lightweight.
9
9
 
10
10
  You pick the model library.
11
11
 
12
12
  Right now there are no generators.
13
13
 
14
- ### TrueWeb::Controller
14
+ ### BangBang::Controller
15
15
 
16
- TrueWeb::Controller is a subclass of Sinatra::Base.
16
+ BangBang::Controller is a subclass of Sinatra::Base.
17
17
  It's meant to provide an encapsulated unit of functionality within your app.
18
18
  How you group your actions is up to you.
19
19
 
20
20
  ### NamedRoutes
21
21
 
22
- TrueWeb uses the [named-routes](https://github.com/btakita/named-routes) library.
22
+ BangBang uses the [named-routes](https://github.com/btakita/named-routes) library.
23
23
 
24
24
  Here is a good pattern to follow:
25
25
 
@@ -5,21 +5,8 @@ module BangBang
5
5
 
6
6
  class_inheritable_accessor :config
7
7
  extend(Module.new do
8
- def uris
9
- config.uris
10
- end
11
-
12
- def views_class
13
- config.views_class
14
- end
15
-
16
- def path(*args, &block)
17
- uris.path(*args, &block)
18
- end
19
-
20
- def services
21
- config.services
22
- end
8
+ delegate :uris, :views_class, :services, :to => :config
9
+ delegate :path, :to => :uris
23
10
  end)
24
11
 
25
12
  TEMPLATE_TYPE_NAME = "Template"
@@ -1,3 +1,3 @@
1
1
  module BangBang
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/bang-bang.rb CHANGED
@@ -18,27 +18,22 @@ module BangBang
18
18
  end
19
19
 
20
20
  module ClassMethods
21
- attr_accessor :controller, :application_name, :named_routes, :stderr_dir, :stdout_dir, :root_dir, :views_class
21
+ attr_accessor :application_name, :named_routes, :stderr_dir, :stdout_dir, :root_dir, :views_class
22
22
  alias_method :uris, :named_routes
23
- delegate :define_routes, :to => :controller
24
23
 
25
24
  include ::BangBang::EnvMethods
26
25
 
27
26
  def init(params={})
28
- self.controller = params[:controller] || raise(ArgumentError, "You must provide an :controller param")
29
27
  self.application_name = params[:application_name] || raise(ArgumentError, "You must provide an :application_name param")
30
28
  self.root_dir = params[:root_dir] || raise(ArgumentError, "You must provide a :root_dir param")
31
29
  self.named_routes = params[:named_routes] || raise(ArgumentError, "You must provide a :named_routes param")
32
30
  self.views_class = params[:views_class] || raise(ArgumentError, "You must provide a :views_class param")
33
- self.controller.config = self
34
31
 
35
32
  plugins.init
36
33
  end
37
34
 
38
- def app
39
- @app ||= Rack::Builder.new do
40
- run controller
41
- end.to_app
35
+ def register_controller(controller)
36
+ controller.config = self
42
37
  end
43
38
 
44
39
  def register_service(path, &block)
@@ -11,6 +11,7 @@ module FixtureApp
11
11
  class Controller < ::BangBang::Controller
12
12
  set :dump_errors, false
13
13
  end
14
+ register_controller Controller
14
15
 
15
16
  class Views < ::BangBang::Views
16
17
  end
@@ -20,7 +21,6 @@ module FixtureApp
20
21
  end
21
22
 
22
23
  FixtureApp.init(
23
- :controller => FixtureApp::Controller,
24
24
  :application_name => "fixture-app",
25
25
  :root_dir => File.dirname(__FILE__),
26
26
  :named_routes => FixtureApp::Routes,
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bang-bang
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.6
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Takita