whales 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +25 -0
- data/exe/whales +128 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 013f9b02636483a315144824975f5166e3a136b3
|
4
|
+
data.tar.gz: e17cbf599b4ff796f93651ea64c566be3bc8e758
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fcb33f037fbc0a09e6097e920b28d0bd9697e3c5558e7dd612b4dc189c83c4e3bee43099e0289497d35009fb2517e1e2a8845fbb794c0f46c028c632765636bc
|
7
|
+
data.tar.gz: a2f893f4530b37ee0836d6e09ad6ad16e3bb2149f3e14215f913cd53e8cf7509f7ac5e8e4b0d733d69e3d7ce3036f805b86482e87be7720e82e0f925657872fa
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#Whales
|
2
|
+
|
3
|
+
There's [Rails](https://github.com/rails/rails), there's [Sails](https://github.com/balderdashy/sails), so why not Whales? Whales
|
4
|
+
is a lightweight web framework written in Ruby, inspired by popular MVC frameworks like Rails, Django, and Express.
|
5
|
+
|
6
|
+
|
7
|
+
##Installation
|
8
|
+
|
9
|
+
The easiest way to install Whales is to clone this repo.
|
10
|
+
|
11
|
+
##Your First Whales Project
|
12
|
+
**Create a new app:**
|
13
|
+
```
|
14
|
+
cd whales
|
15
|
+
./whales new MyApp
|
16
|
+
```
|
17
|
+
|
18
|
+
**Start working:**
|
19
|
+
```
|
20
|
+
# cd into the new folder
|
21
|
+
cd ../MyApp
|
22
|
+
|
23
|
+
# start the server
|
24
|
+
whales server
|
25
|
+
```
|
data/exe/whales
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
if ARGV.first == 'new' && ARGV[1]
|
7
|
+
puts "Making new Whales App:"
|
8
|
+
app_name = ARGV[1]
|
9
|
+
display = {verbose: true}
|
10
|
+
|
11
|
+
mkdir app_name, display
|
12
|
+
cd app_name
|
13
|
+
touch "routes.rb", display
|
14
|
+
File.open("routes.rb", 'w') do |f|
|
15
|
+
f.write <<-TEXT
|
16
|
+
require_relative '../whales/whales_actions/lib/whales_controller/base'
|
17
|
+
|
18
|
+
def make_router
|
19
|
+
router = WhalesDispatch::Router.new
|
20
|
+
|
21
|
+
router.draw do
|
22
|
+
# include routes using this syntax:
|
23
|
+
# get Regexp.new("^/users/new$"), UsersController, :new
|
24
|
+
# or
|
25
|
+
# resources :users, :parent, only: [:new]
|
26
|
+
#
|
27
|
+
# nested resources are given as blocks to :parent resources
|
28
|
+
# resources :posts, :parent do
|
29
|
+
# resources :comments, :nested, only: [:index, :new, :create]
|
30
|
+
# end
|
31
|
+
end
|
32
|
+
|
33
|
+
router
|
34
|
+
end
|
35
|
+
TEXT
|
36
|
+
end
|
37
|
+
|
38
|
+
touch "Gemfile", display
|
39
|
+
File.open("Gemfile", "w") do |f|
|
40
|
+
f.write <<-TEXT
|
41
|
+
source 'https://rubygems.org'\n
|
42
|
+
|
43
|
+
require 'whales'
|
44
|
+
TEXT
|
45
|
+
end
|
46
|
+
|
47
|
+
mkdir "config", display
|
48
|
+
touch "config/database.rb", display
|
49
|
+
File.open("config/database.rb", "w") do |f|
|
50
|
+
f.write <<-TEXT
|
51
|
+
require 'whales_orm'
|
52
|
+
|
53
|
+
# https://tomafro.net/2010/01/tip-relative-paths-with-file-expand-path
|
54
|
+
ROOT_FOLDER = File.join(File.dirname(__FILE__), '../db')
|
55
|
+
|
56
|
+
# sql file name goes here, the default is database.sql
|
57
|
+
SQL_FILE = File.join(ROOT_FOLDER, 'database.sql')
|
58
|
+
|
59
|
+
# Here you can configure where you want the database file to be saved
|
60
|
+
DB_FILE = File.join(ROOT_FOLDER, 'database.db')
|
61
|
+
TEXT
|
62
|
+
end
|
63
|
+
|
64
|
+
mkdir "db", display
|
65
|
+
touch "db/database.sql", display
|
66
|
+
|
67
|
+
mkdir_p 'app/controllers', display
|
68
|
+
|
69
|
+
touch "app/controllers/application_controller.rb", display
|
70
|
+
File.open("app/controllers/application_controller.rb", "w") do |f|
|
71
|
+
f.write <<-TEXT
|
72
|
+
require 'whales_actions'
|
73
|
+
require_relative '../../config/database.rb'
|
74
|
+
|
75
|
+
class ApplicationController < WhalesController::Base
|
76
|
+
end
|
77
|
+
TEXT
|
78
|
+
end
|
79
|
+
|
80
|
+
cd 'app'
|
81
|
+
mkdir 'models', display
|
82
|
+
mkdir 'views'
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
# if ARGV.first == 'server' || ARGV.first == 's'
|
87
|
+
# start_server(router)
|
88
|
+
# end
|
89
|
+
|
90
|
+
if ARGV.first == 'generate' || ARGV.first == 'g' && ARGV.length == 3
|
91
|
+
type = ARGV[1]
|
92
|
+
name = ARGV[2]
|
93
|
+
|
94
|
+
path = "app/#{type}s/#{name.downcase}.rb"
|
95
|
+
touch path
|
96
|
+
|
97
|
+
if type == "model"
|
98
|
+
path = "app/#{type}s/#{name.downcase}.rb"
|
99
|
+
touch path
|
100
|
+
File.open(path, 'w') do |f|
|
101
|
+
f.write <<-TEXT
|
102
|
+
require 'whales_orm'
|
103
|
+
require_relative '../../config/database.rb'
|
104
|
+
|
105
|
+
class #{name.capitalize} < WhalesORM::Base
|
106
|
+
self.finalize!
|
107
|
+
end\n
|
108
|
+
TEXT
|
109
|
+
end
|
110
|
+
elsif type == "controller"
|
111
|
+
path = "app/#{type}s/#{name.downcase}_controller.rb"
|
112
|
+
touch path
|
113
|
+
File.open(path, 'w') do |f|
|
114
|
+
f.write <<-TEXT
|
115
|
+
require_relative 'application_controller'
|
116
|
+
|
117
|
+
class #{name.capitalize}Controller < ApplicationController
|
118
|
+
end\n
|
119
|
+
TEXT
|
120
|
+
end
|
121
|
+
|
122
|
+
mkdir "app/views/#{name.downcase}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
#
|
126
|
+
# if ARGV.first == "db:reset"
|
127
|
+
# DBConnection.reset
|
128
|
+
# end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whales
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- William Horton
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: whales_actions
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: whales_orm
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.0
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- wdt.horton@gmail.com
|
58
|
+
executables:
|
59
|
+
- whales
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- README.md
|
64
|
+
- exe/whales
|
65
|
+
homepage: https://github.com/wdhorton/whales
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.5.0
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: A full-stack MVC framework in Ruby
|
89
|
+
test_files: []
|
90
|
+
has_rdoc:
|