This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +56
-36
lines changed
Expand file tree Collapse file tree 4 files changed +56
-36
lines changed Original file line number Diff line number Diff line change 11development :
22 adapter : sqlite
3- database : db/development.db
3+ database :
44 max_connections : 5
55 pool_timeout : 5000
66
77production :
88 adapter : sqlite
9- database : db/production.db
9+ database :
1010 max_connections : 5
1111 pool_timeout : 5000
1212
1313test : &test
1414 adapter : sqlite
15- database : db/test.db
15+ database :
1616 max_connections : 5
1717 pool_timeout : 5000
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- require 'sequel'
4- require 'yaml'
5-
63ENV [ 'WPXF_ENV' ] = 'development' unless ENV [ 'WPXF_ENV' ]
74
85db_config_path = File . join ( __dir__ , 'config.yml' )
96db_config = YAML . load_file ( db_config_path ) [ ENV [ 'WPXF_ENV' ] ]
107
8+ if db_config [ 'database' ] . nil?
9+ db_config [ 'database' ] = File . join ( Wpxf . databases_path , "#{ ENV [ 'WPXF_ENV' ] } .db" )
10+ end
11+
1112Sequel ::Model . plugin :timestamps
1213Sequel ::Model . db = Sequel . connect ( db_config )
14+
15+ Sequel . extension :migration
16+ Sequel ::Migrator . run ( Sequel ::Model . db , File . join ( __dir__ , 'migrations' ) )
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require 'date'
4+ require 'fileutils'
5+ require 'json'
6+ require 'time'
7+ require 'yaml'
8+ require 'zip'
9+
10+ Gem . loaded_specs [ 'wpxf' ] . dependencies . each do |d |
11+ require d . name unless d . type == :development || d . name == 'rubyzip'
12+ end
13+
14+ # The root namespace.
15+ module Wpxf
16+ def self . data_directory
17+ File . join ( app_path , 'data' )
18+ end
19+
20+ def self . app_path
21+ File . expand_path ( File . dirname ( __dir__ ) )
22+ end
23+
24+ def self . version
25+ Gem . loaded_specs [ 'wpxf' ] . version
26+ end
27+
28+ def self . home_directory
29+ File . join ( Dir . home , '.wpxf' )
30+ end
31+
32+ def self . databases_path
33+ path = File . join ( home_directory , 'db' )
34+ FileUtils . mkdir_p ( path ) unless File . directory? ( path )
35+ path
36+ end
37+
38+ def self . change_stdout_sync ( enabled )
39+ original_setting = STDOUT . sync
40+ STDOUT . sync = true
41+ yield ( enabled )
42+ STDOUT . sync = original_setting
43+ end
44+ end
45+
46+ require_relative '../db/env'
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- # The root namespace.
4- module Wpxf
5- def self . data_directory = ( val )
6- @@data_directory = val
7- end
8-
9- def self . data_directory
10- @@data_directory
11- end
12-
13- def self . app_path = ( val )
14- @@app_path = val
15- end
16-
17- def self . app_path
18- @@app_path
19- end
20-
21- def self . version
22- File . read ( File . join ( Wpxf . app_path , 'VERSION' ) ) . strip
23- end
24-
25- def self . change_stdout_sync ( enabled )
26- original_setting = STDOUT . sync
27- STDOUT . sync = true
28- yield ( enabled )
29- STDOUT . sync = original_setting
30- end
31- end
32-
333require 'wpxf/db'
344require 'wpxf/utility'
355
You can’t perform that action at this time.
0 commit comments