Module: LinuxHub
- Defined in:
- lib/linux-hub.rb,
lib/linux-hub/cli.rb,
lib/linux-hub/github.rb,
lib/linux-hub/version.rb,
lib/linux-hub/linux_user.rb,
lib/linux-hub/github_team.rb,
lib/linux-hub/github_user.rb
Defined Under Namespace
Classes: CLI, Github, GithubTeam, GithubUser, LinuxUser
Constant Summary
collapse
- ACTIONS =
[:list, :create_users, :sync_users]
- VERSION =
'0.0.3'
Class Method Summary
collapse
Class Method Details
.invoke ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/linux-hub.rb', line 13
def self.invoke
options = Trollop::options do
opt :config_file, "The config file to read options from", type: :string, required: true
opt :list, "List users in the Github Team", type: :boolean
opt :create_users, "Create users in the Github Team", type: :boolean
opt :sync_users, "Manage all users in the Github Team", type: :boolean
end
config = load_config(options[:config_file])
if config["access_token"].nil?
puts "You need an access token with 'read:org' permissions for the organisation"
exit 1
elsif config["organisation"].nil? || config["team"].nil?
puts "Please provide the team and organisation in the relevant config file"
end
action = options.select { |k,v| ACTIONS.include?(k) && v == true }
unless action.length == 1
puts "Please specify one of the following action commands\n#{ACTIONS}"
exit 1
end
cli = CLI.new(config)
cli.send(action.keys.first)
end
|
.load_config(config_file) ⇒ Object
40
41
42
|
# File 'lib/linux-hub.rb', line 40
def self.load_config(config_file)
YAML.load_file(config_file)
end
|