Class: Flagit
- Inherits:
-
Object
show all
- Defined in:
- lib/flagit.rb
Defined Under Namespace
Classes: Configuration, Lookout, Postman, Redactor, TwitterOAuth
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
2
3
4
|
# File 'lib/flagit.rb', line 2
def configuration
@configuration
end
|
Class Method Details
.configuration ⇒ Object
17
18
19
|
# File 'lib/flagit.rb', line 17
def self.configuration
@configuration ||= Configuration.new
end
|
25
26
27
|
# File 'lib/flagit.rb', line 25
def self.configure
yield(configuration)
end
|
.load ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/flagit.rb', line 35
def self.load
return unless File.exist?("#{root}/.config.json")
loaded = JSON.parse(File.read("#{root}/.config.json"))
configure do |config|
config.consumer_key = loaded['consumer_key']
config.consumer_secret = loaded['consumer_secret']
config.access_token = loaded['access_token']
config.access_token_secret = loaded['access_token_secret']
end
end
|
.reset ⇒ Object
21
22
23
|
# File 'lib/flagit.rb', line 21
def self.reset
@configuration = Configuration.new
end
|
.root ⇒ Object
46
47
48
|
# File 'lib/flagit.rb', line 46
def self.root
File.dirname __dir__
end
|
.run(message, path = '.') ⇒ Object
.save! ⇒ Object
29
30
31
32
33
|
# File 'lib/flagit.rb', line 29
def self.save!
File.open("#{root}/.config.json","w") do |f|
f.write(configuration.config_to_json)
end
end
|
.usage ⇒ Object
11
12
13
14
15
|
# File 'lib/flagit.rb', line 11
def self.usage
puts "Usage: flagit \"<message>\" <path_to_repository_directory>"
puts "Eg: flagit \"Just finished and launched Flagit v1.0.0!\""
puts "Eg: flagit \"My first gem!\" ~/path/to/repo/dir"
end
|