actionframework 0.1.3.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/bin/action +27 -43
- data/lib/actionframework/authentication.rb +9 -0
- data/lib/actionframework/base.rb +15 -0
- data/lib/actionframework/controller.rb +11 -2
- data/lib/actionframework/model.rb +20 -0
- data/lib/actionframework/modelhelper.rb +27 -9
- data/lib/actionframework/realtime.rb +29 -1
- data/lib/actionframework/realtime_message.rb +13 -0
- data/lib/actionframework/realtime_socket.rb +20 -0
- data/lib/actionframework/routes.rb +29 -4
- data/lib/actionframework/settings.rb +1 -0
- data/lib/actionframework.rb +35 -21
- data/resources/config/auth.rb +1 -0
- data/resources/project_template/Gemfile +3 -0
- data/resources/project_template/authentication/README.md +9 -0
- data/resources/project_template/config/auth.rb +15 -0
- data/resources/project_template/config/plugables.rb +1 -0
- data/resources/project_template/config/routes.rb +5 -0
- data/resources/project_template/config/settings.rb +3 -0
- data/resources/project_template/config.ru +3 -0
- data/resources/project_template/controllers/default_controller.rb +6 -0
- data/resources/project_template/initializers/README.md +6 -0
- data/resources/project_template/models/README.md +0 -0
- data/resources/project_template/static/README.md +0 -0
- data/resources/project_template/views/index.html.erb +12 -0
- data/resources/project_template/views/layout.html.erb +24 -0
- data/resources/templates/index.html.erb +1 -1
- metadata +95 -21
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzkzOWM1OTQ5NzU1MTNkZjczYzk0OTYyY2E1Y2NmOGVlZTJjYTgwYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWIyOWE3ZjIxMjg2NGMyNDgyYTkwMDE4YmI1ZGZiNmE5MWIyOTY2Nw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWE5YmRhODNkNjQ2ZjM2MGYwNDJkMWQ4Yzc3YTk5MTAzODM1ZTkxZmZhZTFj
|
10
|
+
ZDBiOGQ3YTg5M2VjYzJiMzQzM2IzNmY4N2UxMGFmNzRlOWMwNGRkN2JhMTZj
|
11
|
+
NzAwNGU0ODIzNTA1MTgyODVjYzkxZWY1NGYwOGM3OWNhZDUxZmU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTY2MmIxYjA0N2M1Y2JmYWJkMDI3MjgzNDEzYmU2Y2I4Y2ZkZWZmMWE3YTlh
|
14
|
+
NDc5NjY2Zjg2M2Y4NTU4ZWM4NDMzNzc3OTJlNzEzOWNiNWUxNDA5ODViMmIw
|
15
|
+
MzlmMGEzZWM3ZmVmZThhNTVkZWFlNWI0NmM0NmFmNGM4YTZlZTM=
|
data/bin/action
CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'actionframework'
|
5
5
|
require 'json'
|
6
6
|
require 'httparty'
|
7
|
+
require 'minigit'
|
7
8
|
|
8
9
|
class String
|
9
10
|
def black; "\033[30m#{self}\033[0m" end
|
@@ -33,30 +34,14 @@ class ActionFrameworkCLI < Optitron::CLI
|
|
33
34
|
end
|
34
35
|
desc "Create ActionFramework project"
|
35
36
|
def new projectname
|
36
|
-
puts "Creating project directory
|
37
|
+
puts "Creating project directory"
|
37
38
|
Dir.mkdir("#{projectname}")
|
38
|
-
|
39
|
-
|
40
|
-
Dir.
|
41
|
-
Dir.mkdir("#{projectname}/config")
|
42
|
-
Dir.mkdir("#{projectname}/static")
|
43
|
-
Dir.mkdir("#{projectname}/initializers")
|
44
|
-
FileUtils.touch("#{projectname}/views/layout.html.erb")
|
45
|
-
FileUtils.touch("#{projectname}/Gemfile")
|
46
|
-
File.write("#{projectname}/main.rb","# Example of basic configuration\nActionFramework = ActionFramework::Server.new\n\nnActionFramework.autoimport\nActionFramework.start")
|
47
|
-
File.write("#{projectname}/controllers/default_controller.rb","class DefaultController < ActionFramework::Controller
|
48
|
-
\n def index\n erb \"index\" \n end\nend");
|
49
|
-
File.write("#{projectname}/routes.json","{\n \"get\": [{\n \"/\": \"DefaultController#index\"\n}]\n}")
|
50
|
-
File.write("#{projectname}/config/routes.rb","ActionFramework::Server.current.routes do\n\n get \"/\" => \"DefaultController#index\"\n\nend")
|
51
|
-
File.write("#{projectname}/config/settings.rb","ActionFramework::Server.current.settings do |s|\n\nend")
|
52
|
-
File.write("#{projectname}/Gemfile","source 'https://rubygems.org'\n\ngem 'actionframework'")
|
53
|
-
File.write("#{projectname}/config.ru","require 'actionframework'\n\nrun ActionFramework::Base.new")
|
54
|
-
File.write("#{projectname}/config/plugables.rb","# Feature under development")
|
55
|
-
File.write("#{projectname}/views/layout.html.erb",File.read(ActionFramework::Gem.root.resources.templates("layout.html.erb").to_s))
|
56
|
-
File.write("#{projectname}/views/index.html.erb",File.read(ActionFramework::Gem.root.resources.templates("index.html.erb").to_s))
|
39
|
+
puts "Copying project template"
|
40
|
+
path = ActionFramework::Gem.root.resources.project_template.to_s
|
41
|
+
FileUtils.cp_r(Dir.glob(path+"/*"),"#{projectname}")
|
57
42
|
system("cd #{projectname} && bundle install")
|
58
43
|
puts "Done"
|
59
|
-
puts "Run \"
|
44
|
+
puts "Run \"rackup\" to run your app"
|
60
45
|
end
|
61
46
|
|
62
47
|
desc "Start ActionFramework server"
|
@@ -74,30 +59,29 @@ class ActionFrameworkCLI < Optitron::CLI
|
|
74
59
|
end
|
75
60
|
|
76
61
|
desc "Install Stock plugables and add sources list"
|
77
|
-
def
|
78
|
-
puts "Creating plugables directory".blue
|
79
|
-
puts "Downloading plugables sources list...".blue
|
62
|
+
def init
|
80
63
|
Dir.mkdir(Dir.home+"/.actionframework/")
|
81
|
-
|
82
|
-
Dir.mkdir(Dir.home+"/.actionframework/plugables/sources/")
|
83
|
-
Dir.mkdir(Dir.home+"/.actionframework/plugables/plugs/")
|
84
|
-
|
85
|
-
begin
|
86
|
-
plugables = HTTParty.get("https://raw.github.com/actionframework/plubables/master/sources.json").body
|
87
|
-
File.write(Dir.home+"/.actionframework/plugables/sources/list.json",plugables)
|
88
|
-
puts "Downloading stock plugables...".blue
|
89
|
-
plugables["stock"].each do |plugable|
|
90
|
-
puts "Downloading ".plugable["name"]+"..."
|
91
|
-
source = HTTParty.get("https://raw.github.com/actionframework/plugables/master/plugs/"+plugable["name"]+".rb").body
|
92
|
-
File.write(Dir.home+"/.actionframework/plugables/plugs/"+plugable["name"],source)
|
93
|
-
end
|
94
|
-
rescue Exception => e
|
95
|
-
puts "ERROR: Something went wrong".red
|
96
|
-
puts "ERROR: "+e.message.red
|
97
|
-
puts "LOG: "+e.backtrace.inspect
|
98
|
-
end
|
99
|
-
puts "Done".green
|
64
|
+
MiniGit.git(:clone ,"https://github.com/actionframework/plugables ~/.actionframework/plugables/")
|
100
65
|
end
|
66
|
+
|
67
|
+
desc "Update plugables"
|
68
|
+
def update
|
69
|
+
git = MiniGit.new(Dir.home+"/.actionframework/plugables")
|
70
|
+
git.pull
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Generate command - see action g help"
|
74
|
+
def g command
|
75
|
+
case command;
|
76
|
+
when "help"
|
77
|
+
puts "action g authentication # Generates neccesary files for authentication"
|
78
|
+
when "authentication"
|
79
|
+
puts "Generation of neccesary files".green
|
80
|
+
|
81
|
+
else
|
82
|
+
puts "Undefined command #{command}"
|
83
|
+
end
|
84
|
+
end
|
101
85
|
end
|
102
86
|
|
103
87
|
ActionFrameworkCLI.dispatch
|
data/lib/actionframework/base.rb
CHANGED
@@ -2,11 +2,16 @@
|
|
2
2
|
# Licenced under MIT ##
|
3
3
|
### © BramVDB.com #####
|
4
4
|
#######################
|
5
|
+
require 'warden'
|
6
|
+
|
5
7
|
module ActionFramework
|
6
8
|
# Base class (in config.ru -> run ActionFramework::Base.new)
|
7
9
|
class Base
|
8
10
|
def initialize
|
9
11
|
@app = Rack::Builder.new do
|
12
|
+
# Initialize ActionFramework itself
|
13
|
+
ActionFramework::Server.current
|
14
|
+
|
10
15
|
map '/static' do
|
11
16
|
run Rack::File.new("static")
|
12
17
|
end
|
@@ -15,6 +20,16 @@ module ActionFramework
|
|
15
20
|
run ActionFramework::Realtime.new
|
16
21
|
end
|
17
22
|
|
23
|
+
use Rack::Session::Cookie, :secret => ActionFramework::Server.current.get_settings.cookie_secret
|
24
|
+
|
25
|
+
use Warden::Manager do |manager|
|
26
|
+
config = File.read('./config/auth.rb')
|
27
|
+
manager.failure_app = ActionFramework::Server.current
|
28
|
+
|
29
|
+
eval config
|
30
|
+
end
|
31
|
+
|
32
|
+
# Run ActionFramework
|
18
33
|
run ActionFramework::Server.current
|
19
34
|
end
|
20
35
|
end
|
@@ -5,10 +5,15 @@
|
|
5
5
|
|
6
6
|
module ActionFramework
|
7
7
|
class Controller
|
8
|
-
def initialize req,res,url
|
8
|
+
def initialize env,req,res,url
|
9
9
|
@req = req
|
10
10
|
@res = res
|
11
11
|
@url = url
|
12
|
+
@env = env
|
13
|
+
end
|
14
|
+
|
15
|
+
def env
|
16
|
+
@env
|
12
17
|
end
|
13
18
|
|
14
19
|
def request
|
@@ -47,7 +52,6 @@ module ActionFramework
|
|
47
52
|
else
|
48
53
|
root = ActionFramework::Gem.root
|
49
54
|
libdir = root.resources.to_s
|
50
|
-
puts ActionFramework::Gem.root.inspect
|
51
55
|
renderer = Tilt::ERBTemplate.new(libdir+"/views/errors/layout.html.erb")
|
52
56
|
output = renderer.render(self){ Tilt::ERBTemplate.new(libdir+"/views/errors/#{code}.html.erb").render(self) }
|
53
57
|
end
|
@@ -56,5 +60,10 @@ module ActionFramework
|
|
56
60
|
def session
|
57
61
|
@req.session
|
58
62
|
end
|
63
|
+
|
64
|
+
def redirect path
|
65
|
+
response.redirect path
|
66
|
+
""
|
67
|
+
end
|
59
68
|
end
|
60
69
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#######################
|
2
|
+
# Licenced under MIT ##
|
3
|
+
### © BramVDB.com #####
|
4
|
+
#######################
|
5
|
+
|
6
|
+
module ActionFramework
|
7
|
+
class Model
|
8
|
+
include EventEmitter
|
9
|
+
|
10
|
+
def update_attributes data
|
11
|
+
super
|
12
|
+
self.emit :updated_attributes,data
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.create data
|
16
|
+
super
|
17
|
+
self.emit :created,data
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,23 +1,41 @@
|
|
1
1
|
module ActionFramework
|
2
2
|
class ModelHelper
|
3
|
-
def self.post model,res
|
4
|
-
|
5
|
-
|
3
|
+
def self.post model,req,res
|
4
|
+
if(model.create?)
|
5
|
+
response = model.create(JSON.parse(req.body.read)).to_json
|
6
|
+
res.body = [response]
|
7
|
+
else
|
8
|
+
error_403 res
|
9
|
+
end
|
6
10
|
res.finish
|
7
11
|
end
|
8
12
|
|
9
13
|
def self.get model,res
|
10
|
-
|
11
|
-
|
14
|
+
if(model.fetch?)
|
15
|
+
response = model.all.to_json
|
16
|
+
res.body = [response]
|
17
|
+
else
|
18
|
+
error_403 res
|
19
|
+
end
|
20
|
+
puts res.inspect
|
12
21
|
res.finish
|
13
22
|
end
|
14
23
|
|
15
24
|
def self.update model,res
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
25
|
+
if(model.update?)
|
26
|
+
doc = JSON.parse(req.body.string)
|
27
|
+
modelfind = model.where(doc[:where])
|
28
|
+
response = modelfind.update_attributes(doc[:attributes]).to_json
|
29
|
+
res.body = [response]
|
30
|
+
else
|
31
|
+
error_403 res
|
32
|
+
end
|
20
33
|
res.finish
|
21
34
|
end
|
35
|
+
|
36
|
+
def self.error_403 res
|
37
|
+
res.status = 404
|
38
|
+
res.write({:error => "403 Forbidden"}.to_json)
|
39
|
+
end
|
22
40
|
end
|
23
41
|
end
|
@@ -3,12 +3,40 @@
|
|
3
3
|
### © BramVDB.com #####
|
4
4
|
#######################
|
5
5
|
require 'rack/websocket'
|
6
|
+
require 'socket'
|
7
|
+
require 'json'
|
6
8
|
|
7
9
|
module ActionFramework
|
8
10
|
class Realtime < Rack::WebSocket::Application
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
@nosocket = true
|
15
|
+
|
16
|
+
begin
|
17
|
+
socket = UNIXSocket.new("./realtime.socket")
|
18
|
+
@nosocket = false
|
19
|
+
@message = ActionFramework::RealtimeMessage.new(socket)
|
20
|
+
rescue
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
9
25
|
def on_open env
|
26
|
+
return exit_me unless @nosocket
|
27
|
+
@message.post("client_connected",{:env => env,:msg => msg})
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_close env
|
10
31
|
|
11
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_message env,msg
|
35
|
+
@message.post("client_message",{:env => env,:msg => msg})
|
36
|
+
end
|
37
|
+
|
38
|
+
def exit_me
|
39
|
+
puts "INFO: No Unix Socket found, your application doesn't implement the realtime API"
|
12
40
|
end
|
13
41
|
end
|
14
42
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
module ActionFramework
|
5
|
+
class RealtimeSocket
|
6
|
+
def initialize
|
7
|
+
@sock = UNIXServer.new("realtime.sock")
|
8
|
+
end
|
9
|
+
|
10
|
+
def listen
|
11
|
+
$pid = Procces.fork do
|
12
|
+
while(client = @sock.accept)
|
13
|
+
while(line = client.gets)
|
14
|
+
yield
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -2,14 +2,18 @@
|
|
2
2
|
# Licenced under MIT ##
|
3
3
|
### © BramVDB.com #####
|
4
4
|
#######################
|
5
|
+
require 'ostruct'
|
5
6
|
|
6
7
|
module ActionFramework
|
7
8
|
class Routes
|
8
9
|
attr_accessor :routes
|
9
10
|
attr_accessor :models
|
11
|
+
attr_accessor :redirects
|
10
12
|
|
11
13
|
def initialize
|
12
14
|
@routes = {:get => {}, :post => {}, :update => {}, :delete => {}, :patch => {}}
|
15
|
+
@models = []
|
16
|
+
@redirects = []
|
13
17
|
end
|
14
18
|
|
15
19
|
def build_regex string
|
@@ -41,20 +45,41 @@ module ActionFramework
|
|
41
45
|
@routes[:patch][build_regex(hash.keys.first.to_s)] = hash[hash.keys.first.to_s]
|
42
46
|
end
|
43
47
|
|
44
|
-
def model
|
48
|
+
def model name
|
45
49
|
# @models[name of the class of the model] = name of class of the access policy of the model
|
46
|
-
@models
|
50
|
+
@models << name
|
47
51
|
end
|
48
52
|
|
49
53
|
def route(path,method)
|
50
54
|
@routes[method.downcase.to_sym].each do |regex,controller|
|
51
|
-
puts regex
|
52
|
-
|
55
|
+
puts regex.inspect
|
56
|
+
|
53
57
|
if(matched = path.match(regex))
|
54
58
|
return [controller,matched]
|
55
59
|
end
|
56
60
|
end
|
57
61
|
return nil
|
58
62
|
end
|
63
|
+
|
64
|
+
def redirect(hash)
|
65
|
+
hash[:from] = build_regex(hash[:from])
|
66
|
+
@redirects << hash
|
67
|
+
end
|
68
|
+
|
69
|
+
def redirect? (req)
|
70
|
+
@redirects.each do |redirect|
|
71
|
+
if(matched = req.path.match(redirect[:from]))
|
72
|
+
begin
|
73
|
+
matched.names.each do |key|
|
74
|
+
redirect[:to] = redirect[:to].gsub("{{#{key}}}",matched[key])
|
75
|
+
end
|
76
|
+
rescue Exception => e
|
77
|
+
end
|
78
|
+
return OpenStruct.new(redirect)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
|
59
84
|
end
|
60
85
|
end
|
data/lib/actionframework.rb
CHANGED
@@ -13,6 +13,8 @@ require 'actionframework/error_handler'
|
|
13
13
|
require 'actionframework/modelhelper'
|
14
14
|
require 'actionframework/realtime'
|
15
15
|
require 'actionframework/base'
|
16
|
+
require 'actionframework/authentication'
|
17
|
+
require 'event_emitter'
|
16
18
|
|
17
19
|
$runningserver = nil
|
18
20
|
|
@@ -41,11 +43,11 @@ module ActionFramework
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def autoimport
|
44
|
-
Dir.glob("controllers
|
46
|
+
Dir.glob("controllers/*.rb").each do |file|
|
45
47
|
require './'+file
|
46
48
|
end
|
47
49
|
|
48
|
-
Dir.glob("models
|
50
|
+
Dir.glob("models/*.rb").each do |file|
|
49
51
|
require './'+file
|
50
52
|
end
|
51
53
|
|
@@ -53,7 +55,7 @@ module ActionFramework
|
|
53
55
|
require './config/settings'
|
54
56
|
require './config/plugables'
|
55
57
|
|
56
|
-
Dir.glob("initializers
|
58
|
+
Dir.glob("initializers/*.rb").each do |file|
|
57
59
|
require './'+file
|
58
60
|
end
|
59
61
|
|
@@ -63,12 +65,23 @@ module ActionFramework
|
|
63
65
|
req = Rack::Request.new(env)
|
64
66
|
res = Rack::Response.new
|
65
67
|
|
68
|
+
# redirection
|
69
|
+
redirect = @routesklass.redirect? req
|
70
|
+
if(!redirect.nil?)
|
71
|
+
res.redirect(redirect.to)
|
72
|
+
return res.finish
|
73
|
+
end
|
74
|
+
|
75
|
+
|
66
76
|
# auto-api feature (only at path /api/*)
|
67
|
-
getModelResponse
|
77
|
+
reso = getModelResponse(req,res)
|
78
|
+
if(!reso.nil?)
|
79
|
+
return reso
|
80
|
+
end
|
68
81
|
|
69
82
|
controllerinfo = @routesklass.route(req.path,req.request_method)
|
70
83
|
if(controllerinfo == nil)
|
71
|
-
res.body = [ActionFramework::ErrorHandler.new(req,res,{}).send("error_404")]
|
84
|
+
res.body = [ActionFramework::ErrorHandler.new(env,req,res,{}).send("error_404")]
|
72
85
|
res.status = 404
|
73
86
|
return res.finish
|
74
87
|
end
|
@@ -77,8 +90,8 @@ module ActionFramework
|
|
77
90
|
matcheddata = controllerinfo[1]
|
78
91
|
|
79
92
|
control = controller.split("#")
|
80
|
-
result = Object.const_get(control[0]).new(req,res,matcheddata).send(control[1])
|
81
|
-
res.
|
93
|
+
result = Object.const_get(control[0]).new(env,req,res,matcheddata).send(control[1])
|
94
|
+
res.write result
|
82
95
|
res.finish
|
83
96
|
end
|
84
97
|
def routes &block
|
@@ -89,35 +102,36 @@ module ActionFramework
|
|
89
102
|
yield @settings
|
90
103
|
end
|
91
104
|
|
105
|
+
def get_settings
|
106
|
+
@settings
|
107
|
+
end
|
108
|
+
|
92
109
|
def start
|
93
110
|
Rack::Server.new({:app => self,:server => @settings.server, :Port => @settings.port}).start
|
94
111
|
end
|
95
112
|
|
96
113
|
def getModelResponse req,res
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
114
|
+
if(matcheddata = req.path.match(Regexp.new("/api/(?<modelname>(.*))")))
|
115
|
+
return nil unless @routesklass.models.include?(matcheddata[:modelname])
|
116
|
+
|
117
|
+
res["Content-type"] = "application/json"
|
118
|
+
model = Object.const_get(matcheddata[:modelname].capitalize)
|
119
|
+
model.instance_variable_set("@req",req)
|
120
|
+
|
104
121
|
case req.request_method
|
105
122
|
when "POST"
|
106
|
-
ActionFramework::ModelHelper.post model,res
|
123
|
+
return ActionFramework::ModelHelper.post model,req,res
|
107
124
|
when "GET"
|
108
|
-
ActionFramework::ModelHelper.get model,res
|
125
|
+
return ActionFramework::ModelHelper.get model,res
|
109
126
|
when "UPDATE"
|
110
|
-
ActionFramework::ModelHelper.update model,res
|
127
|
+
return ActionFramework::ModelHelper.update model,res
|
111
128
|
when "DELETE"
|
112
129
|
|
113
130
|
else
|
114
131
|
|
115
132
|
end
|
116
|
-
|
117
|
-
end
|
118
133
|
end
|
119
|
-
|
134
|
+
nil
|
120
135
|
end
|
121
|
-
|
122
136
|
end
|
123
137
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Paste your Omniauth providers here (more information: https://github.com/intridea/omniauth/wiki)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Authentication
|
2
|
+
===================
|
3
|
+
|
4
|
+
The files in this directory can be Warden strategies, Warden is the built-in authentication framework.
|
5
|
+
|
6
|
+
The strategies can be loaded with the following code from an initializer.
|
7
|
+
|
8
|
+
ActionFramework::Authentication::Strategy.load("yourstrategy")
|
9
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Add your Warden configuration here
|
2
|
+
# Example:
|
3
|
+
# manager.default_strategies :password
|
4
|
+
|
5
|
+
# To load your strategies from #{PROJECT_ROOT}/authentication/yourstrategy.rb use:
|
6
|
+
# ActionFramework::Authentication::Strategy.load("yourstrategy")
|
7
|
+
|
8
|
+
# You also need to setup your session serialisation:
|
9
|
+
# Warden::Manager.serialize_into_session do |user|
|
10
|
+
# user.id
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# Warden::Manager.serialize_from_session do |id|
|
14
|
+
# User.get(id)
|
15
|
+
# end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Feature under development
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<img src="http://actionframework.io/rocket.png" style="height: 200px;"/>
|
2
|
+
<h1>WELCOME TO ACTIONFRAMEWORK</h1>
|
3
|
+
<p>This is the default welcome page, add a new route by:</p>
|
4
|
+
<pre>
|
5
|
+
<code>
|
6
|
+
# In config/routes.rb
|
7
|
+
ActionFramework::Server.current.routes do
|
8
|
+
get "/" => "DefaultController#index" # This route
|
9
|
+
get "/mynewroute" = "MyNewController#index" # Your new route!
|
10
|
+
end
|
11
|
+
</code>
|
12
|
+
</pre>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.5/styles/default.min.css">
|
4
|
+
<script src="http://yandex.st/highlightjs/7.5/highlight.min.js"></script>
|
5
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
6
|
+
<title>Welcome to ActionFramework</title>
|
7
|
+
<link href="http://fonts.googleapis.com/css?family=Oswald:400,700" rel="stylesheet" type="text/css">
|
8
|
+
<style>
|
9
|
+
body{
|
10
|
+
background-color: black;
|
11
|
+
color: white;
|
12
|
+
font-family: 'Oswald', sans-serif;
|
13
|
+
}
|
14
|
+
p{
|
15
|
+
font-size: 20px;
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<center>
|
21
|
+
<%= yield %>
|
22
|
+
</center>
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<img src="http://actionframework.io/rocket.png" style="height: 200px;"/>
|
2
2
|
<h1>WELCOME TO ACTIONFRAMEWORK</h1>
|
3
3
|
<p>This is the default welcome page, add a new route by:</p>
|
4
|
-
<pre>
|
4
|
+
<pre style="text-align: left;margin: auto;width: 60%;">
|
5
5
|
<code>
|
6
6
|
# In config/routes.rb
|
7
7
|
ActionFramework::Server.current.routes do
|
metadata
CHANGED
@@ -1,111 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionframework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bram Vandenbogaerde
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '>='
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
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
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: optitron
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: websocket-rack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - '>='
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - '>='
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: httparty
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - '>='
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - '>='
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: jewel
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - '>='
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - '>='
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minigit
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: omniauth
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: event_emitter
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: warden
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
109
165
|
- !ruby/object:Gem::Version
|
110
166
|
version: '0'
|
111
167
|
description: A web framework built on top of Rack, it has the simplicity of sinatra
|
@@ -116,25 +172,43 @@ executables:
|
|
116
172
|
extensions: []
|
117
173
|
extra_rdoc_files: []
|
118
174
|
files:
|
175
|
+
- bin/action
|
176
|
+
- lib/actionframework.rb
|
177
|
+
- lib/actionframework/authentication.rb
|
119
178
|
- lib/actionframework/base.rb
|
120
179
|
- lib/actionframework/controller.rb
|
121
180
|
- lib/actionframework/error_handler.rb
|
122
181
|
- lib/actionframework/gem.rb
|
123
182
|
- lib/actionframework/gemextra.rb
|
183
|
+
- lib/actionframework/model.rb
|
124
184
|
- lib/actionframework/modelhelper.rb
|
125
185
|
- lib/actionframework/plugables.rb
|
126
186
|
- lib/actionframework/plugmod.rb
|
127
187
|
- lib/actionframework/rackup.rb
|
128
188
|
- lib/actionframework/realtime.rb
|
189
|
+
- lib/actionframework/realtime_message.rb
|
190
|
+
- lib/actionframework/realtime_socket.rb
|
129
191
|
- lib/actionframework/routes.rb
|
130
192
|
- lib/actionframework/settings.rb
|
131
193
|
- lib/actionframework/string.rb
|
132
|
-
-
|
194
|
+
- resources/config/auth.rb
|
195
|
+
- resources/project_template/Gemfile
|
196
|
+
- resources/project_template/authentication/README.md
|
197
|
+
- resources/project_template/config.ru
|
198
|
+
- resources/project_template/config/auth.rb
|
199
|
+
- resources/project_template/config/plugables.rb
|
200
|
+
- resources/project_template/config/routes.rb
|
201
|
+
- resources/project_template/config/settings.rb
|
202
|
+
- resources/project_template/controllers/default_controller.rb
|
203
|
+
- resources/project_template/initializers/README.md
|
204
|
+
- resources/project_template/models/README.md
|
205
|
+
- resources/project_template/static/README.md
|
206
|
+
- resources/project_template/views/index.html.erb
|
207
|
+
- resources/project_template/views/layout.html.erb
|
133
208
|
- resources/templates/index.html.erb
|
134
209
|
- resources/templates/layout.html.erb
|
135
210
|
- resources/views/errors/404.html.erb
|
136
211
|
- resources/views/errors/layout.html.erb
|
137
|
-
- bin/action
|
138
212
|
homepage: http://actionframework.io
|
139
213
|
licenses:
|
140
214
|
- MIT
|
@@ -145,17 +219,17 @@ require_paths:
|
|
145
219
|
- lib
|
146
220
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
221
|
requirements:
|
148
|
-
- - '>='
|
222
|
+
- - ! '>='
|
149
223
|
- !ruby/object:Gem::Version
|
150
224
|
version: '0'
|
151
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
226
|
requirements:
|
153
|
-
- - '>='
|
227
|
+
- - ! '>='
|
154
228
|
- !ruby/object:Gem::Version
|
155
229
|
version: '0'
|
156
230
|
requirements: []
|
157
231
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.2.1
|
159
233
|
signing_key:
|
160
234
|
specification_version: 4
|
161
235
|
summary: A web framework built on top of Rack
|