share_some_love 0.0.1 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1262afe785b3d6f786bfd44c61e4e9443bc44a96
4
- data.tar.gz: 50c7c2d846b2f884040fb6e0fe4da9ce9a8cd313
3
+ metadata.gz: cb6d0171e4a369ab76a2cba4074efa45e500f6b6
4
+ data.tar.gz: 857222b6be06d2eff9d7d4aad769c5b285d87916
5
5
  SHA512:
6
- metadata.gz: a8ae6eb92c714877cdd49022a112f8f62725f7b0eee1af87e024c8e4494aad2f6c10c54ded8b51c351875e55a11f78b0c6d21b0fe313f3192c2d397205d5f833
7
- data.tar.gz: 2083ed2bbfdd461bdc4c447af72dfa5ea3835dcebd90cdcbe31ed2eed75f468a527524ccb1dfd2de278f5935a418b202edfaa3b00e99da494e16cf50770ca17e
6
+ metadata.gz: ed5351903286ace5519c85f8751d26a33ce055b56b0c72e92cfbf8c38a81b4e93f83f35061299f8ee4a8831824f9904fe872b0f910f1a2c00f05b74699fefa09
7
+ data.tar.gz: 83232a832385d8abcfdca6c20b723df6f9e8d5c5516fbb418c943cdc145144d3c7fa042cfc5c929b07819ff43727ae7f585c15ee265f81ae0926cf6170559e48
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ share_some_love-*
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.0.5
4
+
5
+ * Search for authors and their info without github restrictions for
6
+ guests
7
+
8
+ ## 0.0.4
9
+
10
+ * Rewrited everything
11
+
12
+ ## 0.0.3
13
+
14
+ * You can say some similar words to people, who did gems for your site
15
+
16
+ ## 0.0.2
17
+
18
+ * You can have ugly and simple html file in your site's public folder)
19
+
3
20
  ## 0.0.1
4
21
 
5
22
  * Just to take a name of gem
data/Gemfile.lock CHANGED
@@ -1,11 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- share_some_love (0.0.1)
4
+ share_some_love (0.0.4)
5
+ bundler
6
+ octokit
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
11
+ addressable (2.3.4)
12
+ faraday (0.8.7)
13
+ multipart-post (~> 1.1)
14
+ faraday_middleware (0.9.0)
15
+ faraday (>= 0.7.4, < 0.9)
16
+ hashie (2.0.5)
17
+ multi_json (1.7.7)
18
+ multipart-post (1.2.0)
19
+ netrc (0.7.7)
20
+ octokit (1.24.0)
21
+ addressable (~> 2.2)
22
+ faraday (~> 0.8)
23
+ faraday_middleware (~> 0.9)
24
+ hashie (~> 2.0)
25
+ multi_json (~> 1.3)
26
+ netrc (~> 0.7.7)
9
27
 
10
28
  PLATFORMS
11
29
  ruby
data/LOVE.md ADDED
@@ -0,0 +1,183 @@
1
+ #### I'd like to thank all these people! Believe me - they are awesome!
2
+
3
+ *
4
+ ![Bob Aman](https://secure.gravatar.com/avatar/56ee28134dd0776825445e3551979b14?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
5
+ Follow on github: [@sporkmonger](http://github.com/sporkmonger)
6
+
7
+ Thank you so much **Bob Aman** for being so nice to create
8
+
9
+ **addressable**.
10
+
11
+ I wanna hug you someday and say in person what great job you done!
12
+ *
13
+ ![André Arko](https://secure.gravatar.com/avatar/4c3ed917e59156a36212d48155831482?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
14
+ Follow on github: [@indirect](http://github.com/indirect)
15
+
16
+ I appreciate time of **André Arko** for being so nice to create
17
+
18
+ **bundler**.
19
+
20
+ Enjoy what you did as I am!
21
+ *
22
+ ![Terence Lee](https://secure.gravatar.com/avatar/efb7c66871043330ce1310a9bdd0aaf6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
23
+ Follow on github: [@hone](http://github.com/hone)
24
+
25
+ My sincere thanks to **Terence Lee** for creating and maintaining
26
+
27
+ **bundler**.
28
+
29
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
30
+ *
31
+ ![Carl Lerche](https://secure.gravatar.com/avatar/da5274b27cc6c0f505495bf5d504575d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
32
+ Follow on github: [@carllerche](http://github.com/carllerche)
33
+
34
+ I appreciate time of **Carl Lerche** for made this idea happened, I mean
35
+
36
+ **bundler**.
37
+
38
+ Just be so cool as you are and remember that your work never being useless!
39
+ *
40
+ ![Yehuda Katz](https://secure.gravatar.com/avatar/428167a3ec72235ba971162924492609?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
41
+ Follow on github: [@wycats](http://github.com/wycats)
42
+
43
+ My sincere thanks to **Yehuda Katz** for spending time on
44
+
45
+ **bundler**.
46
+
47
+ Enjoy what you did as I am!
48
+ *
49
+ ![Nick Sieger](https://secure.gravatar.com/avatar/526d60de6472502bb570a9df2842b33b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
50
+ Follow on github: [@nicksieger](http://github.com/nicksieger)
51
+
52
+ Thank you very much **Nick Sieger** for spending time on
53
+
54
+ **multipart-post**.
55
+
56
+ I wanna hug you someday and say in person what great job you done!
57
+ *
58
+ Thank you very much **Rick Olson** for being so nice to create
59
+
60
+ **faraday**.
61
+
62
+ I wanna hug you someday and say in person what great job you done!
63
+ *
64
+ ![Erik Michaels-Ober](https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
65
+ Follow on github: [@sferik](http://github.com/sferik)
66
+
67
+ I appreciate time of **Erik Michaels-Ober** for creating and maintaining
68
+
69
+ **faraday_middleware**.
70
+
71
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
72
+ *
73
+ ![Wynn Netherland](https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
74
+ Follow on github: [@pengwynn](http://github.com/pengwynn)
75
+
76
+ My sincere thanks to **Wynn Netherland** for spending time on
77
+
78
+ **faraday_middleware**.
79
+
80
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
81
+ *
82
+ ![Michael Bleigh](https://secure.gravatar.com/avatar/69dc78b59ef008c58e6e842f9f3e0624?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
83
+ Follow on github: [@mbleigh](http://github.com/mbleigh)
84
+
85
+ Thank you very much **Michael Bleigh** for made this idea happened, I mean
86
+
87
+ **hashie**.
88
+
89
+ I wanna hug you someday and say in person what great job you done!
90
+ *
91
+ ![Jerry Cheung](https://secure.gravatar.com/avatar/acd4b5803e806bf0ed70299f15cd6d18?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
92
+ Follow on github: [@jch](http://github.com/jch)
93
+
94
+ I appreciate time of **Jerry Cheung** for made this idea happened, I mean
95
+
96
+ **hashie**.
97
+
98
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
99
+ *
100
+ ![Michael Bleigh](https://secure.gravatar.com/avatar/69dc78b59ef008c58e6e842f9f3e0624?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
101
+ Follow on github: [@mbleigh](http://github.com/mbleigh)
102
+
103
+ I'd like to thank **Michael Bleigh** for making my life easier by creating
104
+
105
+ **multi_json**.
106
+
107
+ Just be so cool as you are and remember that your work never being useless!
108
+ *
109
+ ![Josh Kalderimis](https://secure.gravatar.com/avatar/21b21efe14359ec323f9a70464b91e39?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
110
+ Follow on github: [@joshk](http://github.com/joshk)
111
+
112
+ My sincere thanks to **Josh Kalderimis** for spending time on
113
+
114
+ **multi_json**.
115
+
116
+ I wanna hug you someday and say in person what great job you done!
117
+ *
118
+ ![Erik Michaels-Ober](https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
119
+ Follow on github: [@sferik](http://github.com/sferik)
120
+
121
+ I appreciate time of **Erik Michaels-Ober** for creating and maintaining
122
+
123
+ **multi_json**.
124
+
125
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
126
+ *
127
+ ![Pavel Pravosud](https://secure.gravatar.com/avatar/df08a0889bad0229c372f702976a3da6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
128
+ Follow on github: [@rwz](http://github.com/rwz)
129
+
130
+ My sincere thanks to **Pavel Pravosud** for making my life easier by creating
131
+
132
+ **multi_json**.
133
+
134
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
135
+ *
136
+ I'd like to thank **Keith Rarick** for creating and maintaining
137
+
138
+ **netrc**.
139
+
140
+ Just be so cool as you are and remember that your work never being useless!
141
+ *
142
+ ![geemus (Wesley Beary)](https://secure.gravatar.com/avatar/e3191b55da8ada73c3e1ada98a63af6e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
143
+ Follow on github: [@geemus](http://github.com/geemus)
144
+
145
+ My sincere thanks to **geemus (Wesley Beary)** for spending time on
146
+
147
+ **netrc**.
148
+
149
+ I wanna hug you someday and say in person what great job you done!
150
+ *
151
+ ![Wynn Netherland](https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
152
+ Follow on github: [@pengwynn](http://github.com/pengwynn)
153
+
154
+ I'd like to thank **Wynn Netherland** for spending time on
155
+
156
+ **octokit**.
157
+
158
+ I wanna hug you someday and say in person what great job you done!
159
+ *
160
+ ![Erik Michaels-Ober](https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
161
+ Follow on github: [@sferik](http://github.com/sferik)
162
+
163
+ My sincere thanks to **Erik Michaels-Ober** for made this idea happened, I mean
164
+
165
+ **octokit**.
166
+
167
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
168
+ *
169
+ My sincere thanks to **Clint Shryock** for creating and maintaining
170
+
171
+ **octokit**.
172
+
173
+ Just be so cool as you are and remember that your work never being useless!
174
+ *
175
+ ![gazay](https://secure.gravatar.com/avatar/d52cc558a29696bb722492259f3f52de?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png)
176
+ Follow on github: [@gazay](http://github.com/gazay)
177
+
178
+ Thank you very much **gazay** for making my life easier by creating
179
+
180
+ **share_some_love**.
181
+
182
+ I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
183
+
@@ -0,0 +1 @@
1
+ <%= footer_content %>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= title %></title>
5
+ <%= styles %>
6
+ <%= javascripts %>
7
+ </head>
8
+ <body>
9
+ <%= thanks %>
10
+ <%= footer %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,2 @@
1
+ <script type='text/javascript'>
2
+ </script>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>
5
+ <%= title || 'Thank you all!' %>
6
+ </title>
7
+ <style>
8
+ body{margin:0;width:100%;height:100%} body,td,input,textarea,select{font-family:arial,sans-serif}
9
+ <%= style %>
10
+ </style>
11
+ <script type='text/javascript'>
12
+ </script>
13
+ </head>
14
+ <body>
15
+ <%= content %>
16
+ </body>
17
+ </html>
@@ -0,0 +1,2 @@
1
+ <style>
2
+ </style>
@@ -0,0 +1,4 @@
1
+ <%- if image.present? %>
2
+ ![<%= who %>](<%= image %>)
3
+ <%- end %>
4
+ <%= begin_thanking %><%= bold %><%= who %><%= bold %><%= finish_thanking %>
@@ -0,0 +1 @@
1
+ <%= footer_few_words %>
@@ -0,0 +1,10 @@
1
+ <%- if image.present? %>
2
+ ![<%= what %>](<%= image %>)
3
+ <%- end %>
4
+ <%= begin_desc %>
5
+ <%- if bold %>
6
+ **<%= what %>**
7
+ <%- else %>
8
+ <%= what %>
9
+ <%- end %>
10
+ <%= finish_desc %>
@@ -0,0 +1,2 @@
1
+ <%= head_title %>
2
+ <%= few_words %>
@@ -0,0 +1,11 @@
1
+ <%- if image.present? %>
2
+ ![<%= who %>](<%= image %>)
3
+ <%- end %>
4
+ <%= begin_thanking %>
5
+ <%- if bold %>
6
+ **<%= who %>**
7
+ <%- else %>
8
+ <%= who %>
9
+ <%- end %>
10
+ <%= for_what %>
11
+ <%= finish_thanking %>
data/bin/love ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ exec "share_some_love #{ARGV.join(' ')}"
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ love_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(love_dir) unless $LOAD_PATH.include?(love_dir)
5
+ require 'love'
6
+
7
+ Love.share_for ARGV
data/hearts/ascii1.txt ADDED
@@ -0,0 +1,23 @@
1
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2
+ < :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: >
3
+ < :::::::::::: :::::::::::: :::::::::::: >
4
+ < ::::::::: :::: ::::::::: >
5
+ < ::::::: ******** :: ******** ::::::: >
6
+ < ::::: **** **** **** **** ::::: >
7
+ < :::: **** **** **** :::: >
8
+ < ::: **** ** **** ::: >
9
+ < ::: **** **** ::: >
10
+ < :::: **** ***** :::: >
11
+ < ::::: **** Love u all guys and **** ::::: >
12
+ < ::::::: **** girls!!! **** ::::::: >
13
+ < ::::::::: **** **** ::::::::: >
14
+ < ::::::::::: **** **** ::::::::::: >
15
+ < :::::::::::::: **** **** :::::::::::::: >
16
+ < ::::::::::::::::: **** **** ::::::::::::::::: >
17
+ < :::::::::::::::::::: **** :::::::::::::::::::: >
18
+ < ::::::::::::::::::::::: ** ::::::::::::::::::::::: >
19
+ < ::::::::::::::::::::::::: ::::::::::::::::::::::::: >
20
+ < ::::::::::::::::::::::::::: ::::::::::::::::::::::::::: >
21
+ < ::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::: >
22
+ < :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: >
23
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
@@ -0,0 +1,43 @@
1
+ module Love
2
+ class Author
3
+
4
+ attr_reader :name, :info, :gems, :username
5
+
6
+ def initialize(name, fetch = true)
7
+ @name = name
8
+ @gems = []
9
+ fetch_info if fetch
10
+ end
11
+
12
+ def fetch_info
13
+ uri = ERB::Util.url_encode(name)
14
+ puts "search for #{name}"
15
+ begin
16
+ search_person = Love.octokit.search_users uri
17
+ @info = \
18
+ if search_person.count > 1
19
+ puts '!!! THERE ARE SEVERAL PERSONS WITH THIS NAME IN GITHUB !!!'
20
+ puts "Please check right man with his number and we'll continue"
21
+ search_person.each_with_index do |person, index|
22
+ puts "#{index} - name: #{person.name}; login: #{person.login}; username: #{person.username}"
23
+ end
24
+
25
+ user_num = $stdin.gets.chomp.to_i
26
+ Love.octokit.user search_person[user_num].login
27
+ else
28
+ Love.octokit.user search_person.first.login
29
+ end
30
+ puts "found #{@info.login}"
31
+ rescue Octokit::Forbidden
32
+ puts 'github have some unfair limits =('
33
+ rescue
34
+ puts 'not found'
35
+ end
36
+ end
37
+
38
+ def add_gem(gem)
39
+ @gems << gem
40
+ end
41
+
42
+ end
43
+ end
data/lib/love/gem.rb ADDED
@@ -0,0 +1,27 @@
1
+ module 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 = Love::Author.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
+ end
27
+ end
data/lib/love/share.rb ADDED
@@ -0,0 +1,41 @@
1
+ module Love
2
+ module Share
3
+ class << self
4
+
5
+ def md(by_gemname = false)
6
+ if by_gemname
7
+ render_by_gem Love.gems
8
+ else
9
+ render_by_author Love.authors
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def render_by_author(authors)
16
+ template = File.read(Love.root.join '../templates/md/by_author.md.erb')
17
+ author_template = File.read(Love.root.join '../templates/md/_author.md.erb')
18
+ content = ''
19
+ authors.each do |author|
20
+ content << ERB.new(author_template).result(binding)
21
+ end
22
+ File.open('./LOVE.md', 'w+') do |f|
23
+ f.write ERB.new(template).result(binding)
24
+ end
25
+ end
26
+
27
+ def render_by_gem(gems)
28
+ template = File.read(Love.root.join '../templates/md/by_gem.md.erb')
29
+ gem_template = File.read(Love.root.join '../templates/md/_gem.md.erb')
30
+ content = ''
31
+ gems.each do |gem|
32
+ content << ERB.new(gem_template).result(binding)
33
+ end
34
+ File.open('./LOVE.md', 'w+') do |f|
35
+ f.write ERB.new(template).result(binding)
36
+ end
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,51 @@
1
+ module Love
2
+ module ThankWords
3
+ class << self
4
+
5
+ def title_thanks
6
+ find_words('title_thanks')
7
+ end
8
+
9
+ def begin_author
10
+ find_words('begin_author')
11
+ end
12
+
13
+ def middle_author
14
+ find_words('middle_author')
15
+ end
16
+
17
+ def end_author
18
+ find_words('end_author')
19
+ end
20
+
21
+ def person_perfix
22
+ find_words('person_prefix')
23
+ end
24
+
25
+ def library_prefix
26
+ find_words('library_prefix')
27
+ end
28
+
29
+ def libraries_prefix
30
+ find_words('libraries_prefix')
31
+ end
32
+
33
+ def hearts
34
+ '<3' * rand(10)
35
+ end
36
+
37
+ private
38
+
39
+ def find_words(area)
40
+ fill_thank_words unless defined?(@thank_words)
41
+ @thank_words[area].to_a[rand(@thank_words[area].length)]
42
+ end
43
+
44
+ def fill_thank_words
45
+ @thank_words = \
46
+ YAML.load(File.read(Love.root.join "../thank_words/#{Love.lang}.yml"))
47
+ end
48
+
49
+ end
50
+ end
51
+ end
data/lib/love/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Love
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.5'
3
3
  end
data/lib/love.rb CHANGED
@@ -1,2 +1,67 @@
1
+ require 'bundler'
2
+ require 'octokit'
3
+ require 'pathname'
4
+ require 'erb'
5
+ require 'yaml'
6
+
1
7
  module Love
8
+ class << self
9
+
10
+ attr_reader :by_gemname, :for_site, :gems, :authors, :root, :lang, :octokit
11
+
12
+ def share_for(args)
13
+ by_gemname = args.include? 'by_gem'
14
+ for_site = args.include? 'site'
15
+
16
+ @by_gemname = by_gemname
17
+ @for_site = for_site
18
+ @root = Pathname(__FILE__).parent
19
+ @lang = 'en'
20
+ @gems = []
21
+ @authors = []
22
+
23
+ lets_start_from_heart!
24
+
25
+ login_user
26
+
27
+ parse_gemfile
28
+ share_love
29
+ end
30
+
31
+ def login_user
32
+ puts 'Please, enter your github credentials that Octokit could work without github guest requests restrictions'
33
+ puts 'login:'
34
+ login = $stdin.gets.chomp
35
+ puts 'password:'
36
+ pass = $stdin.gets.chomp
37
+ @octokit = Octokit::Client.new login: login, password: pass
38
+ end
39
+
40
+ def lets_start_from_heart!
41
+ puts File.read(Love.root.join '../hearts/ascii1.txt')
42
+ end
43
+
44
+ def parse_gemfile
45
+ Bundler.load.specs.each do |spec|
46
+ gem = Love::Gem.new(spec)
47
+ @gems << gem
48
+ @authors << gem.authors
49
+ end
50
+ @authors = @authors.flatten.uniq
51
+ end
52
+
53
+ def share_love
54
+ if for_site
55
+ Love::Site.create_file
56
+ else
57
+ Love::Share.md by_gemname
58
+ end
59
+ end
60
+
61
+ end
2
62
  end
63
+
64
+ require 'love/author'
65
+ require 'love/gem'
66
+ require 'love/thank_words'
67
+ require 'love/share'
@@ -14,6 +14,9 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "share_some_love"
16
16
 
17
+ s.add_dependency 'bundler'
18
+ s.add_dependency 'octokit'
19
+
17
20
  s.files = `git ls-files`.split("\n")
18
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -0,0 +1,14 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the build directory
11
+ /build
12
+
13
+ # Ignore Sass' cache
14
+ /.sass-cache
@@ -0,0 +1,9 @@
1
+ * <% if author.info %>
2
+ ![<%= author.name %>](<%= author.info.avatar_url %>)
3
+ Follow on github: [<%= "@#{author.info.login}" %>](http://github.com/<%= author.info.login %>)
4
+ <% end %>
5
+ <%= ThankWords.begin_author %> **<%= author.name %>** <%= ThankWords.middle_author %>
6
+
7
+ <%= author.gems.map(&:name).map { |it| "**#{it}**" }.join(', ') %>.
8
+
9
+ <%= ThankWords.end_author %>
@@ -0,0 +1,8 @@
1
+ * <% if gem.authors.all?(&:info) %>
2
+ <%= gem.authors.map { |a| "![#{a.name}](#{a.info.avatar_url})" }.join(' ') %>
3
+ <% end %>
4
+
5
+ <%= ThankWords.begin_author %> <%= gem.authors.map(&:name).map { |it| "**#{it}**" }.join(', ') %>
6
+ <%= ThankWords.middle_author %> **<%= gem.name %>**.
7
+
8
+ <%= ThankWords.end_author %>
@@ -0,0 +1,3 @@
1
+ #### <%= ThankWords.title_thanks %>
2
+
3
+ <%= content %>
@@ -0,0 +1,3 @@
1
+ #### <%= ThankWords.title_thanks %>
2
+
3
+ <%= content %>
@@ -0,0 +1,41 @@
1
+ title_thanks:
2
+ - Thank you all, guys and girls who made my life easier and help me to enjoy make my project more and more!
3
+ - I'd like to thank all these people! Believe me - they are awesome!
4
+ - Love to these people! And bunch of hugs!
5
+
6
+ begin_author:
7
+ - I'd like to thank
8
+ - I appreciate time of
9
+ - My sincere thanks to
10
+ - Thank you so much
11
+ - Thank you very much
12
+
13
+ middle_author:
14
+ - for creating and maintaining
15
+ - for made this idea happened, I mean
16
+ - for spending time on
17
+ - for making my life easier by creating
18
+ - for being so nice to create
19
+
20
+ end_author:
21
+ - I wanna hug you someday and say in person what great job you done!
22
+ - I wanna shake your hand and say that wihtout your work on it I would spent much more time and power!
23
+ - Just be so cool as you are and remember that your work never being useless!
24
+ - Enjoy what you did as I am!
25
+
26
+ person_prefix:
27
+ - my mate
28
+ - awesome person
29
+ - great developer
30
+ - awesome programmer
31
+
32
+ library_prefix:
33
+ - this helpful and useful gem
34
+ - awesome project
35
+ - cool thing
36
+ - helpful thing
37
+
38
+ libraries_prefix:
39
+ - these awesome and helpful gems
40
+ - a lot of great projects
41
+ - these awesome libraries
@@ -0,0 +1,53 @@
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
@@ -0,0 +1,23 @@
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
@@ -0,0 +1,60 @@
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
@@ -0,0 +1,29 @@
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
@@ -0,0 +1,35 @@
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
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,96 @@
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
@@ -0,0 +1,50 @@
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
@@ -0,0 +1,3 @@
1
+ class Love
2
+ VERSION = '0.0.3'
3
+ end
data/tmp/lib/love.rb ADDED
@@ -0,0 +1,39 @@
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
metadata CHANGED
@@ -1,33 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: share_some_love
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - gazay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-14 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: octokit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description: If you ever wander to say thank you to guys who did this great job on
14
42
  your gem or your project parts - it's really great opportunity
15
43
  email:
16
44
  - alex.gaziev@gmail.com
17
- executables: []
45
+ executables:
46
+ - love
47
+ - share_some_love
18
48
  extensions: []
19
49
  extra_rdoc_files: []
20
50
  files:
51
+ - .gitignore
21
52
  - CHANGELOG.md
22
53
  - Gemfile
23
54
  - Gemfile.lock
55
+ - LOVE.md
24
56
  - README.md
25
57
  - Rakefile
58
+ - _old_templates/html/footer.erb
59
+ - _old_templates/html/head.erb
60
+ - _old_templates/html/javascripts.erb
61
+ - _old_templates/html/simple.erb
62
+ - _old_templates/html/styles.erb
63
+ - _old_templates/md/contributor.erb
64
+ - _old_templates/md/footer.erb
65
+ - _old_templates/md/gem.erb
66
+ - _old_templates/md/head.erb
67
+ - _old_templates/md/user.erb
68
+ - bin/love
69
+ - bin/share_some_love
70
+ - hearts/ascii1.txt
26
71
  - lib/love.rb
72
+ - lib/love/author.rb
73
+ - lib/love/gem.rb
74
+ - lib/love/share.rb
75
+ - lib/love/thank_words.rb
27
76
  - lib/love/version.rb
28
- - lib/share_some_love.rb
29
77
  - share_some_love.gemspec
30
78
  - spec/spec_helper.rb
79
+ - templates/.gitignore
80
+ - templates/md/_author.md.erb
81
+ - templates/md/_gem.md.erb
82
+ - templates/md/by_author.md.erb
83
+ - templates/md/by_gem.md.erb
84
+ - thank_words/en.yml
85
+ - tmp/lib/love.rb
86
+ - tmp/lib/love/gem.rb
87
+ - tmp/lib/love/html_renderer.rb
88
+ - tmp/lib/love/person.rb
89
+ - tmp/lib/love/render.rb
90
+ - tmp/lib/love/render/overrides.rb
91
+ - tmp/lib/love/site.rb
92
+ - tmp/lib/love/thank_words.rb
93
+ - tmp/lib/love/thanks.rb
94
+ - tmp/lib/love/version.rb
31
95
  homepage: https://github.com/gazay/share_some_love
32
96
  licenses: []
33
97
  metadata: {}
@@ -53,3 +117,4 @@ specification_version: 4
53
117
  summary: I want you to share some love to OSS developers!
54
118
  test_files:
55
119
  - spec/spec_helper.rb
120
+ has_rdoc:
@@ -1 +0,0 @@
1
- require './love'