forked from anykeyh/clear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yacine Petitprez
committed
Mar 21, 2018
1 parent
79ebc5d
commit d9161d4
Showing
7 changed files
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# The `db` command | ||
# | ||
# # Commands | ||
# | ||
module Clear::CLI::DB | ||
def self.display_help_and_exit(opts) | ||
puts <<-HELP | ||
clear-cli [cli-options] db [db-command] | ||
Commands: | ||
create # Create the database | ||
HELP | ||
|
||
exit | ||
end | ||
|
||
def self.run(args) | ||
OptionParser.parse(args) do |opts| | ||
opts.unknown_args do |args, options| | ||
arg = args.shift | ||
case arg | ||
when "create" | ||
exit | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
require "yaml" | ||
# Initialize Clear with the database.yml file | ||
CLEAR_CONFIG = YAML.parse(File.read("./config/database.yml"))[Application.env] | ||
CLEAR_DB_CONFIG = YAML.parse(File.read("./config/database.yml"))[Application.env] | ||
|
||
uri = CLEAR_CONFIG["uri"].as_s | ||
def self.init_db | ||
uri = CLEAR_DB_CONFIG["uri"].as_s | ||
|
||
begin | ||
Clear::SQL.init(CLEAR_CONFIG["uri"].as_s) | ||
rescue DB::ConnectionRefused | ||
puts "FATAL: Connection to the database (#{uri}) has been refused" | ||
exit | ||
end | ||
begin | ||
Clear::SQL.init(CLEAR_DB_CONFIG["uri"].as_s) | ||
rescue DB::ConnectionRefused | ||
puts "FATAL: Connection to the database (#{uri}) has been refused" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ module View::Layouts | |
t.div id: "app" do | ||
t.yield | ||
end | ||
t.app_footer("meh?") | ||
end | ||
end | ||
end | ||
|