Skip to content

Commit 7725455

Browse files
committed
sets up thor
1 parent 312a65f commit 7725455

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN groupadd -g ${GID} -o app
1919
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash app
2020

2121
ENV GEM_HOME=/gems
22-
ENV PATH="$PATH:/gems/bin"
22+
ENV PATH="$PATH:/gems/bin:/app/exe"
2323
RUN mkdir -p /gems && chown ${UID}:${GID} /gems
2424

2525

exe/patron

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env ruby
2+
$LOAD_PATH.unshift(File.absolute_path(File.join(__dir__, "..", "lib")))
3+
4+
require "bundler/setup"
5+
require "cli"
6+
CLI.start

lib/cli.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require "thor"
2+
require_relative "process_ldap"
3+
4+
class CLI < Thor
5+
def self.exit_on_failure?
6+
true
7+
end
8+
9+
desc "hello", "Prints a greeting"
10+
def hello
11+
puts "hello world"
12+
end
13+
14+
desc "ldap UNIQNAME", "returns the ldap info for a user"
15+
def ldap(uniqname)
16+
puts uniqname
17+
# ProcessLdapOneUser.new(uniqname).ldap_output
18+
end
19+
end

lib/process_ldap.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,15 @@ def initialize(uniqname:, output: $stdout)
157157
def filter
158158
Net::LDAP::Filter.eq("uid", @uniqname)
159159
end
160+
161+
def ldap_output
162+
ldap.search(
163+
base: "ou=People,dc=umich,dc=edu",
164+
objectclass: "*",
165+
filter: filter,
166+
attrs: ldap_attributes
167+
) do |data|
168+
@output.write(data)
169+
end
170+
end
160171
end

0 commit comments

Comments
 (0)