update sqlite?
This commit is contained in:
parent
1ddb9eda1b
commit
b711f54b84
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*~
|
||||||
|
*#
|
6
Gemfile
Normal file
6
Gemfile
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
gem 'fileutils'
|
||||||
|
gem 'tty-prompt'
|
||||||
|
gem 'colorize'
|
||||||
|
gem 'sqlite3'
|
||||||
|
gem 'scrypt'
|
28
docker/Dockerfile
Normal file
28
docker/Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
FROM ubuntu:xenial
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y emacs-nox ruby openssh-server
|
||||||
|
RUN apt-get install -y build-essential libsqlite3-dev sqlite3
|
||||||
|
RUN gem install tty-prompt colorize
|
||||||
|
RUN mkdir /var/run/sshd
|
||||||
|
|
||||||
|
# SSH login fix. Otherwise user is kicked off after login
|
||||||
|
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
|
||||||
|
|
||||||
|
ADD eshell /usr/bin/
|
||||||
|
|
||||||
|
COPY Gemfile* /tmp/
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
ENV app /app
|
||||||
|
RUN mkdir $app
|
||||||
|
WORKDIR $app
|
||||||
|
|
||||||
|
#ENV BUNDLE_PATH /box
|
||||||
|
#ADD ../. $app
|
||||||
|
|
||||||
|
VOLUME /home
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
CMD ["/usr/sbin/sshd", "-D"]
|
3
docker/build.sh
Executable file
3
docker/build.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cp ../eshell ./
|
||||||
|
docker build -t emacs-collab:latest .
|
|
@ -33,6 +33,10 @@ module EmacsCollab
|
||||||
$db.get_user(id)
|
$db.get_user(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_users
|
||||||
|
$db.get_users
|
||||||
|
end
|
||||||
|
|
||||||
def self.change_user_password(id,password)
|
def self.change_user_password(id,password)
|
||||||
user = get_user_by_id(id)
|
user = get_user_by_id(id)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,18 @@ module EmacsCollab
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_users
|
||||||
|
user_rows = @db.execute("SELECT * FROM Users")
|
||||||
|
|
||||||
|
user_rows.map do |row|
|
||||||
|
user = User.new(row[0])
|
||||||
|
user.pw_hash = row[1]
|
||||||
|
user.salt = row[2]
|
||||||
|
user.keys = row[3] == nil ? nil : JSON.parse(row[3])
|
||||||
|
user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def add_user(user)
|
def add_user(user)
|
||||||
@db.execute("INSERT INTO Users (name) VALUES (?)",
|
@db.execute("INSERT INTO Users (name) VALUES (?)",
|
||||||
[user.id])
|
[user.id])
|
||||||
|
|
|
@ -19,7 +19,7 @@ def init
|
||||||
end
|
end
|
||||||
|
|
||||||
def users
|
def users
|
||||||
choices = $users
|
choices = EmacsCollab.get_users
|
||||||
user = $prompt.select("Pick a user", choices)
|
user = $prompt.select("Pick a user", choices)
|
||||||
keys_user(user)
|
keys_user(user)
|
||||||
end
|
end
|
||||||
|
@ -88,12 +88,12 @@ def project_users(project)
|
||||||
when :list
|
when :list
|
||||||
project.users.each {|u| puts u.id}
|
project.users.each {|u| puts u.id}
|
||||||
when :add
|
when :add
|
||||||
choices = $users
|
choices = EmacsCollab.get_users
|
||||||
user = $prompt.select("Pick a user", choices)
|
user = $prompt.select("Pick a user", choices)
|
||||||
project.add_user(user)
|
project.add_user(user)
|
||||||
puts "Added user #{user} to #{project}".colorize(:green)
|
puts "Added user #{user} to #{project}".colorize(:green)
|
||||||
when :select
|
when :select
|
||||||
choices = $users
|
choices = EmacsCollab.get_users
|
||||||
|
|
||||||
# Mark already added users as "default"
|
# Mark already added users as "default"
|
||||||
defaults = []
|
defaults = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user