sweetie 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +30 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +16 -0
  5. data/Gemfile +3 -2
  6. data/README.md +224 -28
  7. data/Rakefile +3 -2
  8. data/lib/sweetie/bitbucket.rb +22 -197
  9. data/lib/sweetie/bitbucket_stati_helper.rb +247 -0
  10. data/lib/sweetie/conversion.rb +91 -62
  11. data/lib/sweetie/helper.rb +60 -51
  12. data/lib/sweetie/version.rb +2 -1
  13. data/lib/sweetie.rb +2 -2
  14. data/spec/fixtures/bitbucket/expected_repositories.txt +1 -0
  15. data/spec/fixtures/bitbucket/repositories.json +1 -0
  16. data/spec/fixtures/jekyll/_config.yml +4 -0
  17. data/spec/fixtures/jekyll/_config_repositories.yml +7 -0
  18. data/spec/fixtures/jekyll/_expected_config.yml +4 -0
  19. data/spec/{source → fixtures/jekyll}/site/404.html +0 -0
  20. data/spec/{source → fixtures/jekyll}/site/about.html +0 -0
  21. data/spec/{source → fixtures/jekyll}/site/archiv.html +0 -0
  22. data/spec/{source → fixtures/jekyll}/site/atom.xml +0 -0
  23. data/spec/{source → fixtures/jekyll}/site/colophon.html +0 -0
  24. data/spec/{source → fixtures/jekyll}/site/contact.html +0 -0
  25. data/spec/{source → fixtures/jekyll}/site/follow.html +0 -0
  26. data/spec/{source → fixtures/jekyll}/site/images/2_avatars.gif +0 -0
  27. data/spec/{source → fixtures/jekyll}/site/images/favicon.png +0 -0
  28. data/spec/{source → fixtures/jekyll}/site/images/images-global/matthias_guenther.jpg +0 -0
  29. data/spec/{source → fixtures/jekyll}/site/images/images-global/matthias_guenther_thumbnail_normal.jpg +0 -0
  30. data/spec/{source → fixtures/jekyll}/site/images/images-global/matthias_guenther_thumbnail_small.jpg +0 -0
  31. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/closebox.png +0 -0
  32. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-caption-fill.png +0 -0
  33. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-caption-l.png +0 -0
  34. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-caption-r.png +0 -0
  35. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow1.png +0 -0
  36. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow2.png +0 -0
  37. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow3.png +0 -0
  38. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow4.png +0 -0
  39. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow5.png +0 -0
  40. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow6.png +0 -0
  41. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow7.png +0 -0
  42. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-shadow8.png +0 -0
  43. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-1.png +0 -0
  44. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-10.png +0 -0
  45. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-11.png +0 -0
  46. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-12.png +0 -0
  47. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-2.png +0 -0
  48. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-3.png +0 -0
  49. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-4.png +0 -0
  50. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-5.png +0 -0
  51. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-6.png +0 -0
  52. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-7.png +0 -0
  53. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-8.png +0 -0
  54. data/spec/{source → fixtures/jekyll}/site/images/images-global/zoom/zoom-spin-9.png +0 -0
  55. data/spec/{source → fixtures/jekyll}/site/images/rails3.jpg +0 -0
  56. data/spec/{source → fixtures/jekyll}/site/index.html +0 -0
  57. data/spec/{source → fixtures/jekyll}/site/robots.txt +0 -0
  58. data/spec/{source → fixtures/jekyll}/site/sitemap.xml +0 -0
  59. data/spec/{source → fixtures/jekyll}/site/why-i-use-jekyll-for-blogging.html +0 -0
  60. data/spec/fixtures/middleman/build/2012-01-meetup/index.html +238 -0
  61. data/spec/fixtures/middleman/build/2012-03-meetup/index.html +217 -0
  62. data/spec/fixtures/middleman/build/2012-05-meetup/index.html +214 -0
  63. data/spec/fixtures/middleman/build/2012-07-meetup/index.html +210 -0
  64. data/spec/fixtures/middleman/build/2012-08-workshop/index.html +228 -0
  65. data/spec/fixtures/middleman/build/2012-09-meetup/index.html +231 -0
  66. data/spec/fixtures/middleman/build/2012-10-workshop/index.html +227 -0
  67. data/spec/fixtures/middleman/build/2012-11-meetup/index.html +229 -0
  68. data/spec/fixtures/middleman/build/2012-unusual-december-meetup/index.html +186 -0
  69. data/spec/fixtures/middleman/build/2013-01-meetup/index.html +226 -0
  70. data/spec/fixtures/middleman/build/404/index.html +157 -0
  71. data/spec/fixtures/middleman/build/CNAME +1 -0
  72. data/spec/fixtures/middleman/build/april-2014-meetup/index.html +221 -0
  73. data/spec/fixtures/middleman/build/april-2015-meetup/index.html +204 -0
  74. data/spec/fixtures/middleman/build/april-2017-meetup/index.html +210 -0
  75. data/spec/fixtures/middleman/build/assets/favicons/android-chrome-144x144.png +0 -0
  76. data/spec/fixtures/middleman/build/assets/favicons/android-chrome-192x192.png +0 -0
  77. data/spec/fixtures/middleman/build/assets/favicons/android-chrome-36x36.png +0 -0
  78. data/spec/fixtures/middleman/build/assets/favicons/android-chrome-48x48.png +0 -0
  79. data/spec/fixtures/middleman/build/assets/favicons/android-chrome-72x72.png +0 -0
  80. data/spec/fixtures/middleman/build/assets/favicons/android-chrome-96x96.png +0 -0
  81. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-114x114.png +0 -0
  82. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-120x120.png +0 -0
  83. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-144x144.png +0 -0
  84. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-152x152.png +0 -0
  85. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-180x180.png +0 -0
  86. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-57x57.png +0 -0
  87. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-60x60.png +0 -0
  88. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-72x72.png +0 -0
  89. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-76x76.png +0 -0
  90. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon-precomposed.png +0 -0
  91. data/spec/fixtures/middleman/build/assets/favicons/apple-touch-icon.png +0 -0
  92. data/spec/fixtures/middleman/build/assets/favicons/browserconfig.xml +12 -0
  93. data/spec/fixtures/middleman/build/assets/favicons/favicon-16x16.png +0 -0
  94. data/spec/fixtures/middleman/build/assets/favicons/favicon-32x32.png +0 -0
  95. data/spec/fixtures/middleman/build/assets/favicons/favicon-96x96.png +0 -0
  96. data/spec/fixtures/middleman/build/assets/favicons/favicon.ico +0 -0
  97. data/spec/fixtures/middleman/build/assets/favicons/manifest.json +41 -0
  98. data/spec/fixtures/middleman/build/assets/favicons/mstile-144x144.png +0 -0
  99. data/spec/fixtures/middleman/build/assets/favicons/mstile-150x150.png +0 -0
  100. data/spec/fixtures/middleman/build/assets/favicons/mstile-310x150.png +0 -0
  101. data/spec/fixtures/middleman/build/assets/favicons/mstile-310x310.png +0 -0
  102. data/spec/fixtures/middleman/build/assets/favicons/mstile-70x70.png +0 -0
  103. data/spec/fixtures/middleman/build/assets/favicons/safari-pinned-tab.svg +450 -0
  104. data/spec/fixtures/middleman/build/assets/images/launch_co_logo.png +0 -0
  105. data/spec/fixtures/middleman/build/assets/images/vimfest.png +0 -0
  106. data/spec/fixtures/middleman/build/assets/javascripts/application.js +12 -0
  107. data/spec/fixtures/middleman/build/assets/javascripts/jquery.utils.js +12 -0
  108. data/spec/fixtures/middleman/build/assets/javascripts/lib/validate.js +1 -0
  109. data/spec/fixtures/middleman/build/assets/stylesheets/application.css +5 -0
  110. data/spec/fixtures/middleman/build/assets/stylesheets/vendor/bootstrap.css +5 -0
  111. data/spec/fixtures/middleman/build/august-2013-meetup/index.html +208 -0
  112. data/spec/fixtures/middleman/build/blog/index.html +500 -0
  113. data/spec/fixtures/middleman/build/book-club-about-the-viml-primer/index.html +182 -0
  114. data/spec/fixtures/middleman/build/contact/index.html +155 -0
  115. data/spec/fixtures/middleman/build/data/vimberlin-2013-09_ctags/index.html +98 -0
  116. data/spec/fixtures/middleman/build/data/vimberlin-2013-09_vimprofiling/index.html +157 -0
  117. data/spec/fixtures/middleman/build/data/vimberlin-2014-01_vim_writing/index.html +70 -0
  118. data/spec/fixtures/middleman/build/december-2015-meetup/index.html +199 -0
  119. data/spec/fixtures/middleman/build/december-2016-meetup/index.html +224 -0
  120. data/spec/fixtures/middleman/build/february-2013-vim-beer-lin/index.html +190 -0
  121. data/spec/fixtures/middleman/build/february-2015-meetup/index.html +233 -0
  122. data/spec/fixtures/middleman/build/february-2016-meetup/index.html +271 -0
  123. data/spec/fixtures/middleman/build/feed.xml +2106 -0
  124. data/spec/fixtures/middleman/build/fonts/FontAwesome.otf +0 -0
  125. data/spec/fixtures/middleman/build/fonts/fontawesome-webfont.eot +0 -0
  126. data/spec/fixtures/middleman/build/fonts/fontawesome-webfont.svg +655 -0
  127. data/spec/fixtures/middleman/build/fonts/fontawesome-webfont.ttf +0 -0
  128. data/spec/fixtures/middleman/build/fonts/fontawesome-webfont.woff +0 -0
  129. data/spec/fixtures/middleman/build/fonts/fontawesome-webfont.woff2 +0 -0
  130. data/spec/fixtures/middleman/build/humans.txt +12 -0
  131. data/spec/fixtures/middleman/build/imprint/index.html +177 -0
  132. data/spec/fixtures/middleman/build/index.html +157 -0
  133. data/spec/fixtures/middleman/build/january-2014-meetup/index.html +257 -0
  134. data/spec/fixtures/middleman/build/january-2015-meetup/index.html +243 -0
  135. data/spec/fixtures/middleman/build/january-2016-meetup/index.html +202 -0
  136. data/spec/fixtures/middleman/build/january-2017-meetup/index.html +228 -0
  137. data/spec/fixtures/middleman/build/july-2015-meetup/index.html +207 -0
  138. data/spec/fixtures/middleman/build/june-2016-meetup/index.html +260 -0
  139. data/spec/fixtures/middleman/build/march-2-2017-meetup/index.html +201 -0
  140. data/spec/fixtures/middleman/build/march-2014-meetup/index.html +219 -0
  141. data/spec/fixtures/middleman/build/march-2016-meetup/index.html +221 -0
  142. data/spec/fixtures/middleman/build/march-2017-meetup/index.html +222 -0
  143. data/spec/fixtures/middleman/build/may-2013-meetup/index.html +234 -0
  144. data/spec/fixtures/middleman/build/may-2014-meetup/index.html +198 -0
  145. data/spec/fixtures/middleman/build/may-2015-meetup/index.html +202 -0
  146. data/spec/fixtures/middleman/build/may-2016-meetup/index.html +245 -0
  147. data/spec/fixtures/middleman/build/newsletter/index.html +171 -0
  148. data/spec/fixtures/middleman/build/november-2013-meetup/index.html +199 -0
  149. data/spec/fixtures/middleman/build/november-2015-meetup/index.html +402 -0
  150. data/spec/fixtures/middleman/build/november-2016-meetup/index.html +224 -0
  151. data/spec/fixtures/middleman/build/october-2013-meetup/index.html +210 -0
  152. data/spec/fixtures/middleman/build/october-2014-meetup/index.html +196 -0
  153. data/spec/fixtures/middleman/build/october-2016-meetup/index.html +222 -0
  154. data/spec/fixtures/middleman/build/robots.txt +6 -0
  155. data/spec/fixtures/middleman/build/september-2013-meetup/index.html +225 -0
  156. data/spec/fixtures/middleman/build/september-2014-meetup/index.html +211 -0
  157. data/spec/fixtures/middleman/build/sitemap.xml +297 -0
  158. data/spec/fixtures/middleman/build/vimfest-october-2015/index.html +303 -0
  159. data/spec/fixtures/middleman/config.rb +4 -0
  160. data/spec/fixtures/middleman/config_repositories.rb +7 -0
  161. data/spec/fixtures/middleman/expected_config.rb +4 -0
  162. data/spec/spec_helper.rb +2 -2
  163. data/spec/sweetie_bitbucket_spec.rb +26 -51
  164. data/spec/sweetie_bitbucket_stati_helper_spec.rb +124 -0
  165. data/spec/sweetie_conversion_spec.rb +105 -17
  166. data/spec/sweetie_helper_spec.rb +140 -0
  167. data/sweetie.gemspec +10 -9
  168. metadata +163 -56
  169. data/.travis.yml +0 -7
  170. data/spec/source/_config.yml +0 -18
  171. data/spec/source/bitbucket/user_repositories.json +0 -161
  172. data/spec/source/bitbucket/user_repositories_expectation.txt +0 -1
@@ -0,0 +1,247 @@
1
+ require 'sweetie/helper'
2
+ require 'json'
3
+
4
+ module Sweetie
5
+ # The class which do the actuall work to get and write the repositories updates in the config file
6
+ class BitbucketStatiHelper
7
+ include Sweetie::Helper
8
+
9
+
10
+ attr_writer :config, :user
11
+
12
+ # A basic initialize method.
13
+ #
14
+ # @param config [String] The config file in which the changes should be written
15
+ # @param user [String] The name of the user for which the updates should be fetched
16
+ # @return [nil]
17
+ def initialize(config = '_config.yml', user = '')
18
+ @config = config
19
+ @user = user
20
+ end
21
+
22
+ # Grab for each repository the recent update
23
+ #
24
+ # @param json_repositories [String]: A json object of the bitbucket API response
25
+ # @return [Hash] Returns a hash of the form {<repository_name> => <last_updated>}
26
+ #
27
+ # Example:
28
+ #
29
+ # get_repositories_changes(wikimatze_json)
30
+ # # => {"pmwiki-headlineimage-recipe"=>"2011-10-29", "pmwiki-linkicons-recipe"=>"2011-10-29"}
31
+ #
32
+ def get_repositories_changes(json_repositories)
33
+ repository_hash = parse_json(json_repositories)
34
+ repositories_changsets = {}
35
+
36
+ repository_hash['values'].each do |repository|
37
+ repository_name = repository['name']
38
+ repository_last_updated = parse_timestamp(repository['updated_on'])
39
+ repositories_changsets.merge!(repository_name => repository_last_updated)
40
+ end
41
+
42
+ repositories_changsets
43
+ end
44
+
45
+ # Wrapper for calling the json_parsing from JSON library
46
+ #
47
+ # @param json [String]: A JSON format from the bitbucket API response
48
+ # @return Returns Parse JSON file as a hash 2017-06-18
49
+ #
50
+ # Example:
51
+ #
52
+ # json = {
53
+ # "user": {
54
+ # "username": "wikimatze",
55
+ # "first_name": "Matthias",
56
+ # "last_name": "Guenther",
57
+ # "resource_uri": "/1.0/users/wikimatze"
58
+ # }
59
+ # }
60
+ # parse_json(json)
61
+ # => {"user"=>{"username"=>"wikimatze", "first_name"=>"Matthias", "last_name"=>"Guenther", "resource_uri"=>"/1.0/users/wikimatze"}}
62
+ #
63
+ def parse_json(json)
64
+ JSON.parse(json)
65
+ end
66
+
67
+ # Parse a hash and write its key/value pairs in a config file for jekyll and middleman projects
68
+ #
69
+ # @param repositories [Hash]- A hash in the form {<name> => <last_updated}
70
+ # @return [nil] Writes the of the repository hash specified _config.yml by the given @config variable
71
+ #
72
+ # Example:
73
+ #
74
+ # write_repository_changes({"svn" => "2011-10-26", "pmwiki" => "2011-10-26"})
75
+ # # => svn: 2011-10-26\npmwiki: 2011-10-26
76
+ def write_repository_changes(repositories)
77
+ repositories.each do |name, last_updated|
78
+ file = File.open(@config)
79
+ text = ''
80
+ project = 'middleman'
81
+
82
+ project = 'jekyll' if File.extname(file) =~ /.yml/
83
+
84
+ name = name.to_s.tr('-', '_')
85
+ while line = file.gets
86
+ text << if line =~ /#{name}/ && project == 'middleman'
87
+ entry_text_middleman(name, last_updated) + "\n"
88
+ elsif line =~ /#{name}/ && project == 'jekyll'
89
+ entry_text_jekyll(name, last_updated) + "\n"
90
+ else
91
+ line
92
+ end
93
+ end
94
+
95
+ file.close
96
+ write_config(@config, text)
97
+ end
98
+ end
99
+
100
+ # Parse a timestamp
101
+ #
102
+ # @param timestamp [String] A string in the form 2011-04-20 11:31:39
103
+ # @return [String] A string in the format "yyyy-mm-dd"
104
+ #
105
+ # Example:
106
+ #
107
+ # parse_timestamp("2011-04-20 11:31:39")
108
+ # # => 2011-04-20
109
+ #
110
+ def parse_timestamp(timestamp)
111
+ regex = Regexp.new(/(\d+)-(\d+)-(\d+)/)
112
+ regex.match(timestamp)[0]
113
+ end
114
+
115
+ # Create a string representation of a repository entry in middleman style
116
+ #
117
+ # @param name [String] A string containing the name of the repository
118
+ # @param updated [String] A string containing the date of the last change of the repo
119
+ # @return [String] Return a string in the form "set :<name> :<last_updated>"
120
+ #
121
+ # Example:
122
+ #
123
+ # entry_text_middleman({"pmwiki" => "2011-10-26"}
124
+ # # => "set :pmwiki 2011-10-26"
125
+ def entry_text_middleman(name, updated)
126
+ "set :#{name}, #{updated}"
127
+ end
128
+
129
+ # Create a string representation of a repository entry in jekyll style
130
+ #
131
+ # @param name [String] A string containing the name of the repository
132
+ # @param updated [String] A string containing the date of the last change of the repo
133
+ # @return [String] Return a string in the form "set :<name> :<last_updated>"
134
+ #
135
+ # Example:
136
+ #
137
+ # entry_text_middleman({"pmwiki" => "2011-10-26"}
138
+ # # => "pmwiki: 2011-10-26"
139
+ def entry_text_jekyll(name, updated)
140
+ "#{name}: #{updated}"
141
+ end
142
+
143
+ # Fire up curl request to bitbucket
144
+ #
145
+ # Example:
146
+ #
147
+ # bitbucket('wikimatze')
148
+ #
149
+ # # =>
150
+ # {
151
+ # "pagelen":10,
152
+ # "values":[
153
+ # {
154
+ # "scm":"git",
155
+ # "website":"",
156
+ # "has_wiki":false,
157
+ # "name":"pmwiki-linkicons-recipe",
158
+ # "links":{
159
+ # "watchers":{
160
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/watchers"
161
+ # },
162
+ # "branches":{
163
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/refs/branches"
164
+ # },
165
+ # "tags":{
166
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/refs/tags"
167
+ # },
168
+ # "commits":{
169
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/commits"
170
+ # },
171
+ # "clone":[
172
+ # {
173
+ # "href":"https://bitbucket.org/wikimatze/pmwiki-linkicons-recipe.git",
174
+ # "name":"https"
175
+ # },
176
+ # {
177
+ # "href":"ssh://git@bitbucket.org/wikimatze/pmwiki-linkicons-recipe.git",
178
+ # "name":"ssh"
179
+ # }
180
+ # ],
181
+ # "self":{
182
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe"
183
+ # },
184
+ # "html":{
185
+ # "href":"https://bitbucket.org/wikimatze/pmwiki-linkicons-recipe"
186
+ # },
187
+ # "avatar":{
188
+ # "href":"https://bitbucket.org/wikimatze/pmwiki-linkicons-recipe/avatar/32/"
189
+ # },
190
+ # "hooks":{
191
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/hooks"
192
+ # },
193
+ # "forks":{
194
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/forks"
195
+ # },
196
+ # "downloads":{
197
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/downloads"
198
+ # },
199
+ # "pullrequests":{
200
+ # "href":"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/pullrequests"
201
+ # }
202
+ # },
203
+ # "fork_policy":"allow_forks",
204
+ # "uuid":"{182b19dc-334d-40d7-a65d-a85aaeb46f31}",
205
+ # "language":"",
206
+ # "created_on":"2011-10-07T21:01:39.266805+00:00",
207
+ # "mainbranch":{
208
+ # "type":"branch",
209
+ # "name":"master"
210
+ # },
211
+ # "full_name":"wikimatze/pmwiki-linkicons-recipe",
212
+ # "has_issues":false,
213
+ # "owner":{
214
+ # "username":"wikimatze",
215
+ # "display_name":"Matthias Günther",
216
+ # "type":"user",
217
+ # "uuid":"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}",
218
+ # "links":{
219
+ # "self":{
220
+ # "href":"https://api.bitbucket.org/2.0/users/wikimatze"
221
+ # },
222
+ # "html":{
223
+ # "href":"https://bitbucket.org/wikimatze/"
224
+ # },
225
+ # "avatar":{
226
+ # "href":"https://bitbucket.org/account/wikimatze/avatar/32/"
227
+ # }
228
+ # }
229
+ # },
230
+ # "updated_on":"2017-02-26T07:09:52.048642+00:00",
231
+ # "size":431470,
232
+ # "type":"repository",
233
+ # "slug":"pmwiki-linkicons-recipe",
234
+ # "is_private":false,
235
+ # "description":""
236
+ # },
237
+ # ...
238
+ # ],
239
+ # "page":1,
240
+ # "size":9
241
+ # }
242
+ def get_repositories
243
+ `curl -s https://api.bitbucket.org/2.0/repositories/#{@user}/`
244
+ end
245
+ end
246
+ end
247
+
@@ -2,81 +2,110 @@ require 'nokogiri'
2
2
  require 'sweetie/helper'
3
3
 
4
4
  module Sweetie
5
+ # The class which can get the stati of the project including number of html pages, images, and links
5
6
  class Conversion
6
- class << self
7
+ include Sweetie::Helper
7
8
 
8
- @@config = "_config.yml"
9
- @@dir = "_site"
10
-
11
- include Sweetie::Helper
9
+ # A basic initialize method.
10
+ #
11
+ # @param dir [String] The directoy in which should search after links, images and number of HTML pages
12
+ # @param config [String] The name of the config file in which the results should be written
13
+ # @return [nil]
14
+ def initialize(dir = '_site', config = '_config.yml')
15
+ @dir = dir
16
+ @config = config
17
+ end
12
18
 
13
- # Opens the config file and search after the specified parameters.
14
- # It saves the gathered information about the build-date, the links,
15
- # the images, and the number of html-pages in the jekyll project.
16
- def conversion
17
- check_config_and_directory_file(@@config, @@dir)
19
+ # It saves the gathered information about the build-date, the links,
20
+ # the images, and the number of html-pages in the jekyll project.
21
+ #
22
+ # @return [nil]
23
+ def create_stati
24
+ check_directory_and_config_file(@dir, @config)
18
25
 
19
- file = File.open(@@config)
20
- text = ""
26
+ file = File.open(@config)
27
+ text = ''
28
+ if File.extname(file) =~ /.rb/
21
29
  while line = file.gets
22
- if line.match(/build:/)
23
- text << "build: #{build_time}\n"
24
- elsif line.match(/htmlpages:/)
25
- text << "htmlpages: #{count_all_html_pages(@@dir)}\n"
26
- elsif line.match(/images:/)
27
- text << "images: #{count_all_images(@@dir)}\n"
28
- elsif line.match(/links:/)
29
- text << "links: #{count_all_links(@@dir)}\n"
30
- else
31
- text << line
32
- end
30
+ text << if line =~ /set :build,/
31
+ "set :build, '#{build_time}'\n"
32
+ elsif line =~ /set :htmlpages,/
33
+ "set :htmlpages, #{count_all_html_pages(@dir)}\n"
34
+ elsif line =~ /set :images,/
35
+ "set :images, #{count_all_images(@dir)}\n"
36
+ elsif line =~ /set :links,/
37
+ "set :links, #{count_all_links(@dir)}\n"
38
+ else
39
+ line
40
+ end
41
+ end
42
+ else
43
+ while line = file.gets
44
+ text << if line =~ /build:/
45
+ "build: '#{build_time}'\n"
46
+ elsif line =~ /htmlpages:/
47
+ "htmlpages: #{count_all_html_pages(@dir)}\n"
48
+ elsif line =~ /images:/
49
+ "images: #{count_all_images(@dir)}\n"
50
+ elsif line =~ /links:/
51
+ "links: #{count_all_links(@dir)}\n"
52
+ else
53
+ line
54
+ end
33
55
  end
34
- file.close
35
-
36
- write_config(file, text)
37
56
  end
38
57
 
39
- # Counts the link of on html page
40
- # @param [page] the path of a html page
41
- # @return the number of unique links
42
- def count_link_of_one_page(page)
43
- perform_search_for_single_page('//a', [], page)
44
- end
58
+ file.close
45
59
 
46
- # Count the images of one html page
47
- # @param (see #self.count_link_of_one_page)
48
- # @return the number of unique images
49
- def count_images_of_one_page(page)
50
- perform_search_for_single_page('//img', [], page)
51
- end
60
+ write_config(file, text)
61
+ end
52
62
 
53
- # Counts all html pages
54
- # @param [Dir] the path of the directory
55
- # @return [Fixnum] the number of unique html pages
56
- def count_all_html_pages(dir)
57
- perform_global_search('//html', [], dir)
58
- end
63
+ # Counts the link of on html page.
64
+ #
65
+ # @param page [String] The path of a html page
66
+ # @return [Integer] The number of unique links for the given page
67
+ def count_link_of_one_page(page)
68
+ perform_search_for_single_page('//a', [], page)
69
+ end
59
70
 
60
- # Counts all the links of all html pages
61
- # @param (see #self.count_all_html_pages)
62
- # @return (see #self.count_all_html_pages)
63
- def count_all_links(dir)
64
- perform_global_search('//a', [], dir)
65
- end
71
+ # Count the images of one html page.
72
+ #
73
+ # @param page [String] The path of a html page
74
+ # @return [Integer] The number of unique images for the given page
75
+ def count_images_of_one_page(page)
76
+ perform_search_for_single_page('//img', [], page)
77
+ end
66
78
 
67
- # Counts all the images of all html pages
68
- # @param (see #self.count_all_html_pages)
69
- # @return (see #self.count_all_html_pages)
70
- def count_all_images(dir)
71
- perform_global_search('//img', [], dir)
72
- end
79
+ # Counts all html pages for the given directory.
80
+ #
81
+ # @param dir [String] The path of the directory
82
+ # @return [Integer] The number of unique html pages
83
+ def count_all_html_pages(dir)
84
+ perform_global_search('//html', [], dir)
85
+ end
73
86
 
74
- # Create the actual build time
75
- # @return [String] in the date format mm-dd-yyyy
76
- def build_time
77
- time = Time.now
78
- "#{time.month}-#{time.day}-#{time.year}"
79
- end
87
+ # Counts all the links for the given directory.
88
+ #
89
+ # @param dir [String] The path of the directory
90
+ # @return [Integer] The number of unique links for the given dir
91
+ def count_all_links(dir)
92
+ perform_global_search('//a', [], dir)
93
+ end
94
+
95
+ # Counts all the images for the given directory.
96
+ #
97
+ # @param dir [String] The path of the directory
98
+ # @return [Integer] The number of all images for the given dir
99
+ def count_all_images(dir)
100
+ perform_global_search('//img', [], dir)
101
+ end
102
+
103
+ # Create the actual build time.
104
+ #
105
+ # @return [String] in the date format mm-dd-yyyy
106
+ def build_time
107
+ time = Time.now
108
+ "#{time.month}-#{time.day}-#{time.year}"
80
109
  end
81
110
  end
82
111
  end
@@ -1,66 +1,74 @@
1
1
  module Sweetie
2
+ # The Helper module which can get the stati of the project including number of html pages, images, and links
2
3
  module Helper
3
4
  # Traverse the page after the pattern and return the number of occurences on it
4
- # @param [pattern] need for nokogiri to parse the html page
5
- # @param [array] array to save the results
6
- # @param [page] a single page which will be taken for the search
7
- def perform_search_for_single_page(pattern, array, page)
8
- harvest(pattern, page, array)
9
- output_count(array)
10
- end
11
-
12
- # Traverse the dir after the pattern and return the number of occurences in the pages
13
- # @param [pattern] need for nokogiri to parse the html page
14
- # @param [array] array to save the results
15
- # @param [dir] the main directory in which the by jekyll generated files are stored
16
- def perform_global_search(pattern, array, dir)
17
- traverse(pattern, array, dir)
18
- output_count(array)
19
- end
20
-
21
- # Traverse the jekyll directory and get the information about a specific pattern
22
- # @param [pattern] is a string for nokogiri after which the html pages should be parsed
23
- # @param [ar] is an empty Array which is used by the harvest method
24
- # @param [dir] the directory in which the html files are stored
25
- def traverse(pattern, ar, dir)
26
- Dir.glob(dir+"/**/*") do |file|
27
- next if file == '.' or file == '..' or file.include?("html~")
28
- if file.match(/(.*).html/)
29
- harvest(pattern, file, ar)
30
- end
31
- end
5
+ #
6
+ # @param pattern [String] need for nokogiri to parse the html page
7
+ # @param arr [Array] array to save the results
8
+ # @param page [String] The path to a file which will be taken for the search
9
+ def perform_search_for_single_page(pattern, arr, page)
10
+ harvest(pattern, page, arr)
11
+ output_count(arr)
32
12
  end
33
13
 
34
14
  # Traverse each html page and gather information about the specified html element
35
- # @param [pattern] important for nokogiri
36
- # @param [html] the path for the html file
37
- # @param [ar] and array which stores all the findings produces by nokogiri
38
- def harvest(pattern, html, ar)
15
+ #
16
+ # @param pattern [String] The xpath regular for Nokogiri expressions after which the HTML is grabbed
17
+ # @param html [String] An array to save the results
18
+ # @param arr [Array] An array which stores all the findings produces by nokogiri
19
+ # @return [Array] The number of found results
20
+ def harvest(pattern, html, arr)
39
21
  file = File.open(html)
40
22
  doc = Nokogiri::HTML(file)
41
23
  doc.xpath(pattern).each do |node|
42
- if pattern == "//a"
43
- ar << node.text
44
- elsif pattern == "//img" and ar.include?(node.to_s)
45
- elsif pattern == "//img"
46
- ar << node.to_s
47
- elsif pattern == "//html"
48
- ar << node
49
- else
24
+ if pattern == '//a'
25
+ arr << node.text
26
+ elsif pattern == '//img' && arr.include?(node.to_s)
27
+ elsif pattern == '//img'
28
+ arr << node.to_s
29
+ elsif pattern == '//html'
30
+ arr << node
50
31
  end
51
32
  end
52
- ar
33
+ arr
53
34
  end
54
35
 
55
36
  # Count the elements
56
- # @param [ar] is an array with all the found html parts
57
- def output_count(ar)
58
- ar.uniq.count # remove duplicates with uniq
37
+ #
38
+ # @param arr [Array] An array with all the found html parts.
39
+ # @return [Integer] The number of uniq results in the given array.
40
+ def output_count(arr)
41
+ arr.uniq.count # remove duplicates with uniq
42
+ end
43
+
44
+ # Traverse the dir after the pattern and return the number of occurences in the pages
45
+ #
46
+ # @param pattern [String] The xpath regular for Nokogiri expressions after which the HTML is grabbed.
47
+ # @param arr [Array] array to save the results.
48
+ # @param dir [String] The main directory in which the search should be performed.
49
+ # @return [Integer] The number of found results.
50
+ def perform_global_search(pattern, arr, dir)
51
+ traverse(pattern, arr, dir)
52
+ output_count(arr)
53
+ end
54
+
55
+ # Traverse the jekyll directory and get the information about a specific pattern
56
+ #
57
+ # @param pattern [String] The xpath regular for Nokogiri expressions after which the HTML is grabbed.
58
+ # @param arr [Array] array to save the results.
59
+ # @param dir [String] The directory in which the html files are stored.
60
+ def traverse(pattern, arr, dir)
61
+ Dir.glob(dir + '/**/*') do |file|
62
+ next if file == '.' || file == '..' || file.include?('html~')
63
+ harvest(pattern, file, arr) if file =~ /(.*).html/
64
+ end
59
65
  end
60
66
 
61
67
  # Write in the file the text
62
- # @param [file] is the _config.yml file of the jekyll project
63
- # @param [text] is a multiline string which will be written in the file
68
+ #
69
+ # @param file [String] The path to the config file
70
+ # @param text [String] Is a multiline string of text
71
+ # @return [nil]
64
72
  def write_config(file, text)
65
73
  File.open(file, 'w') do |file|
66
74
  file.puts text
@@ -68,11 +76,12 @@ module Sweetie
68
76
  end
69
77
  end
70
78
 
71
- # Check the existence of needed files for sweetie
72
- # @param [config] the _config.yml file
73
- # @param [dir] the directory of the generated jekyll page
74
- def check_config_and_directory_file(config, dir)
75
- if !File.exist? config or !Dir.exist? dir
79
+ # Check the existence of given directory and config
80
+ #
81
+ # @param dir [String] The directory of the files.
82
+ # @param config [String] The path to the config file.
83
+ def check_directory_and_config_file(dir = '', config = '')
84
+ if !Dir.exist?(dir) || !File.exist?(config)
76
85
  raise "Can't find the _config.yml or the _site directory! Please create these files it!"
77
86
  end
78
87
  end
@@ -1,4 +1,5 @@
1
1
  module Sweetie
2
- VERSION = "1.0.2"
2
+ # A wrapper to current sweetie gem version
3
+ VERSION = '2.0.0'.freeze
3
4
  end
4
5
 
data/lib/sweetie.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'sweetie/conversion'
2
2
  require 'sweetie/bitbucket'
3
3
 
4
- module Sweetie
4
+ # The wrapper class for the gem
5
+ module Sweetie; end
5
6
 
6
- end
@@ -0,0 +1 @@
1
+ {"pagelen"=>10, "values"=>[{"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"pmwiki-linkicons-recipe", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/pmwiki-linkicons-recipe.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/pmwiki-linkicons-recipe.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-linkicons-recipe"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-linkicons-recipe/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-linkicons-recipe/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{182b19dc-334d-40d7-a65d-a85aaeb46f31}", "language"=>"", "created_on"=>"2011-10-07T21:01:39.266805+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/pmwiki-linkicons-recipe", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2017-02-26T07:09:52.048642+00:00", "size"=>431470, "type"=>"repository", "slug"=>"pmwiki-linkicons-recipe", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"pmwiki-dropcaps-recipe", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/pmwiki-dropcaps-recipe.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/pmwiki-dropcaps-recipe.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-dropcaps-recipe"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-dropcaps-recipe/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-dropcaps-recipe/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{8fd1c1ab-53d0-4111-ac23-c8b9a2ed4fa7}", "language"=>"", "created_on"=>"2011-10-07T21:15:50.800990+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/pmwiki-dropcaps-recipe", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2017-02-24T07:30:28.623762+00:00", "size"=>400206, "type"=>"repository", "slug"=>"pmwiki-dropcaps-recipe", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"pmwiki-headlineimage-recipe", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/pmwiki-headlineimage-recipe.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/pmwiki-headlineimage-recipe.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-headlineimage-recipe"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-headlineimage-recipe/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-headlineimage-recipe/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{d7355966-3b39-4cd5-89dd-7eccb3328e46}", "language"=>"", "created_on"=>"2011-10-07T21:18:03.997948+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/pmwiki-headlineimage-recipe", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2017-02-25T06:26:44.774478+00:00", "size"=>523409, "type"=>"repository", "slug"=>"pmwiki-headlineimage-recipe", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"pmwiki-syntaxlove-recipe", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/pmwiki-syntaxlove-recipe.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/pmwiki-syntaxlove-recipe.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-syntaxlove-recipe"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-syntaxlove-recipe/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-syntaxlove-recipe/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{6b4ba882-2ec2-4a1d-98e2-404f74743791}", "language"=>"", "created_on"=>"2011-10-07T21:37:43.271346+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/pmwiki-syntaxlove-recipe", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2017-02-26T09:07:20.552636+00:00", "size"=>283958, "type"=>"repository", "slug"=>"pmwiki-syntaxlove-recipe", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"pmwiki-twitter-recipe", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/pmwiki-twitter-recipe.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/pmwiki-twitter-recipe.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-twitter-recipe"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/pmwiki-twitter-recipe/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/pmwiki-twitter-recipe/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{ba849255-2758-44ba-a075-424226768520}", "language"=>"", "created_on"=>"2011-10-07T21:38:22.337905+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/pmwiki-twitter-recipe", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2017-02-26T09:49:58.293476+00:00", "size"=>456292, "type"=>"repository", "slug"=>"pmwiki-twitter-recipe", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"presentations", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/presentations.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/presentations.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/presentations"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/presentations/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/presentations/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{9f297e93-d5d6-4aeb-a2ba-2963c4726309}", "language"=>"", "created_on"=>"2012-10-06T06:56:06.687972+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/presentations", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2017-01-15T07:08:16.104352+00:00", "size"=>46007617, "type"=>"repository", "slug"=>"presentations", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"vocabularly", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/vocabularly.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/vocabularly.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/vocabularly"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/vocabularly/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/vocabularly/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{3a85cf35-5707-4f4b-a768-facf33682191}", "language"=>"", "created_on"=>"2013-01-26T07:10:16.496551+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/vocabularly", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2013-01-26T07:15:07.450654+00:00", "size"=>355428, "type"=>"repository", "slug"=>"vocabularly", "is_private"=>false, "description"=>"A list of vocabularly I'm using to train my English"}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"ruby-scripts", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/ruby-scripts.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/ruby-scripts.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/ruby-scripts"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/ruby-scripts/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/ruby-scripts/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{eec9274e-dfda-4ca3-857b-7fc0bfc15aaa}", "language"=>"ruby", "created_on"=>"2013-01-26T08:00:18.118078+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/ruby-scripts", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2014-05-25T04:02:49.095991+00:00", "size"=>173752, "type"=>"repository", "slug"=>"ruby-scripts", "is_private"=>false, "description"=>""}, {"scm"=>"git", "website"=>"", "has_wiki"=>false, "name"=>"rails-sample-app", "links"=>{"watchers"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/watchers"}, "branches"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/refs/branches"}, "tags"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/refs/tags"}, "commits"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/commits"}, "clone"=>[{"href"=>"https://bitbucket.org/wikimatze/rails-sample-app.git", "name"=>"https"}, {"href"=>"ssh://git@bitbucket.org/wikimatze/rails-sample-app.git", "name"=>"ssh"}], "self"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/rails-sample-app"}, "avatar"=>{"href"=>"https://bitbucket.org/wikimatze/rails-sample-app/avatar/32/"}, "hooks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/hooks"}, "forks"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/forks"}, "downloads"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/downloads"}, "pullrequests"=>{"href"=>"https://api.bitbucket.org/2.0/repositories/wikimatze/rails-sample-app/pullrequests"}}, "fork_policy"=>"allow_forks", "uuid"=>"{5c0859c4-17fb-4f95-83b3-1d4d83113df3}", "language"=>"ruby", "created_on"=>"2013-01-26T08:49:24.317731+00:00", "mainbranch"=>{"type"=>"branch", "name"=>"master"}, "full_name"=>"wikimatze/rails-sample-app", "has_issues"=>false, "owner"=>{"username"=>"wikimatze", "display_name"=>"Matthias Günther", "type"=>"user", "uuid"=>"{5eab05fd-a541-43c5-a0e1-5bc9b2e2005f}", "links"=>{"self"=>{"href"=>"https://api.bitbucket.org/2.0/users/wikimatze"}, "html"=>{"href"=>"https://bitbucket.org/wikimatze/"}, "avatar"=>{"href"=>"https://bitbucket.org/account/wikimatze/avatar/32/"}}}, "updated_on"=>"2013-01-26T08:50:25.802042+00:00", "size"=>304895, "type"=>"repository", "slug"=>"rails-sample-app", "is_private"=>false, "description"=>""}], "page"=>1, "size"=>9}