lattice 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/.travis.yml +15 -3
- data/CHANGES.md +7 -0
- data/Gemfile +3 -1
- data/README.md +65 -18
- data/bin/lattice +5 -0
- data/lattice.gemspec +8 -5
- data/lib/lattice.rb +32 -0
- data/lib/lattice/application.rb +8 -0
- data/lib/lattice/cli.rb +23 -0
- data/lib/lattice/generator.rb +68 -0
- data/lib/lattice/generators/app_base.rb +44 -0
- data/lib/lattice/request_logger.rb +27 -0
- data/lib/lattice/resource.rb +10 -1
- data/lib/lattice/server.rb +33 -0
- data/lib/lattice/version.rb +1 -1
- data/spec/lattice/application_spec.rb +7 -0
- data/spec/lattice/cli_spec.rb +8 -0
- data/spec/lattice/generators/app_base_spec.rb +14 -0
- data/spec/spec_helper.rb +6 -1
- data/template/Gemfile +5 -0
- data/template/README.md +41 -0
- data/template/app/resources/home.rb +7 -0
- data/template/config/application.rb +14 -0
- data/template/config/boot.rb +8 -0
- metadata +55 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a8f7c06d6bea7a244ea71d5015bb3c4246ad8df
|
4
|
+
data.tar.gz: 7e55c3e748cb262fa3c5e1e50ffdb9f4fc5c437b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c53bdb8481350b3f676333f462db567939d1ca53978815ba46d4c16c188fbf3e2d88f4c9af8b513f5d251539a655052c4b2eced8fd2b5a31ea48c2160a95c95
|
7
|
+
data.tar.gz: 2ad9f176a58ff2e07cd196c700c74e53a17eb3e0262acd7642e5bbb4ded0293db63064a8b4460314f962a84a02432ceac4fd38e7520998e0fc5fd25255b118c6
|
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
rvm:
|
2
|
+
- 1.9.3
|
3
|
+
- 2.0.0
|
4
|
+
- ruby-head
|
5
|
+
- jruby-19mode
|
6
|
+
- jruby-head
|
7
|
+
- rbx-19mode
|
8
|
+
|
9
|
+
matrix:
|
10
|
+
allow_failures:
|
11
|
+
- rvm: ruby-head
|
12
|
+
- rvm: jruby-head
|
13
|
+
|
14
|
+
notifications:
|
15
|
+
irc: "irc.freenode.org#celluloid"
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
0.2.0 (2013-10-01)
|
2
|
+
------------------
|
3
|
+
* Create Lattice apps with `lattice new myapp`
|
4
|
+
* Launche Lattice apps with `lattice server`
|
5
|
+
* Initial Lattice application template/skeleton and generator
|
6
|
+
* Initial Lattice command line utility
|
7
|
+
|
1
8
|
0.1.0 (2013-09-15)
|
2
9
|
------------------
|
3
10
|
* Initial release(-ish)
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'celluloid', github: 'celluloid/celluloid'
|
4
4
|
gem 'reel', github: 'celluloid/reel'
|
@@ -10,4 +10,6 @@ gemspec
|
|
10
10
|
|
11
11
|
group :development do
|
12
12
|
gem 'guard-rspec'
|
13
|
+
gem 'coveralls', require: false
|
14
|
+
gem 'pry'
|
13
15
|
end
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
![Lattice](https://github.com/celluloid/lattice/raw/master/logo.png)
|
2
2
|
==========
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/lattice.png)](http://rubygems.org/gems/lattice)
|
3
4
|
[![Build Status](https://secure.travis-ci.org/celluloid/lattice.png?branch=master)](http://travis-ci.org/celluloid/lattice)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/celluloid/lattice.png)](https://codeclimate.com/github/celluloid/lattice)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/celluloid/lattice/badge.png)](https://coveralls.io/r/celluloid/lattice)
|
7
|
+
[![Dependency Status](https://gemnasium.com/celluloid/lattice.png)](https://gemnasium.com/celluloid/lattice)
|
5
8
|
|
6
9
|
Lattice is an actor-based web framework for Ruby built on top of
|
7
10
|
[Celluloid][celluloid], [Reel][reel], and [Webmachine][webmachine]. Designed
|
@@ -15,35 +18,79 @@ web application development today.
|
|
15
18
|
|
16
19
|
## Features
|
17
20
|
|
18
|
-
* Resources
|
19
|
-
an HTTP endpoint
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
* **Resources**: the main glue type between Lattice and the web, resources
|
22
|
+
provide an HTTP endpoint which interfaces with other entities in the system.
|
23
|
+
Lattice uses [Webmachine][webmachine] as its base for its resource framework.
|
24
|
+
|
25
|
+
[webmachine]: https://github.com/seancribbs/webmachine-ruby
|
23
26
|
|
24
27
|
## Vaporware Features (Coming Soon™!)
|
25
28
|
|
26
|
-
* Cells
|
27
|
-
of resources, or are resources themselves.
|
28
|
-
|
29
|
-
|
30
|
-
Interpreter Lock). They can also do scatter/gather-type I/O operations, making
|
31
|
-
them ideal for querying multiple services in parallel when computing a response.
|
32
|
-
Cells map data dependencies into "slots" which can be used by renderers to compute
|
33
|
-
representations of data within the system, an idea which combines Celluloid's
|
34
|
-
[futures][futures] with an API similar to [decent_exposure][decent_exposure].
|
29
|
+
* **Cells**: Lattice's go-to domain model object. Cells represent data
|
30
|
+
dependencies of resources, or are resources themselves. All Cells are
|
31
|
+
Celluloid actors and run in parallel. Cells map data dependencies into "slots"
|
32
|
+
which can be computed in parallel while resources are rendering.
|
35
33
|
|
36
34
|
[futures]: https://github.com/celluloid/celluloid/wiki/futures
|
37
35
|
[decent_exposure]: https://github.com/voxdolo/decent_exposure
|
38
36
|
|
39
|
-
* Renderers
|
37
|
+
* **Renderers**: translate data within the system, as fetched by cells, into
|
40
38
|
a requested representation. Renderers handle the specifics of dynamically
|
41
39
|
constructing output documents from components. Lattice comes with renderers
|
42
40
|
that understand various template languages.
|
43
41
|
|
44
|
-
*
|
45
|
-
simple to send and receive messages from any part of a distributed
|
46
|
-
including background jobs.
|
42
|
+
* **WebSockets**: WebSocket connections back to individual clients. Lattice
|
43
|
+
makes it simple to send and receive messages from any part of a distributed
|
44
|
+
system, including background jobs.
|
45
|
+
|
46
|
+
Documentation
|
47
|
+
-------------
|
48
|
+
|
49
|
+
[Please see the Lattice Wiki][wiki] for detailed documentation and usage notes.
|
50
|
+
|
51
|
+
[YARD Documentation][yardoc] is also available.
|
52
|
+
|
53
|
+
[wiki]: https://github.com/celluloid/lattice/wiki
|
54
|
+
[yardoc]: http://rubydoc.info/github/celluloid/lattice/master/frames
|
55
|
+
|
56
|
+
Usage
|
57
|
+
-----
|
58
|
+
|
59
|
+
Lattice provides a Rails-like experience for getting you up-and-running.
|
60
|
+
|
61
|
+
First, install the Lattice gem:
|
62
|
+
|
63
|
+
```
|
64
|
+
$ gem install lattice
|
65
|
+
```
|
66
|
+
|
67
|
+
Now create a new Lattice application using the CLI tool:
|
68
|
+
|
69
|
+
```
|
70
|
+
$ lattice new my_app
|
71
|
+
```
|
72
|
+
|
73
|
+
Unlike Rails we don't automatically run Bundler for you. You'll have to do
|
74
|
+
that yourself:
|
75
|
+
|
76
|
+
```
|
77
|
+
$ cd my_app
|
78
|
+
$ bundle
|
79
|
+
```
|
80
|
+
|
81
|
+
Your new Lattice app is ready to go! Run:
|
82
|
+
|
83
|
+
```
|
84
|
+
$ lattice server
|
85
|
+
```
|
86
|
+
|
87
|
+
...to launch your new Lattice app under a local web server. By default the
|
88
|
+
appliaction will launch on http://127.0.0.1:3000/. If you visit this URL you
|
89
|
+
should see:
|
90
|
+
|
91
|
+
```
|
92
|
+
Hello, Lattice!
|
93
|
+
```
|
47
94
|
|
48
95
|
Copyright
|
49
96
|
---------
|
data/bin/lattice
ADDED
data/lattice.gemspec
CHANGED
@@ -14,12 +14,15 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.name = 'lattice'
|
15
15
|
gem.require_paths = ['lib']
|
16
16
|
gem.version = Lattice::VERSION
|
17
|
+
gem.licenses = ['MIT']
|
17
18
|
|
18
|
-
gem.
|
19
|
-
gem.
|
20
|
-
gem.
|
21
|
-
gem.
|
19
|
+
gem.add_runtime_dependency 'celluloid', '>= 0.15.1'
|
20
|
+
gem.add_runtime_dependency 'reel', '>= 0.4.0'
|
21
|
+
gem.add_runtime_dependency 'webmachine', '~> 1.2.1'
|
22
|
+
gem.add_runtime_dependency 'activesupport', '~> 4.0.0'
|
23
|
+
gem.add_runtime_dependency 'thor', '>= 0.18.0'
|
24
|
+
gem.add_runtime_dependency 'colorize', '>= 0.5.0'
|
22
25
|
|
23
26
|
gem.add_development_dependency 'rake'
|
24
|
-
gem.add_development_dependency
|
27
|
+
gem.add_development_dependency 'rspec', '>= 2.7.0'
|
25
28
|
end
|
data/lib/lattice.rb
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
require 'lattice/version'
|
2
|
+
require 'lattice/application'
|
2
3
|
require 'lattice/resource'
|
4
|
+
require 'pathname'
|
3
5
|
|
4
6
|
module Lattice
|
7
|
+
class << self
|
8
|
+
attr_writer :app, :logger
|
9
|
+
|
10
|
+
def app
|
11
|
+
raise "no application set" unless defined?(@app)
|
12
|
+
@app
|
13
|
+
end
|
14
|
+
|
15
|
+
def root=(path)
|
16
|
+
@root = Pathname.new(path)
|
17
|
+
end
|
18
|
+
|
19
|
+
def root
|
20
|
+
@root || begin
|
21
|
+
pwd = Dir.pwd
|
22
|
+
gemfile = File.join pwd, 'Gemfile'
|
23
|
+
|
24
|
+
# FIXME: Kinda hax :|
|
25
|
+
unless File.read(gemfile)["gem 'lattice'"]
|
26
|
+
raise "couldn't find app in: '#{Dir.pwd}'"
|
27
|
+
end
|
28
|
+
|
29
|
+
pwd
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def logger
|
34
|
+
@logger || Celluloid.logger
|
35
|
+
end
|
36
|
+
end
|
5
37
|
end
|
data/lib/lattice/cli.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Lattice
|
4
|
+
class CLI < Thor
|
5
|
+
desc "create NAME", "create a new Lattice application called NAME"
|
6
|
+
def create(name)
|
7
|
+
require "lattice/generators/app_base"
|
8
|
+
|
9
|
+
app_root = File.expand_path("./#{name}")
|
10
|
+
Generators::AppBase.new(name).generate app_root
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "server", "launch a local Lattice server"
|
14
|
+
def server
|
15
|
+
require "lattice/server"
|
16
|
+
|
17
|
+
Lattice::Server.new("127.0.0.1", 3000, root: Lattice.root).run
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "new NAME", "alias for create"
|
21
|
+
alias new create
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
require 'erb'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Lattice
|
6
|
+
module Generator
|
7
|
+
include FileUtils
|
8
|
+
|
9
|
+
# Create a directory within the application if it doesn't exit
|
10
|
+
def generate_directory(path)
|
11
|
+
if File.directory?(path)
|
12
|
+
ohai " exist".light_blue + " #{path}"
|
13
|
+
elsif File.exist?(path)
|
14
|
+
ohai " conflict".light_red + " #{output_path}"
|
15
|
+
ohai "Template resumes #{output_path} is a directory!"
|
16
|
+
else
|
17
|
+
ohai " create".light_green + " #{path}"
|
18
|
+
mkdir_p path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Render a file template and generate the associated output
|
23
|
+
def generate_file(input_path, output_path)
|
24
|
+
renderer = ERBRenderer.new(input_path, app_const_base: @app_const_base)
|
25
|
+
generated_file = renderer.render
|
26
|
+
|
27
|
+
if File.exist?(output_path)
|
28
|
+
existing_file = File.read(output_path)
|
29
|
+
if generated_file == existing_file
|
30
|
+
ohai " identical".light_blue + " #{output_path}"
|
31
|
+
else
|
32
|
+
ohai " conflict".light_red + " #{output_path}"
|
33
|
+
overwrite = prompt("Overwrite #{output_path}? [yn] ")
|
34
|
+
if overwrite == "y"
|
35
|
+
ohai " force".light_yellow + " #{output_path}"
|
36
|
+
File.open(output_path, "w") { |f| f << generated_file }
|
37
|
+
else
|
38
|
+
ohai " skip".light_yellow + " #{output_path}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
directory = File.dirname(output_path) + "/"
|
43
|
+
generate_directory(directory) unless File.directory?(directory)
|
44
|
+
ohai " create".light_green + " #{output_path}"
|
45
|
+
File.open(output_path, "w") { |f| f << generated_file }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Tell the user something
|
50
|
+
def ohai(message)
|
51
|
+
puts message
|
52
|
+
end
|
53
|
+
|
54
|
+
# Renders ERB file templates for generators
|
55
|
+
class ERBRenderer
|
56
|
+
def initialize(template, options)
|
57
|
+
@template = template
|
58
|
+
@options = options
|
59
|
+
end
|
60
|
+
|
61
|
+
def render
|
62
|
+
ERB.new(File.read(@template)).result(binding)
|
63
|
+
end
|
64
|
+
|
65
|
+
def app_const_base; @options[:app_const_base]; end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'lattice/generator'
|
2
|
+
require 'active_support/inflector'
|
3
|
+
|
4
|
+
module Lattice
|
5
|
+
module Generators
|
6
|
+
class AppBase
|
7
|
+
include Generator
|
8
|
+
|
9
|
+
DEFAULT_APP_TEMPLATE = File.expand_path("../../../../template", __FILE__)
|
10
|
+
|
11
|
+
def initialize(name, options = {})
|
12
|
+
@name = name.to_s
|
13
|
+
@app_const_base = @name.camelize
|
14
|
+
|
15
|
+
@template_path = options[:template_path] || DEFAULT_APP_TEMPLATE
|
16
|
+
end
|
17
|
+
|
18
|
+
# Generate a Lattice application at the given path
|
19
|
+
def generate(app_root)
|
20
|
+
app_root = File.expand_path(app_root)
|
21
|
+
|
22
|
+
# Is this a brand spankin' new app?
|
23
|
+
new_app = !File.exists?(app_root)
|
24
|
+
|
25
|
+
template_paths = Dir[File.join(@template_path, '**', '*')]
|
26
|
+
raise "No templates found. Something's wrong? :(" if template_paths.empty?
|
27
|
+
|
28
|
+
template_paths.each do |input_path|
|
29
|
+
relative_path = input_path.sub(@template_path, '')
|
30
|
+
output_path = File.join(app_root, relative_path)
|
31
|
+
|
32
|
+
if File.directory?(input_path)
|
33
|
+
generate_directory(output_path)
|
34
|
+
else
|
35
|
+
generate_file(input_path, output_path)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
ohai "NOTE: Don't forget to: ".light_yellow +
|
40
|
+
"cd #{app_root} && bundle".light_white
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Lattice
|
2
|
+
class RequestLogger
|
3
|
+
def call(*args)
|
4
|
+
handle_event Webmachine::Events::InstrumentedEvent.new(*args)
|
5
|
+
end
|
6
|
+
|
7
|
+
def handle_event(event)
|
8
|
+
request = event.payload[:request]
|
9
|
+
resource = event.payload[:resource]
|
10
|
+
code = event.payload[:code]
|
11
|
+
uri = URI(request.uri)
|
12
|
+
|
13
|
+
# Translate extended HTTP verbs via the magical query parameter
|
14
|
+
if request.method == "POST" && request.query['_method']
|
15
|
+
method = request.query['_method']
|
16
|
+
else
|
17
|
+
method = request.method
|
18
|
+
end
|
19
|
+
|
20
|
+
Lattice.logger.info "\"%s %s\" %d %.1fms (%s)" % [
|
21
|
+
method, uri.path, code, event.duration, resource
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Webmachine::Events.subscribe('wm.dispatch', RequestLogger.new)
|
27
|
+
end
|
data/lib/lattice/resource.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'webmachine'
|
2
2
|
require 'active_support/core_ext/class/attribute'
|
3
3
|
|
4
|
+
# For Celluloid::Logger
|
5
|
+
require 'celluloid'
|
6
|
+
|
4
7
|
module Lattice
|
5
8
|
class Resource < Webmachine::Resource
|
9
|
+
include Celluloid::Logger
|
10
|
+
|
6
11
|
class_attribute :allowed_methods
|
7
12
|
class_attribute :content_types_accepted
|
8
13
|
class_attribute :content_types_provided
|
@@ -59,5 +64,9 @@ module Lattice
|
|
59
64
|
return encodings if encodings && !encodings.empty?
|
60
65
|
super
|
61
66
|
end
|
67
|
+
|
68
|
+
def handle_exception(ex)
|
69
|
+
crash "#{self.class} crashed!", ex
|
70
|
+
end
|
62
71
|
end
|
63
|
-
end
|
72
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'reel'
|
2
|
+
require 'lattice'
|
3
|
+
require 'lattice/request_logger'
|
4
|
+
|
5
|
+
module Lattice
|
6
|
+
class Server
|
7
|
+
def initialize(host, port, options = {})
|
8
|
+
@host, @port = host, port
|
9
|
+
@root = options[:root] || Lattice.root
|
10
|
+
load
|
11
|
+
end
|
12
|
+
|
13
|
+
def load
|
14
|
+
$LOAD_PATH << @root
|
15
|
+
require 'config/application'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
app = Lattice.app
|
20
|
+
|
21
|
+
app.configure do |config|
|
22
|
+
config.ip = @host
|
23
|
+
config.port = @port
|
24
|
+
config.adapter = :Reel
|
25
|
+
end
|
26
|
+
|
27
|
+
Lattice.logger.info "A Reel good HTTP server! (Codename \"#{::Reel::CODENAME}\")"
|
28
|
+
Lattice.logger.info "Listening on http://#{@host}:#{@port}"
|
29
|
+
|
30
|
+
app.run
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/lattice/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'lattice/generators/app_base'
|
3
|
+
|
4
|
+
describe Lattice::Generators::AppBase do
|
5
|
+
let(:example_app) { "exemplifier" }
|
6
|
+
let(:example_path) { File.join(TMPDIR, example_app) }
|
7
|
+
|
8
|
+
before(:each) { FileUtils.rm_r(example_path) if File.exists?(example_path) }
|
9
|
+
|
10
|
+
it "generates Lattice template applications" do
|
11
|
+
generator = described_class.new(example_app)
|
12
|
+
generator.generate example_path
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/template/Gemfile
ADDED
data/template/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# <%= app_const_base %>
|
2
|
+
|
3
|
+
A [Lattice][lattice] application created by a brave individual! Rails may be a
|
4
|
+
more conservative choice, but clearly it pissed off the brave individual behind
|
5
|
+
this app, and so here we are.
|
6
|
+
|
7
|
+
You may want to tweak this README to add more specific documentation about this
|
8
|
+
app. Or you don't have to, whatever. But perhaps you want to know more about
|
9
|
+
using Lattice, so here we go:
|
10
|
+
|
11
|
+
## Documentation
|
12
|
+
|
13
|
+
[Please see the Lattice Wiki][wiki] for detailed documentation and usage notes.
|
14
|
+
|
15
|
+
[YARD Documentation][yardoc] is also available.
|
16
|
+
|
17
|
+
[wiki]: https://github.com/celluloid/lattice/wiki
|
18
|
+
[yardoc]: http://rubydoc.info/github/celluloid/lattice/master/frames
|
19
|
+
|
20
|
+
## Adding Resources
|
21
|
+
|
22
|
+
Resources are the heart of any Lattice application. They represent "RESTful"
|
23
|
+
HTTP endpoints that respond in a fully deterministic manner depending on their
|
24
|
+
state.
|
25
|
+
|
26
|
+
Unfortunately, there's no resource generator at present! You will need to view
|
27
|
+
the [Lattice Wiki documentation on Resources][resources] to find out information
|
28
|
+
about the Resource API and how to add new resources to your application.
|
29
|
+
|
30
|
+
[resources]: https://github.com/celluloid/lattice/wiki/Resources
|
31
|
+
|
32
|
+
## Starting the app
|
33
|
+
|
34
|
+
To launch the application, run:
|
35
|
+
|
36
|
+
```
|
37
|
+
$ lattice server
|
38
|
+
```
|
39
|
+
|
40
|
+
By default the appliaction will launch on http://127.0.0.1:3000/
|
41
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path("../boot", __FILE__)
|
2
|
+
|
3
|
+
# Require your resources here
|
4
|
+
require 'resources/home'
|
5
|
+
|
6
|
+
module <%= app_const_base %>
|
7
|
+
Application = Lattice::Application.new do |app|
|
8
|
+
app.routes do
|
9
|
+
add ['*'], Resources::Home
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Lattice.app = <%= app_const_base %>::Application
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
gemfile = ENV['BUNDLE_GEMFILE'] || File.expand_path('../../Gemfile', __FILE__)
|
4
|
+
|
5
|
+
require 'bundler/setup' if File.exists?(gemfile)
|
6
|
+
|
7
|
+
Lattice.root = Pathname.new(File.expand_path('../..', __FILE__))
|
8
|
+
$LOAD_PATH.unshift Lattice.root.join('app').to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lattice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.2.
|
47
|
+
version: 1.2.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.2.
|
54
|
+
version: 1.2.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 4.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.18.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.18.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: colorize
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.5.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.5.0
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rake
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +125,8 @@ dependencies:
|
|
97
125
|
description: A concurrent realtime web framework for Ruby
|
98
126
|
email:
|
99
127
|
- tony.arcieri@gmail.com
|
100
|
-
executables:
|
128
|
+
executables:
|
129
|
+
- lattice
|
101
130
|
extensions: []
|
102
131
|
extra_rdoc_files: []
|
103
132
|
files:
|
@@ -106,20 +135,37 @@ files:
|
|
106
135
|
- .travis.yml
|
107
136
|
- CHANGES.md
|
108
137
|
- Gemfile
|
138
|
+
- Gemfile.lock
|
109
139
|
- Guardfile
|
110
140
|
- LICENSE.txt
|
111
141
|
- README.md
|
112
142
|
- Rakefile
|
143
|
+
- bin/lattice
|
113
144
|
- lattice.gemspec
|
114
145
|
- lib/lattice.rb
|
146
|
+
- lib/lattice/application.rb
|
147
|
+
- lib/lattice/cli.rb
|
148
|
+
- lib/lattice/generator.rb
|
149
|
+
- lib/lattice/generators/app_base.rb
|
150
|
+
- lib/lattice/request_logger.rb
|
115
151
|
- lib/lattice/resource.rb
|
152
|
+
- lib/lattice/server.rb
|
116
153
|
- lib/lattice/version.rb
|
117
154
|
- logo.png
|
155
|
+
- spec/lattice/application_spec.rb
|
156
|
+
- spec/lattice/cli_spec.rb
|
157
|
+
- spec/lattice/generators/app_base_spec.rb
|
118
158
|
- spec/lattice/resource_spec.rb
|
119
159
|
- spec/spec_helper.rb
|
120
160
|
- tasks/rspec.task
|
161
|
+
- template/Gemfile
|
162
|
+
- template/README.md
|
163
|
+
- template/app/resources/home.rb
|
164
|
+
- template/config/application.rb
|
165
|
+
- template/config/boot.rb
|
121
166
|
homepage: https://github.com/tarcieri/lattice
|
122
|
-
licenses:
|
167
|
+
licenses:
|
168
|
+
- MIT
|
123
169
|
metadata: {}
|
124
170
|
post_install_message:
|
125
171
|
rdoc_options: []
|
@@ -143,5 +189,8 @@ specification_version: 4
|
|
143
189
|
summary: Lattice is a pervasively multithreaded web framework for Ruby which makes
|
144
190
|
building realtime web applications with WebSockets simple and fun
|
145
191
|
test_files:
|
192
|
+
- spec/lattice/application_spec.rb
|
193
|
+
- spec/lattice/cli_spec.rb
|
194
|
+
- spec/lattice/generators/app_base_spec.rb
|
146
195
|
- spec/lattice/resource_spec.rb
|
147
196
|
- spec/spec_helper.rb
|