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.4'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.authorsObject

Returns the value of attribute authors.



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

def authors
  @authors
end

.by_gemnameObject (readonly)

Returns the value of attribute by_gemname.



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

def by_gemname
  @by_gemname
end

.check_authorObject (readonly)

Returns the value of attribute check_author.



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

def check_author
  @check_author
end

.for_siteObject (readonly)

Returns the value of attribute for_site.



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

def for_site
  @for_site
end

.gemsObject

Returns the value of attribute gems.



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

def gems
  @gems
end

.langObject (readonly)

Returns the value of attribute lang.



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

def lang
  @lang
end

.octokitObject (readonly)

Returns the value of attribute octokit.



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

def octokit
  @octokit
end

.rootObject (readonly)

Returns the value of attribute root.



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

def root
  @root
end

Class Method Details

.config(args = []) ⇒ Object



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

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



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

def 
  puts 'Please, enter your github credentials that Octokit could work without github guest requests restrictions'
  hl = HighLine.new
   = hl.ask "Login: "
  pass = hl.ask("Password: ") { |q| q.echo = '*' }
  @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



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

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