ryakuzu 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/ryakuzu/application.js +15 -0
- data/app/assets/javascripts/ryakuzu/update_schema.coffee +14 -0
- data/app/assets/stylesheets/ryakuzu/application.sass +61 -0
- data/app/controllers/ryakuzu/main_controller.rb +9 -0
- data/app/controllers/ryakuzu/root_controller.rb +16 -0
- data/app/controllers/ryakuzu/tables_controller.rb +71 -0
- data/app/models/ryakuzu/column.rb +41 -0
- data/app/models/ryakuzu/column_defaults.rb +17 -0
- data/app/models/ryakuzu/schema.rb +11 -0
- data/app/models/ryakuzu/table.rb +29 -0
- data/app/services/ryakuzu/add_column_service.rb +22 -0
- data/app/services/ryakuzu/column_default_service.rb +64 -0
- data/app/services/ryakuzu/column_service.rb +22 -0
- data/app/services/ryakuzu/create_table_service.rb +34 -0
- data/app/services/ryakuzu/migration_service.rb +29 -0
- data/app/services/ryakuzu/remove_service.rb +26 -0
- data/app/services/ryakuzu/run_migration.rb +43 -0
- data/app/services/ryakuzu/table_service.rb +19 -0
- data/app/views/ryakuzu/layouts/_cdn.erb +3 -0
- data/app/views/ryakuzu/layouts/_header.html.slim +13 -0
- data/app/views/ryakuzu/layouts/_preload.html.slim +30 -0
- data/app/views/ryakuzu/layouts/application.html.slim +31 -0
- data/app/views/ryakuzu/main/_add_column_form.html.slim +5 -0
- data/app/views/ryakuzu/main/_add_table_form.html.slim +5 -0
- data/app/views/ryakuzu/main/_column_form.html.slim +5 -0
- data/app/views/ryakuzu/main/error_500.html.slim +1 -0
- data/app/views/ryakuzu/main/index.html.slim +35 -0
- data/app/views/ryakuzu/tables/_add_column.html.slim +9 -0
- data/app/views/ryakuzu/tables/_add_table.html.slim +9 -0
- data/app/views/ryakuzu/tables/_column.html.slim +16 -0
- data/app/views/ryakuzu/tables/_input.html.slim +6 -0
- data/app/views/ryakuzu/tables/add_column.js.erb +2 -0
- data/app/views/ryakuzu/tables/add_column_form.js.erb +2 -0
- data/app/views/ryakuzu/tables/add_table.js.erb +3 -0
- data/app/views/ryakuzu/tables/column.js.erb +2 -0
- data/app/views/ryakuzu/tables/column_options.js.erb +2 -0
- data/app/views/ryakuzu/tables/create.js.erb +1 -0
- data/app/views/ryakuzu/tables/create_table.js.erb +2 -0
- data/app/views/ryakuzu/tables/new_column.js.erb +1 -0
- data/app/views/ryakuzu/tables/remove_column.js.erb +2 -0
- data/config/routes.rb +16 -0
- data/lib/ryakuzu/boolean_patch.rb +35 -0
- data/lib/ryakuzu/column_info.rb +54 -0
- data/lib/ryakuzu/engine.rb +8 -0
- data/lib/ryakuzu/ripper.rb +30 -0
- data/lib/ryakuzu/schema_extenstions.rb +19 -0
- data/lib/ryakuzu/schema_service.rb +67 -0
- data/lib/ryakuzu/version.rb +3 -0
- data/lib/ryakuzu.rb +4 -0
- data/lib/tasks/ryakuzu_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/schema.rb +135 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +8602 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/lib/column_info_test.rb +23 -0
- data/test/lib/schema_service_test.rb +27 -0
- data/test/ryakuzu_test.rb +7 -0
- data/test/services/add_column_service_test.rb +10 -0
- data/test/services/column_default_service_test.rb +10 -0
- data/test/services/column_service_test.rb +10 -0
- data/test/services/run_migration_test.rb +15 -0
- data/test/services/table_service_test.rb +13 -0
- data/test/test_helper.rb +21 -0
- metadata +287 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
doctype html
|
2
|
+
html lang="en"
|
3
|
+
head
|
4
|
+
meta charset="utf-8"
|
5
|
+
meta content="IE=edge" http-equiv="X-UA-Compatible"
|
6
|
+
meta content="width=device-width, initial-scale=1" name="viewport"
|
7
|
+
title Ryakuzu
|
8
|
+
= favicon_link_tag "favicon.png"
|
9
|
+
= csrf_meta_tags
|
10
|
+
= javascript_include_tag "ryakuzu/application"
|
11
|
+
= render 'ryakuzu/layouts/cdn'
|
12
|
+
= stylesheet_link_tag "ryakuzu/application", media: 'all'
|
13
|
+
/! HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
|
14
|
+
/![if lt IE 9]
|
15
|
+
script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"
|
16
|
+
script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"
|
17
|
+
|
18
|
+
|
19
|
+
body
|
20
|
+
= render 'ryakuzu/layouts/header'
|
21
|
+
.container
|
22
|
+
.row
|
23
|
+
.col-md-3
|
24
|
+
|
25
|
+
hr
|
26
|
+
.container
|
27
|
+
- if flash.any?
|
28
|
+
- flash.each do |name, msg|
|
29
|
+
= content_tag :div, msg, class: name
|
30
|
+
= yield
|
31
|
+
= render 'ryakuzu/layouts/preload'
|
@@ -0,0 +1 @@
|
|
1
|
+
h1 schema.rb not found in ./db/schema.rb/
|
@@ -0,0 +1,35 @@
|
|
1
|
+
- @schema.each_slice(4) do |slice|
|
2
|
+
.row
|
3
|
+
- slice.each do |schema|
|
4
|
+
.col-md-3
|
5
|
+
.panel.panel-default
|
6
|
+
.panel-heading
|
7
|
+
- @model = Ryakuzu::Table.create_model(schema)
|
8
|
+
h4= "Table: #{@model.name.underscore}"
|
9
|
+
br
|
10
|
+
= form_for @model, html: { class: 'form-horizontal' }, remote: true do |f|
|
11
|
+
= f.text_field :name, class: 'form-control', pattern: '^[A-Za-z_]{1,150}$', title: 'Remove numbers, or non english words'
|
12
|
+
= f.hidden_field "old_name", value: @model.name
|
13
|
+
h4 Columns
|
14
|
+
= f.fields_for :column, @model.column do |cl|
|
15
|
+
- attr = @model.column.attributes
|
16
|
+
- attr.each_with_index do |v, i|
|
17
|
+
.input-group
|
18
|
+
= cl.text_field "column_#{i}", class: 'form-control', pattern: '^[A-Za-z_]{1,150}$', title: 'Remove numbers, or non english words'
|
19
|
+
= cl.hidden_field "old_#{i}", value: "#{v[1]}"
|
20
|
+
span.input-group-btn
|
21
|
+
= link_to 'options', column_path(column: "#{v[1]}", table: @model.name.underscore), method: :post, remote: true, class: 'btn-floating waves-effect waves-light green option-button'
|
22
|
+
hr
|
23
|
+
.row
|
24
|
+
.col-md-12
|
25
|
+
= f.submit 'Run Migration', class: 'btn btn-success'
|
26
|
+
.row
|
27
|
+
.col-md-12
|
28
|
+
= link_to 'Add Column', add_column_form_path(table: @model.name), method: :post, remote: true, class: 'btn btn-warning waves-effect waves-light'
|
29
|
+
.row
|
30
|
+
.col-md-12
|
31
|
+
= link_to 'Remove Table', remove_table_path(table: @model.name), method: :post, class: 'btn btn-danger waves-effect waves-light', data: { confirm: "Remove table #{@model.name}?" }
|
32
|
+
|
33
|
+
= render 'ryakuzu/main/column_form'
|
34
|
+
= render 'ryakuzu/main/add_column_form'
|
35
|
+
= render 'ryakuzu/main/add_table_form'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
h1= "Table: #{@table.tableize}"
|
2
|
+
= form_tag :add_column, class: 'form-horizontal', remote: true do
|
3
|
+
= label_tag 'Create Column'
|
4
|
+
= text_field :name, :column, class: 'form-control', placeholder: 'Column name...', pattern: '^[A-Za-z_]{1,150}$', title: 'Remove numbers, or non english words'
|
5
|
+
.col-md-8.input-field
|
6
|
+
= select_tag :type, options_for_select(['String', 'Boolean', 'Integer',
|
7
|
+
'Text', 'Float', 'Decimal', 'Binary', 'Date', 'Time', 'DateTime'].map { |i| i }), { class: 'browser-default' }
|
8
|
+
= hidden_field_tag :table, @table
|
9
|
+
= submit_tag 'Create Column', class: 'btn btn-sm btn-success waves-effect waves-light'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
h1 Create Table
|
2
|
+
hr
|
3
|
+
= form_tag :create_table, class: 'form-horizontal', remote: true do
|
4
|
+
p Table name
|
5
|
+
= text_field :table, :name, class: 'form-control', placeholder: 'Table name...', pattern: '^[A-Za-z_]{1,150}$', title: 'Remove numbers, or non english words'
|
6
|
+
= render 'ryakuzu/tables/input'
|
7
|
+
#inputs
|
8
|
+
= submit_tag 'Create Table', class: 'btn btn-primary'
|
9
|
+
= link_to 'Add Column', new_column_path, method: :post, remote: true, class: 'btn btn-info waves-effect waves-light'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
h3.text-primary= "Table: #{@table}"
|
2
|
+
h4.text-warning= "Column: #{@column}"
|
3
|
+
h5.text-info= "Default: #{@opts.default}" if @opts.default
|
4
|
+
h6.text-danger= "Null: #{@opts.null}" if @opts.null
|
5
|
+
= form_for @opts, url: :column_options, html: { class: 'form-horizontal' }, remote: true do |f|
|
6
|
+
= f.hidden_field :table, value: @table
|
7
|
+
= f.hidden_field :column, value: @column
|
8
|
+
= f.label :type
|
9
|
+
.form-group
|
10
|
+
.col-md-9
|
11
|
+
= f.select :type, ["Current: #{@opts.type}",'String', 'Boolean', 'Integer',
|
12
|
+
'Text', 'Float', 'Decimal', 'Binary', 'Date', 'Time', 'DateTime'].map { |i| i }, {}, { class: 'browser-default' }
|
13
|
+
= f.hidden_field 'parameters[:old_type]', value: @opts.type
|
14
|
+
.col-md-3
|
15
|
+
= f.submit 'Run', class: 'btn btn-info waves-effect waves-light ajax'
|
16
|
+
= link_to 'Remove Column', remove_column_path(table: @table ,column: @column), method: :post, class: 'btn btn-sm btn-danger waves-effect waves-light', data: { confirm: "Remove column #{@column}?" }, remote: true
|
@@ -0,0 +1,6 @@
|
|
1
|
+
p Column
|
2
|
+
= text_field_tag 'column[]', '', class: 'form-control', placeholder: 'Column name...', pattern: '^[A-Za-z_]{1,150}$', title: 'Remove numbers, or non english words'
|
3
|
+
p Type
|
4
|
+
= select_tag 'type[]', options_for_select(['String', 'Boolean', 'Integer',
|
5
|
+
'Text', 'Float', 'Decimal', 'Binary', 'Date', 'Time', 'DateTime'].map { |i| i }), { class: 'browser-default' }
|
6
|
+
hr
|
@@ -0,0 +1 @@
|
|
1
|
+
location.reload();
|
@@ -0,0 +1 @@
|
|
1
|
+
$('#inputs').append("<%= j(render("input"))%>");
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Ryakuzu::Engine.routes.draw do
|
2
|
+
resources :tables, only: [:create]
|
3
|
+
|
4
|
+
post 'column', to: 'tables#column', as: :column
|
5
|
+
post 'column_options', to: 'tables#column_options', as: :column_options
|
6
|
+
post 'remove_column', to: 'tables#remove_column', as: :remove_column
|
7
|
+
post 'remove_table', to: 'tables#remove_table', as: :remove_table
|
8
|
+
post 'add_column_form', to: 'tables#add_column_form', as: :add_column_form
|
9
|
+
post 'add_column', to: 'tables#add_column', as: :add_column
|
10
|
+
post 'add_table', to: 'tables#add_table', as: :add_table
|
11
|
+
post 'create_table', to: 'tables#create_table', as: :create_table
|
12
|
+
post 'new_column', to: 'tables#new_column', as: :new_column
|
13
|
+
post 'save_csv', to: 'tables#save_csv', as: :save_csv
|
14
|
+
|
15
|
+
root 'main#index'
|
16
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Ryakuzu
|
2
|
+
class String
|
3
|
+
def to_bool
|
4
|
+
return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)
|
5
|
+
return false if self == false || self.blank? || self =~ (/^(false|f|no|n|0)$/i)
|
6
|
+
fail ArgumentError.new("invalid value for Boolean: \"#{self}\"")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Fixnum
|
11
|
+
def to_bool
|
12
|
+
return true if self == 1
|
13
|
+
return false if self == 0
|
14
|
+
fail ArgumentError.new("invalid value for Boolean: \"#{self}\"")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class TrueClass
|
19
|
+
def to_bool
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class FalseClass
|
25
|
+
def to_bool
|
26
|
+
self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class NilClass
|
31
|
+
def to_bool
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Ryakuzu
|
2
|
+
class ColumnInfo
|
3
|
+
include Ryakuzu::SchemaExtenstions
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@file = File.open(Rails.root.join('db', 'schema.rb'))
|
7
|
+
@schema = Ryakuzu::Ripper.parse(file)
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(table, column)
|
11
|
+
file.each do |line|
|
12
|
+
parts = line.split ' '
|
13
|
+
next if parts.nil? || parts.length < 1 || parts[0] == '#'
|
14
|
+
@table_name = table_name(parts[1]) if parts[0] == 'create_table'
|
15
|
+
|
16
|
+
next unless @table_name == table
|
17
|
+
@field_name = field_name(parts[1]) if parts[0][0] == 't'
|
18
|
+
next unless @field_name == column
|
19
|
+
parts[0][0] = ''
|
20
|
+
schema.each do |schema_line|
|
21
|
+
schema_line[1].each do |part|
|
22
|
+
next unless part == field_name(parts[1])
|
23
|
+
next unless parts[1]
|
24
|
+
hash = remove_extra_chars(parts[0..1])
|
25
|
+
column = column_and_type(hash, @table_name)
|
26
|
+
size = parts[2..parts.count]
|
27
|
+
parameters = remove_extra_chars(size)
|
28
|
+
temporary = make_hash(parameters) if parameters
|
29
|
+
@columns = column.merge!(temporary)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
Ryakuzu::Column.new(@columns.symbolize_keys).column_info
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def remove_extra_chars(lines)
|
39
|
+
lines.map { |e| e.gsub(/\W/, '') }
|
40
|
+
end
|
41
|
+
|
42
|
+
def column_and_type(lines, table_name)
|
43
|
+
{ table: table_name, type: lines[0], column: lines[1] }
|
44
|
+
end
|
45
|
+
|
46
|
+
def make_hash(parameters)
|
47
|
+
temporary = {}
|
48
|
+
parameters.each_slice(2) do |slice|
|
49
|
+
temporary.merge!(Hash[*slice])
|
50
|
+
end
|
51
|
+
temporary
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'ripper'
|
2
|
+
module Ryakuzu
|
3
|
+
class Ripper
|
4
|
+
attr_reader :schema
|
5
|
+
|
6
|
+
def parse(filename)
|
7
|
+
sexp = ::Ripper.sexp IO.read(filename)
|
8
|
+
|
9
|
+
schema_commands = sexp[1][0][2][2]
|
10
|
+
@schema = schema_commands.inject({}) do |s, command|
|
11
|
+
next if command.length < 1
|
12
|
+
command_name = command[1][1][1]
|
13
|
+
|
14
|
+
if command_name == 'create_table'
|
15
|
+
table_name = command[1][2][1][0][1][1][1].to_sym
|
16
|
+
columns = command[2][2].map { |i| i[4][1][0][1][1][1] }
|
17
|
+
|
18
|
+
s.merge!(table_name => columns)
|
19
|
+
end
|
20
|
+
s
|
21
|
+
end
|
22
|
+
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.parse(filename)
|
27
|
+
new.parse(filename).schema
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Ryakuzu
|
2
|
+
module SchemaExtenstions
|
3
|
+
require 'virtus'
|
4
|
+
require 'csv'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
attr_reader :file, :schema, :sch_hash
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def table_name(table)
|
12
|
+
table.delete("\"").delete(',')
|
13
|
+
end
|
14
|
+
|
15
|
+
def field_name(field)
|
16
|
+
field.delete("\",").chomp('t.')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Ryakuzu
|
2
|
+
class SchemaService
|
3
|
+
include Ryakuzu::SchemaExtenstions
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@file = File.readlines(Rails.root.join('db', 'schema.rb'))
|
7
|
+
@schema = ''
|
8
|
+
@sch_hash = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
parse_schema
|
13
|
+
create_hash_from_schema
|
14
|
+
end
|
15
|
+
|
16
|
+
def hash
|
17
|
+
call
|
18
|
+
models = []
|
19
|
+
sch_hash.map { |key, value| models << Ryakuzu::Table.generate_models(key, value) }
|
20
|
+
models
|
21
|
+
end
|
22
|
+
|
23
|
+
def schema_to_csv
|
24
|
+
CSV.open('schema.csv', 'wb') { |csv| sch_hash.to_a.map { |elem| csv << elem } }
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def parse_schema
|
30
|
+
file.each do |line|
|
31
|
+
parts = line.split ' '
|
32
|
+
next if parts.nil? || parts.length < 1 || parts[0] == '#'
|
33
|
+
if parts[0] == 'create_table'
|
34
|
+
table_name = table_name(parts[1])
|
35
|
+
schema << "__#{table_name},"
|
36
|
+
end
|
37
|
+
|
38
|
+
if parts[0][0] == 't'
|
39
|
+
field_name = field_name(parts[1])
|
40
|
+
schema << "#{field_name}__"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_hash_from_schema
|
46
|
+
return if sch_hash.present?
|
47
|
+
array = convert_source
|
48
|
+
hash_array = convert_to_hash(array)
|
49
|
+
|
50
|
+
hash_array.each_with_index do |i, _v|
|
51
|
+
sch_hash.merge!(i[0] => i.reject { |k| k == i[0] })
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def convert_source
|
56
|
+
@schema = schema.split('__').join(',')
|
57
|
+
schema[0] = ''
|
58
|
+
schema.split(',,')
|
59
|
+
end
|
60
|
+
|
61
|
+
def convert_to_hash(array)
|
62
|
+
arr_m = []
|
63
|
+
array.map { |k, _v| arr_m << k.split(',') }
|
64
|
+
arr_m
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/ryakuzu.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "ryakuzu"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|