Compare commits
No commits in common. "a7807f089cf4c661fa39a303162fa2b3e65fc8c1" and "2578cd7a6d4c516319c4b0d6881b4c67fd6652b1" have entirely different histories.
a7807f089c
...
2578cd7a6d
3 changed files with 0 additions and 112 deletions
4
bin/dat
4
bin/dat
|
@ -56,10 +56,6 @@ when :make
|
||||||
puts "making..."
|
puts "making..."
|
||||||
require 'make'
|
require 'make'
|
||||||
Make.command(options)
|
Make.command(options)
|
||||||
when :execute
|
|
||||||
puts "Ececuting: #{options.name}"
|
|
||||||
require 'execute'
|
|
||||||
Execute.file(options)
|
|
||||||
when :goto
|
when :goto
|
||||||
Dir.chdir(ENV["DAT_ROOT"])
|
Dir.chdir(ENV["DAT_ROOT"])
|
||||||
when :vm
|
when :vm
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
It is how you can describe config of your server
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
user :artur
|
|
||||||
user :lucyna
|
|
||||||
|
|
||||||
service :forgejo do |context|
|
|
||||||
context.home_page = true
|
|
||||||
# per default all users are allowed
|
|
||||||
context.users = [:artur]
|
|
||||||
end
|
|
||||||
|
|
||||||
service :zulip
|
|
||||||
|
|
||||||
# this should be already installed, becouse it is required by others
|
|
||||||
service :postgresql
|
|
||||||
|
|
||||||
install :nvim, :python
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
And then save it as `Configfile` as default or with specyfic name
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# if default file name
|
|
||||||
dat execute
|
|
||||||
|
|
||||||
# if non standard file
|
|
||||||
dat execute file-name
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
|
|
||||||
module Execute
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
require 'rubygems'
|
|
||||||
require 'ostruct'
|
|
||||||
|
|
||||||
# dat execute progress
|
|
||||||
# dat execute < default Configfile
|
|
||||||
|
|
||||||
module Execute
|
|
||||||
def dependency(name)
|
|
||||||
puts "Checking for #{name}..."
|
|
||||||
|
|
||||||
unless gem_installed?(name)
|
|
||||||
puts "Installing #{name}..."
|
|
||||||
system("gem install #{name}")
|
|
||||||
else
|
|
||||||
puts "#{name} is already installed."
|
|
||||||
end
|
|
||||||
|
|
||||||
require name
|
|
||||||
rescue LoadError => e
|
|
||||||
puts "Failed to load #{name}: #{e.message}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def gem_installed?(name)
|
|
||||||
Gem::Specification::find_all_by_name(name).any?
|
|
||||||
end
|
|
||||||
|
|
||||||
def postgres
|
|
||||||
require 'setup/postgresql'
|
|
||||||
puts 'installing postgres'
|
|
||||||
Setup::PostgreSQL.install
|
|
||||||
end
|
|
||||||
|
|
||||||
def service(name)
|
|
||||||
if block_given?
|
|
||||||
context = OpenStruct.new
|
|
||||||
output = yield context
|
|
||||||
puts output
|
|
||||||
puts "context: #{context}"
|
|
||||||
else
|
|
||||||
puts "No block provided"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def user(name)
|
|
||||||
puts "Creating user: #{name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def install(*packages)
|
|
||||||
packages.each do |pkg|
|
|
||||||
puts "Installing #{pkg}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.file(options)
|
|
||||||
puts "options: #{options}"
|
|
||||||
dsl = Object.new
|
|
||||||
dsl.extend(Execute)
|
|
||||||
# Configfile
|
|
||||||
path = File.join(Dir.pwd, options.name || "./Configfile")
|
|
||||||
dsl.instance_eval(File.read(path), path)
|
|
||||||
# Execute the config
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue