Module: Love

Defined in:
lib/love.rb,
lib/love/gem.rb,
lib/love/share.rb,
lib/love/author.rb,
lib/love/version.rb,
lib/love/thank_words.rb

Defined Under Namespace

Modules: Share, ThankWords Classes: Author, Gem

Constant Summary collapse

VERSION =
'0.1.2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.authorsObject

Returns the value of attribute authors.



11
12
13
# File 'lib/love.rb', line 11

def authors
  @authors
end

.by_gemnameObject (readonly)

Returns the value of attribute by_gemname.



10
11
12
# File 'lib/love.rb', line 10

def by_gemname
  @by_gemname
end

.check_authorObject (readonly)

Returns the value of attribute check_author.



10
11
12
# File 'lib/love.rb', line 10

def check_author
  @check_author
end

.for_siteObject (readonly)

Returns the value of attribute for_site.



10
11
12
# File 'lib/love.rb', line 10

def for_site
  @for_site
end

.gemsObject

Returns the value of attribute gems.



11
12
13
# File 'lib/love.rb', line 11

def gems
  @gems
end

.langObject (readonly)

Returns the value of attribute lang.



10
11
12
# File 'lib/love.rb', line 10

def lang
  @lang
end

.octokitObject (readonly)

Returns the value of attribute octokit.



10
11
12
# File 'lib/love.rb', line 10

def octokit
  @octokit
end

.rootObject (readonly)

Returns the value of attribute root.



10
11
12
# File 'lib/love.rb', line 10

def root
  @root
end

Class Method Details

.config(args = []) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/love.rb', line 24

def config(args = [])
  @by_gemname = args.include? 'by_gem'
  @for_site = args.include? 'site'
  @check_author = args.include? '-v'
  @root = Pathname(__FILE__).parent
  @lang = 'en'
  @gems = []
  @authors = []
end

.lets_start_from_heart!Object



43
44
45
# File 'lib/love.rb', line 43

def lets_start_from_heart!
  puts File.read(Love.root.join '../hearts/ascii1.txt')
end

.login_userObject



34
35
36
37
38
39
40
41
# File 'lib/love.rb', line 34

def 
  puts 'Please, enter your github credentials that Octokit could work without github guest requests restrictions'
  puts 'login:'
   = $stdin.gets.chomp
  puts 'password:'
  pass = $stdin.gets.chomp
  @octokit = Octokit::Client.new login: , password: pass
end

.parse_gemfileObject



47
48
49
50
51
52
# File 'lib/love.rb', line 47

def parse_gemfile
  Bundler.load.specs.each do |spec|
    gem = Love::Gem.new(spec)
    @gems << gem
  end
end

.share_for(args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/love.rb', line 13

def share_for(args)
  config(args)

  lets_start_from_heart!

  

  parse_gemfile
  share_love
end

.share_loveObject



54
55
56
57
58
59
60
# File 'lib/love.rb', line 54

def share_love
  if for_site
    Love::Share.html by_gemname
  else
    Love::Share.md by_gemname
  end
end