Module: Gitrob
- Defined in:
- lib/gitrob.rb,
lib/gitrob/util.rb,
lib/gitrob/webapp.rb,
lib/gitrob/version.rb,
lib/gitrob/github/blob.rb,
lib/gitrob/github/user.rb,
lib/gitrob/progressbar.rb,
lib/gitrob/github/repository.rb,
lib/gitrob/github/http_client.rb,
lib/gitrob/github/organization.rb,
lib/gitrob/observers/sensitive_files.rb
Defined Under Namespace
Modules: Github, Observers, Util
Classes: ProgressBar, WebApp
Constant Summary
collapse
- VERSION =
"0.0.6"
Class Method Summary
collapse
Class Method Details
.agreement ⇒ Object
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/gitrob.rb', line 71
def self.agreement
"\n#{self.license}\n\n" +
Paint["Gitrob is designed for security professionals. If you use any information\n" +
"found through this tool for malicious purposes that are not authorized by\n" +
"the organization, you are violating the terms of use and license of this\n" +
"tool. By typing y/yes, you agree to the terms of use and that you will use\n" +
"this tool for lawful purposes only.",
:bright, :red]
end
|
.agreement_accepted ⇒ Object
82
83
84
|
# File 'lib/gitrob.rb', line 82
def self.agreement_accepted
File.open("#{File.dirname(__FILE__)}/../agreement", 'w') { |file| file.write("user accepted") }
end
|
.agreement_accepted? ⇒ Boolean
67
68
69
|
# File 'lib/gitrob.rb', line 67
def self.agreement_accepted?
File.exists?("#{File.dirname(__FILE__)}/../agreement")
end
|
.banner ⇒ Object
107
108
109
110
111
112
113
114
115
|
# File 'lib/gitrob.rb', line 107
def self.banner
<<-BANNER
_ _ _
___|_| |_ ___ ___| |_
| . | | _| _| . | . |
|_ |_|_| |_| |___|___|
|___| #{Paint["By @michenriksen", :bright, :white]}
BANNER
end
|
.configuration ⇒ Object
94
95
96
|
# File 'lib/gitrob.rb', line 94
def self.configuration
@config ||= load_configuration!
end
|
90
91
92
|
# File 'lib/gitrob.rb', line 90
def self.configured?
File.exists?("#{Dir.home}/.gitrobrc")
end
|
.delete_organization(org) ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/gitrob.rb', line 58
def self.delete_organization(org)
orgs = Gitrob::Organization.all(:login => org)
if orgs.count > 0
task("Deleting existing #{org} organization...") do
orgs.destroy
end
end
end
|
.fatal(message) ⇒ Object
45
46
47
48
|
# File 'lib/gitrob.rb', line 45
def self.fatal(message)
puts " #{Paint['[!]', :bright, :red]} #{Paint[message, :bright, :white]}"
exit!
end
|
.license ⇒ Object
86
87
88
|
# File 'lib/gitrob.rb', line 86
def self.license
File.read("#{File.dirname(__FILE__)}/../LICENSE.txt")
end
|
.load_configuration! ⇒ Object
98
99
100
|
# File 'lib/gitrob.rb', line 98
def self.load_configuration!
YAML.load_file("#{Dir.home}/.gitrobrc")
end
|
.prepare_database! ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/gitrob.rb', line 50
def self.prepare_database!
DataMapper::Model.raise_on_save_failure = true
DataMapper::Property.auto_validation(false)
DataMapper.setup(:default, configuration['sql_connection_uri'])
DataMapper.finalize
DataMapper.auto_upgrade!
end
|
.save_configuration!(config) ⇒ Object
102
103
104
105
|
# File 'lib/gitrob.rb', line 102
def self.save_configuration!(config)
@config = config
File.open("#{Dir.home}/.gitrobrc", 'w') { |f| f.write YAML.dump(config) }
end
|
.status(message) ⇒ Object
41
42
43
|
# File 'lib/gitrob.rb', line 41
def self.status(message)
puts " #{Paint['[*]', :bright, :blue]} #{Paint[message, :bright, :white]}"
end
|
.task(message) ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'lib/gitrob.rb', line 31
def self.task(message)
print " #{Paint['[*]', :bright, :blue]} #{Paint[message, :bright, :white]}"
yield
puts Paint[" done", :bright, :green]
rescue => e
puts Paint[" failed", :bright, :red]
puts "#{Paint[' [!]', :bright, :red]} #{Paint[e.class, :bright, :white]}: #{e.message}"
exit!
end
|