share_some_love 0.0.5 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LOVE_by_author.md +272 -0
- data/LOVE_by_gem.md +166 -0
- data/hearts/surfer.txt +5 -0
- data/lib/love/author.rb +22 -5
- data/lib/love/gem.rb +16 -4
- data/lib/love/share.rb +37 -20
- data/lib/love/version.rb +1 -1
- data/lib/love.rb +14 -13
- data/share_some_love.gemspec +2 -0
- data/spec/love/author_spec.rb +9 -0
- data/spec/love/basic_spec.rb +86 -0
- data/spec/spec_helper.rb +1 -1
- data/templates/html/_author.html.erb +24 -0
- data/templates/html/_gem.html.erb +22 -0
- data/templates/html/by_author.html.erb +21 -0
- data/templates/html/by_gem.html.erb +21 -0
- data/templates/md/_author.md.erb +14 -7
- data/templates/md/_gem.md.erb +13 -6
- data/templates/md/by_author.md.erb +9 -0
- data/templates/md/by_gem.md.erb +9 -0
- metadata +27 -23
- data/LOVE.md +0 -183
- data/_old_templates/html/footer.erb +0 -1
- data/_old_templates/html/head.erb +0 -12
- data/_old_templates/html/javascripts.erb +0 -2
- data/_old_templates/html/simple.erb +0 -17
- data/_old_templates/html/styles.erb +0 -2
- data/_old_templates/md/contributor.erb +0 -4
- data/_old_templates/md/footer.erb +0 -1
- data/_old_templates/md/gem.erb +0 -10
- data/_old_templates/md/head.erb +0 -2
- data/_old_templates/md/user.erb +0 -11
- data/tmp/lib/love/gem.rb +0 -53
- data/tmp/lib/love/html_renderer.rb +0 -23
- data/tmp/lib/love/person.rb +0 -60
- data/tmp/lib/love/render/overrides.rb +0 -29
- data/tmp/lib/love/render.rb +0 -35
- data/tmp/lib/love/site.rb +0 -21
- data/tmp/lib/love/thank_words.rb +0 -96
- data/tmp/lib/love/thanks.rb +0 -50
- data/tmp/lib/love/version.rb +0 -3
- data/tmp/lib/love.rb +0 -39
data/_old_templates/md/gem.erb
DELETED
data/_old_templates/md/head.erb
DELETED
data/_old_templates/md/user.erb
DELETED
data/tmp/lib/love/gem.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
class Love
|
2
|
-
class Gem
|
3
|
-
|
4
|
-
attr_reader :name, :authors, :plain_authors, :spec
|
5
|
-
|
6
|
-
def initialize(spec, fetch = true)
|
7
|
-
@spec = spec
|
8
|
-
@name = spec.name
|
9
|
-
@plain_authors = spec.authors
|
10
|
-
@authors = []
|
11
|
-
fetch_authors if fetch
|
12
|
-
end
|
13
|
-
|
14
|
-
def fetch_authors
|
15
|
-
plain_authors.each do |name|
|
16
|
-
person = Person.new(name)
|
17
|
-
person.add_gem self
|
18
|
-
add_author person
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def add_author(author)
|
23
|
-
@authors << author
|
24
|
-
end
|
25
|
-
|
26
|
-
def thanks
|
27
|
-
who = \
|
28
|
-
if authors.count > 1
|
29
|
-
"these cool and creative people: #{authors.map(&:name).join(', ')}"
|
30
|
-
else
|
31
|
-
"this cool and creative person #{authors.first.name}"
|
32
|
-
end
|
33
|
-
what = "this awesome gem - #{name}"
|
34
|
-
end
|
35
|
-
|
36
|
-
class << self
|
37
|
-
|
38
|
-
def create_file
|
39
|
-
thanks = \
|
40
|
-
if by_gemname
|
41
|
-
thanks_by_gemname
|
42
|
-
else
|
43
|
-
thanks_by_author
|
44
|
-
end
|
45
|
-
b = binding
|
46
|
-
File.open('./LOVE.md', 'w+') do |f|
|
47
|
-
f.write ERB.new(TEMPLATE_MD).result(b)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class Love
|
2
|
-
module HtmlRenderer
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def thanks
|
6
|
-
Love::ThankWords.title_thanks
|
7
|
-
end
|
8
|
-
|
9
|
-
def style
|
10
|
-
''
|
11
|
-
end
|
12
|
-
|
13
|
-
def javasctipt
|
14
|
-
''
|
15
|
-
end
|
16
|
-
|
17
|
-
def content(template_name, body)
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/tmp/lib/love/person.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'octokit'
|
2
|
-
|
3
|
-
class Love
|
4
|
-
class Person
|
5
|
-
|
6
|
-
attr_reader :name, :info, :gems
|
7
|
-
|
8
|
-
def initialize(name, fetch = true)
|
9
|
-
@name = name
|
10
|
-
@gems = []
|
11
|
-
fetch_info if fetch
|
12
|
-
end
|
13
|
-
|
14
|
-
def fetch_info
|
15
|
-
search_person = Octokit.search_users name
|
16
|
-
@info = \
|
17
|
-
if search_person > 1
|
18
|
-
puts '!!! THERE ARE SEVERAL PERSONS WITH THIS NAME IN GITHUB !!!'
|
19
|
-
puts "Please check right man with his number and we'll continue"
|
20
|
-
search_person.each_with_index do |person, index|
|
21
|
-
puts "#{index} - name: #{person.name}; login: #{person.login}; username: #{person.username}"
|
22
|
-
end
|
23
|
-
|
24
|
-
Octokit.user search_person[gets.chomp.to_i].username
|
25
|
-
else
|
26
|
-
Octokit.user search_person.first.username
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def add_gem(gem)
|
31
|
-
@gems << gem
|
32
|
-
end
|
33
|
-
|
34
|
-
def love(format)
|
35
|
-
image = info.avatar_url
|
36
|
-
who = "#{Love::ThankWords.person_prefix} #{name}"
|
37
|
-
bold = true
|
38
|
-
begin_thanking = Love::ThankWords.begin_phrase_for_author
|
39
|
-
for_what = \
|
40
|
-
if gems.count > 1
|
41
|
-
"#{Love::ThankWords.libraries_prefix} #{gems.map(&:name).join(', ')}"
|
42
|
-
else
|
43
|
-
"#{Love::ThankWords.library_prefix} #{gems.first.name}"
|
44
|
-
end
|
45
|
-
finish_thanking = Love::ThankWords.end_phrase_for_author
|
46
|
-
|
47
|
-
template = \
|
48
|
-
if format == 'md'
|
49
|
-
love_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'templates/md'))
|
50
|
-
File.read(File.join(love_dir, 'person.erb'))
|
51
|
-
else
|
52
|
-
love_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'templates/html'))
|
53
|
-
File.read(File.join(love_dir, 'person.erb'))
|
54
|
-
end
|
55
|
-
|
56
|
-
ERB.new(template).result(binding)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class Pathname
|
2
|
-
|
3
|
-
def glob(pattern, &block)
|
4
|
-
Pathname.glob(self.join(pattern), &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
class Sprockets::Context
|
10
|
-
include R18n::Helpers
|
11
|
-
end
|
12
|
-
|
13
|
-
R18n::Filters.add('code') do |text, config|
|
14
|
-
text.gsub(/`([^`]+)`/, '<code>\1</code>')
|
15
|
-
end
|
16
|
-
|
17
|
-
R18n::Filters.add('format') do |text, config|
|
18
|
-
'<p>' +
|
19
|
-
text.gsub(/~([^~]+)~/, '<strong>\1</strong>').gsub("\n", '</p><p>') +
|
20
|
-
'</p>'
|
21
|
-
end
|
22
|
-
|
23
|
-
class R18n::TranslatedString
|
24
|
-
def link(href, args = { })
|
25
|
-
args[:href] = href
|
26
|
-
args = args.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')
|
27
|
-
self.sub(/\^([^\^]+)\^/, "<a #{args}>\\1</a>")
|
28
|
-
end
|
29
|
-
end
|
data/tmp/lib/love/render.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'slim'
|
3
|
-
require 'uglifier'
|
4
|
-
require 'sprockets'
|
5
|
-
require 'evil-front'
|
6
|
-
require 'coffee_script'
|
7
|
-
require 'rails-sass-images'
|
8
|
-
require 'autoprefixer-rails'
|
9
|
-
|
10
|
-
require 'r18n-core'
|
11
|
-
|
12
|
-
require 'render/overrides'
|
13
|
-
|
14
|
-
class Love
|
15
|
-
class Render
|
16
|
-
DEFAULT_ROOT = Pathname(__FILE__).parent.parent.parent.join('templates/')
|
17
|
-
|
18
|
-
attr_accessor :root, :public, :layouts, :images, :standalone, :i18n
|
19
|
-
|
20
|
-
def initialize(templates_path = DEFAULT_ROOT)
|
21
|
-
@root = templates_path
|
22
|
-
@public = @root.join('public/')
|
23
|
-
@layouts = @root.join('layouts/')
|
24
|
-
@images = @root.join('images/')
|
25
|
-
@standalone = @root.join('standalone/')
|
26
|
-
@i18n = @root.join('i18n')
|
27
|
-
@scripts = @root.join('scripts/')
|
28
|
-
@styles = @root.join('styles/')
|
29
|
-
@vendor = @root.join('vendor/')
|
30
|
-
|
31
|
-
R18n.default_places = @i18n
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
data/tmp/lib/love/site.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
class Love
|
2
|
-
module Site
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def create_file
|
6
|
-
title = Love::ThankWords.title_thanks
|
7
|
-
thanks = \
|
8
|
-
if by_gemname
|
9
|
-
thanks_by_gemname
|
10
|
-
else
|
11
|
-
thanks_by_author
|
12
|
-
end
|
13
|
-
b = binding
|
14
|
-
File.open('./public/love.html', 'w+') do |f|
|
15
|
-
f.write ERB.new(TEMPLATE).result(b)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/tmp/lib/love/thank_words.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
class Love
|
2
|
-
module ThankWords
|
3
|
-
|
4
|
-
BEGIN_AUTHOR = \
|
5
|
-
[
|
6
|
-
"I'd like to thank",
|
7
|
-
'I appreciate time of',
|
8
|
-
'My sincere thanks to',
|
9
|
-
'Thank you so much,',
|
10
|
-
'Thank you very much,'
|
11
|
-
]
|
12
|
-
|
13
|
-
MIDDLE_AUTHOR = \
|
14
|
-
[
|
15
|
-
'for creating and maintaining',
|
16
|
-
'for made this idea happened, I mean',
|
17
|
-
'for spending time on',
|
18
|
-
'for making my life easier by creating',
|
19
|
-
'for being so nice to create'
|
20
|
-
]
|
21
|
-
|
22
|
-
END_AUTHOR = \
|
23
|
-
[
|
24
|
-
'I wanna hug you someday and say in person what great job you done!',
|
25
|
-
'I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!',
|
26
|
-
'Just be so cool as you are and remember that your work never being useless!',
|
27
|
-
'Enjoy what you did as I am!'
|
28
|
-
]
|
29
|
-
|
30
|
-
TITLE_THANKS = \
|
31
|
-
[
|
32
|
-
'Thank you all, guys and girls who made my life easier and help me to enjoy make my project more and more!',
|
33
|
-
"I'd like to thank all these people! Believe me - they are awesome!",
|
34
|
-
'Love to these people! And bunch of hugs!'
|
35
|
-
]
|
36
|
-
|
37
|
-
PERSON_PREFIX = \
|
38
|
-
[
|
39
|
-
'my mate',
|
40
|
-
'awesome person',
|
41
|
-
'great developer',
|
42
|
-
'awesome programmer'
|
43
|
-
]
|
44
|
-
|
45
|
-
LIBRARY_PREFIX = \
|
46
|
-
[
|
47
|
-
'this helpful and useful gem',
|
48
|
-
'awesome project',
|
49
|
-
'cool thing',
|
50
|
-
'helpful thing'
|
51
|
-
]
|
52
|
-
|
53
|
-
LIBRARIES_PREFIX = \
|
54
|
-
[
|
55
|
-
'these awesome and helpful gems',
|
56
|
-
'a lot of great projects',
|
57
|
-
'these awesome libraries'
|
58
|
-
]
|
59
|
-
|
60
|
-
class << self
|
61
|
-
|
62
|
-
def title_thanks
|
63
|
-
TITLE_THANKS[rand(TITLE_THANKS.length)]
|
64
|
-
end
|
65
|
-
|
66
|
-
def begin_phrase_for_author
|
67
|
-
BEGIN_AUTHOR[rand(BEGIN_AUTHOR.length)]
|
68
|
-
end
|
69
|
-
|
70
|
-
def connect_author_with_gem_phrase
|
71
|
-
MIDDLE_AUTHOR[rand(BEGIN_AUTHOR.length)]
|
72
|
-
end
|
73
|
-
|
74
|
-
def end_phrase_for_author
|
75
|
-
END_AUTHOR[rand(BEGIN_AUTHOR.length)]
|
76
|
-
end
|
77
|
-
|
78
|
-
def person_perfix
|
79
|
-
PERSON_PREFIX[rand(PERSON_PREFIX.length)]
|
80
|
-
end
|
81
|
-
|
82
|
-
def library_prefix
|
83
|
-
LIBRARY_PREFIX[rand(LIBRARY_PREFIX.length)]
|
84
|
-
end
|
85
|
-
|
86
|
-
def libraries_prefix
|
87
|
-
LIBRARIES_PREFIX[rand(LIBRARIES_PREFIX.length)]
|
88
|
-
end
|
89
|
-
|
90
|
-
def hearts
|
91
|
-
'<3' * rand(10)
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
data/tmp/lib/love/thanks.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
class Love
|
2
|
-
class Thanks
|
3
|
-
|
4
|
-
def initialize
|
5
|
-
|
6
|
-
end
|
7
|
-
class << self
|
8
|
-
|
9
|
-
def by_gemname
|
10
|
-
thanks = ''
|
11
|
-
template = for_site ? THANKS : THANKS_MD
|
12
|
-
@gems.each do |gem|
|
13
|
-
who = \
|
14
|
-
if gem.authors.count > 1
|
15
|
-
"these cool and creative people: #{gem.authors.map(&:name).join(', ')}"
|
16
|
-
else
|
17
|
-
"this cool and creative person #{gem.authors.first.name}"
|
18
|
-
end
|
19
|
-
what = "this awesome gem - #{gem.name}"
|
20
|
-
b = binding
|
21
|
-
thanks << ERB.new(template).result(b)
|
22
|
-
end
|
23
|
-
thanks
|
24
|
-
end
|
25
|
-
|
26
|
-
def thanks_by_author
|
27
|
-
thanks = ''
|
28
|
-
template = for_site ? THANKS : THANKS_MD
|
29
|
-
@authors.each do |author|
|
30
|
-
who = "my mate #{author.name}"
|
31
|
-
what = \
|
32
|
-
if author.gems.count > 1
|
33
|
-
"these great libraries: #{author.gems.map(&:name).join(', ')}! Wow man! You awesome!"
|
34
|
-
else
|
35
|
-
"this helpful and useful gem - #{author.gems.first.name}"
|
36
|
-
end
|
37
|
-
b = binding
|
38
|
-
thanks << ERB.new(template).result(b)
|
39
|
-
end
|
40
|
-
thanks
|
41
|
-
end
|
42
|
-
|
43
|
-
# WIP
|
44
|
-
def thanks_to_contributors
|
45
|
-
thanks = ''
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/tmp/lib/love/version.rb
DELETED
data/tmp/lib/love.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
|
3
|
-
class Love
|
4
|
-
|
5
|
-
def self.share_for(args)
|
6
|
-
by_gemname = args.include? 'by_gem'
|
7
|
-
for_site = args.include? 'site'
|
8
|
-
|
9
|
-
self.new by_gemname, for_site
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_reader :by_gemname, :for_site, :gems, :authors
|
13
|
-
|
14
|
-
def initialize(by_gemname, for_site)
|
15
|
-
@by_gemname = by_gemname
|
16
|
-
@for_site = for_site
|
17
|
-
|
18
|
-
parse_gemfile
|
19
|
-
share_love
|
20
|
-
end
|
21
|
-
|
22
|
-
def parse_gemfile
|
23
|
-
Bundler.setup.specs.each do |spec|
|
24
|
-
gem = Love::Gem.new(spec)
|
25
|
-
@gems << gem
|
26
|
-
@authors << gem.authors
|
27
|
-
end
|
28
|
-
@authors = @authors.flatten.uniq
|
29
|
-
end
|
30
|
-
|
31
|
-
def share_love
|
32
|
-
if for_site
|
33
|
-
Love::Site.create_file
|
34
|
-
else
|
35
|
-
Love::Gem.create_file
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|