nutcracker-web 0.0.2 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 059b9e6810cef19e969f20bc72a96a35772e613b
4
- data.tar.gz: 240d45c7a0db947982941e626b6de549f836d45f
3
+ metadata.gz: d2ba21362a18931a82195835f4f7dec9c6c71b9c
4
+ data.tar.gz: 6ce0a8e41632ff29ce925f94f237d65e412a516c
5
5
  SHA512:
6
- metadata.gz: faa0ec138f3f2e2ceda7bf33ae81ddc7ed6fc97381ed7316a657e7ebfeea0c960b1b44d0e38e39c4fe7fb3c17a6e2de08b416395b5dce8f2ae140ced04005835
7
- data.tar.gz: 7da0cc7cd819169ae6d5486ca01cccd2121a0739433a5b179952adc55948c9bbc72e529019303d4cb4e93df91d9103c4a38870ed817749437e0e7e25b5e36491
6
+ metadata.gz: 8d53e928a26d68bc140db6423b35979c5e7f500d6e7c8bd6152c381624e212a580456d0d90869e13b95263dbe753a75f09ebf05b9c129fecc4f35907a6bded15
7
+ data.tar.gz: 78cf229dbb27d890a0a53b9d2f0c3a529231ec2b302403897819d1941f9a15c7b96c49be9ed272764db4641b4ab62d881bc376c6ef8db6f798231ba21051dbfe
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  Nutcracker Web
2
2
  =============
3
3
 
4
- [Nutcracker](https://github.com/kontera-technologies/nutcracker) web interface plugin
4
+ [Nutcracker](https://github.com/kontera-technologies/nutcracker) web interface plugin<br/>
5
+ <a href="https://rubygems.org/gems/nutcracker-web"><img src=https://fury-badge.herokuapp.com/rb/nutcracker-web.png></a>
5
6
 
6
- <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic1.png"/></br>
7
- <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic2.png"/></br>
8
7
  <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic3.png"/></br>
9
- <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic4.png"/></br>
8
+
9
+ ### Disclaimer
10
+ this project is still in its early stages, so things could be a little buggy, if you find one, feel free to [report](https://github.com/kontera-technologies/nutcracker-web/issues) it.
11
+ Also nutcracker-web only supports Redis instances for now.
12
+
13
+ ### Dependencies
14
+ - Ruby 1.9+
15
+ - [nutcracker-ruby](https://github.com/kontera-technologies/nutcracker)
10
16
 
11
17
  ### Installation
12
18
  add this to your Gemfile
@@ -20,7 +26,6 @@ $ bundle install
20
26
  ```
21
27
 
22
28
  ### Usage
23
- example app
24
29
  ```ruby
25
30
  require 'nutcracker'
26
31
  require 'nutcracker/web'
@@ -29,28 +34,45 @@ require 'nutcracker/web'
29
34
  nutcracker = Nutcracker.start(config_file: 'cluster.conf')
30
35
 
31
36
  # Start the web service on port 1234 using Webrick
32
- nutcracker.use(:graphite, Port: 1234)
37
+ nutcracker.use(:web, Port: 1234)
33
38
 
34
39
  # Sleeping....
35
40
  nutcracker.join
36
41
  ```
37
42
 
38
- `Nutcracker-Web` takes default [Rack](https://github.com/rack/rack) [options](https://github.com/rack/rack/blob/master/lib/rack/server.rb#L187..L199)
43
+ you can pass default [Rack](https://github.com/rack/rack) [options](https://github.com/rack/rack/blob/master/lib/rack/server.rb#L187..L199) to `Nutcracker#use` ( like :Host, :server etc)
39
44
 
40
45
  ### Custom Webserver
41
- default webserver is `Webrick`, to use a different one, like [thin](http://code.macournoyer.com/thin/):
42
-
43
- ```
44
- $ gem install thin
45
- ```
46
+ to use a different webserver like [thin](http://code.macournoyer.com/thin/)
46
47
 
47
- tell `Nutcracker-Web` to use it
48
48
  ```ruby
49
49
  require 'nutcracker'
50
50
  require 'nutcracker/web'
51
51
  require 'thin'
52
52
 
53
53
  nutcracker = Nutcracker.start(config_file: 'cluster.conf')
54
- nutcracker.use(:graphite, Port: 1234, server: :thin)
54
+ nutcracker.use(:web, Port: 1234, server: :thin)
55
55
  nutcracker.join
56
56
  ```
57
+
58
+ ### Developer
59
+ to run nutcracker-web with stub data
60
+ - `bundle install`
61
+ - run the `rackup` command to start the service.
62
+ - edit `example.json`.
63
+ - client Backbone app is under `assets` and the Sinatra backend is under the `lib` directory.
64
+
65
+ ### Packaging & Testing
66
+ - `rake compile` : compile the assets into a single application.{js,css} file under the public directory
67
+ - `rake build` : compile the assets & builds a new gem
68
+ - `rake test` : runs the jasmine tests suite
69
+
70
+ ### Warranty
71
+ This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
72
+
73
+ ### More PNGs
74
+ <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic1.png"/></br>
75
+ <hr>
76
+ <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic2.png"/></br>
77
+ <hr>
78
+ <img src="https://github.com/kontera-technologies/nutcracker-web/raw/master/pics/pic4.png"/></br>
@@ -7,13 +7,18 @@ module Nutcracker
7
7
  class App < Sinatra::Base
8
8
  enable :inline_templates
9
9
  set :root, File.expand_path('../'*4,__FILE__)
10
+
11
+ def initialize(nutcracker = nil)
12
+ @nutcracker = nutcracker
13
+ super()
14
+ end
10
15
 
11
16
  get '/' do
12
17
  haml :index
13
18
  end
14
19
 
15
20
  def overview
16
- $nutcracker.overview rescue
21
+ @nutcracker.overview rescue
17
22
  JSON.parse File.read File.join(settings.root,"example.json")
18
23
  end
19
24
 
@@ -39,7 +44,6 @@ __END__
39
44
  %script(type='text/javascript' src='http://www.google.com/jsapi')
40
45
  %script(type='text/javascript' src='assets/application.js')
41
46
  %link(rel='stylesheet' href='assets/application.css')
42
- %link(rel="shortcut icon" href="http://publishers.kontera.com/favicon.ico")
43
47
  %body
44
48
  = yield
45
49
 
@@ -1,5 +1,5 @@
1
1
  module Nutcracker
2
2
  module Web
3
- VERSION="0.0.2"
3
+ VERSION="0.0.3"
4
4
  end
5
5
  end
@@ -3,12 +3,11 @@ require "rack"
3
3
  module Nutcracker
4
4
  module Web
5
5
  def self.start(nutcracker, options = {})
6
- $nutcracker = nutcracker
7
6
  @thread = Thread.new do
8
7
  Thread.current.abort_on_exception=true
9
8
  Rack::Server.start(
10
9
  {
11
- :app => Nutcracker::Web::App,
10
+ :app => App.new(nutcracker),
12
11
  :environment => 'production',
13
12
  :pid => nil,
14
13
  :Port => 9292,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutcracker-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eran Barak Levi