sweetie 1.0.1 → 1.0.2
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 +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -3
- data/Gemfile +2 -3
- data/README.md +64 -40
- data/lib/sweetie/bitbucket.rb +4 -6
- data/lib/sweetie/conversion.rb +3 -5
- data/lib/sweetie/helper.rb +0 -4
- data/lib/sweetie/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/sweetie_bitbucket_spec.rb +6 -8
- data/spec/sweetie_conversion_spec.rb +5 -7
- data/sweetie.gemspec +6 -11
- metadata +31 -39
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aaa05aba881687ee4bbda9e9c31574e54bb20fc3
|
4
|
+
data.tar.gz: 06a7b0afe7466ebac59a5c534e7b780d65e7bd5e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bab1e490132c38e57a363f9848e0ea47f2322dddf1ab1d34d8dd97b67546c4a44cc33ba0e3a649a275bb8969ffd6d83c6b13cb948ff1aa6d4fffff388bfb5c12
|
7
|
+
data.tar.gz: a22e2335b8f86a240af105fe8eaf0eaff1b30426c5e435e2e8f38964e2269f4e82f56a59e6deef1c7b6866c125d52ee85d7b19b8bd3c3655c979c564ac4b99ba
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,33 +1,42 @@
|
|
1
|
-
Sweetie is a plugin for [jekyll](https://github.com/mojombo/jekyll) to count all links, images,
|
2
|
-
|
3
|
-
your jekyll project.
|
1
|
+
Sweetie is a plugin for [jekyll](https://github.com/mojombo/jekyll) to count all links, images, pages, and the last
|
2
|
+
build time on a jekyll site. It can also grab the last changes of your bitbucket repositories.
|
3
|
+
You can then use this information at a any place in your jekyll project.
|
4
4
|
|
5
5
|
|
6
|
-
## Installation
|
6
|
+
## Installation
|
7
7
|
|
8
|
-
|
8
|
+
```sh
|
9
|
+
$ gem install sweetie
|
10
|
+
```
|
9
11
|
|
10
12
|
|
11
|
-
##
|
13
|
+
## Usage
|
12
14
|
|
13
15
|
The easiest way is to add `require 'sweetie'` on the top of your Rakefile.
|
14
16
|
|
15
17
|
Before you build your page, you can run a rake task to update the status information of a page:
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
desc 'write stats in the _config.yml'
|
22
|
+
task :create_stati do
|
23
|
+
Sweetie::Conversion.conversion
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
21
27
|
|
22
28
|
A similar task can be implemented for the bitbucket repositories:
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
desc 'write stats in the _config.yml'
|
33
|
+
task :create_bitbucket do
|
34
|
+
Sweetie::Bitbucket.bitbucket("yourname")
|
35
|
+
end
|
36
|
+
```
|
28
37
|
|
29
38
|
|
30
|
-
## Configuration variables of jekyll
|
39
|
+
## Configuration variables of jekyll
|
31
40
|
|
32
41
|
Call the class method `Sweetie::Bitbucket.bitbucket("yourname")` and it will automatically append
|
33
42
|
the `build`, `htmlpages`, `images`, and `links` in your `_config.yml` file. You can then use them
|
@@ -39,45 +48,60 @@ everywhere in your page with the liquid snippet for example:
|
|
39
48
|
- `{{ site.links }}`
|
40
49
|
|
41
50
|
|
42
|
-
## Last changes of bitbucket repository
|
51
|
+
## Last changes of bitbucket repository
|
43
52
|
|
44
|
-
Call the class method `Sweetie::Bitbucket.bitbucket("yourname")` and it will automatically append
|
45
|
-
the
|
53
|
+
Call the class method `Sweetie::Bitbucket.bitbucket("yourname")` and it will automatically append the repository name an
|
54
|
+
the last change of the repository in your `_config.yml`. Here is an example:
|
55
|
+
|
56
|
+
|
57
|
+
```yml
|
58
|
+
git: 2011-10-16
|
59
|
+
pmwiki-twitter-recipe: 2011-10-29
|
60
|
+
```
|
46
61
|
|
47
|
-
git: 2011-10-16
|
48
|
-
pmwiki-twitter-recipe: 2011-10-29
|
49
62
|
|
50
|
-
You can then use this variables in the view of your jekyll project with the liquid template. For
|
51
|
-
example:
|
63
|
+
You can then use this variables in the view of your jekyll project with the liquid template. For example:
|
52
64
|
|
53
|
-
### git ###
|
54
65
|
|
55
|
-
|
56
|
-
|
57
|
-
</section>
|
58
|
-
...
|
66
|
+
```markdown
|
67
|
+
### git
|
59
68
|
|
69
|
+
<section class="lastupdate">
|
70
|
+
Last update {{ site.git }}
|
71
|
+
</section>
|
72
|
+
...
|
60
73
|
|
61
|
-
### Twitter ###
|
62
74
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
75
|
+
### Twitter
|
76
|
+
|
77
|
+
<section class="lastupdate">
|
78
|
+
Last update {{ site.pmwiki-twitter-recipe }}
|
79
|
+
</section>
|
80
|
+
...
|
81
|
+
```
|
82
|
+
|
67
83
|
|
68
84
|
will result the following html:
|
69
85
|
|
70
86
|
|
71
|
-
|
87
|
+
```html
|
88
|
+
<h3 id="git">Git</h3>
|
89
|
+
|
90
|
+
<section class="lastupdate">
|
91
|
+
Last update 2011-10-16
|
92
|
+
</section>
|
93
|
+
|
94
|
+
|
95
|
+
<h3 id="twitter">Twitter</h3>
|
72
96
|
|
73
|
-
|
74
|
-
|
75
|
-
|
97
|
+
<section class="lastupdate">
|
98
|
+
Last update 2011-10-16
|
99
|
+
</section>
|
100
|
+
```
|
76
101
|
|
77
102
|
|
78
|
-
|
103
|
+
## License
|
79
104
|
|
80
|
-
|
81
|
-
Last update 2011-10-16
|
82
|
-
</section>
|
105
|
+
This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
|
83
106
|
|
107
|
+
© 2011-2015 Matthias Günther <matthias@wikimatze.de>.
|
data/lib/sweetie/bitbucket.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
+
require 'sweetie/helper'
|
1
2
|
module Sweetie
|
2
|
-
require 'sweetie/helper'
|
3
|
-
|
4
3
|
class Bitbucket
|
5
4
|
require 'json'
|
6
5
|
|
@@ -200,8 +199,7 @@ module Sweetie
|
|
200
199
|
def entry_text(name, last_updated)
|
201
200
|
"#{name}: #{last_updated}"
|
202
201
|
end
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
end # Sweetie
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
207
205
|
|
data/lib/sweetie/conversion.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'sweetie/helper'
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'sweetie/helper'
|
4
3
|
|
4
|
+
module Sweetie
|
5
5
|
class Conversion
|
6
|
-
|
7
6
|
class << self
|
8
7
|
|
9
8
|
@@config = "_config.yml"
|
@@ -80,6 +79,5 @@ module Sweetie
|
|
80
79
|
end
|
81
80
|
end
|
82
81
|
end
|
83
|
-
|
84
82
|
end
|
85
83
|
|
data/lib/sweetie/helper.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Sweetie
|
2
|
-
|
3
2
|
module Helper
|
4
|
-
|
5
3
|
# Traverse the page after the pattern and return the number of occurences on it
|
6
4
|
# @param [pattern] need for nokogiri to parse the html page
|
7
5
|
# @param [array] array to save the results
|
@@ -78,8 +76,6 @@ module Sweetie
|
|
78
76
|
raise "Can't find the _config.yml or the _site directory! Please create these files it!"
|
79
77
|
end
|
80
78
|
end
|
81
|
-
|
82
79
|
end
|
83
|
-
|
84
80
|
end
|
85
81
|
|
data/lib/sweetie/version.rb
CHANGED
data/spec/spec_helper.rb
ADDED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'sweetie/bitbucket'
|
2
2
|
|
3
3
|
describe Sweetie::Bitbucket do
|
4
|
-
|
5
4
|
let(:current_dir) {File.dirname(__FILE__)}
|
6
5
|
let(:user_repositories) {File.join(current_dir, 'source', 'bitbucket', 'user_repositories.json')}
|
7
6
|
let(:user_repositories_expectation) {File.join(current_dir, 'source', 'bitbucket', 'user_repositories_expectation.txt')}
|
@@ -16,7 +15,7 @@ describe Sweetie::Bitbucket do
|
|
16
15
|
# gsub replace trailing newline at the end of the file
|
17
16
|
changeset_expectation = File.open(user_repositories_expectation).read.gsub("\n", "")
|
18
17
|
changeset = bitbucket.parse_json(changeset).to_s
|
19
|
-
changeset.
|
18
|
+
expect(changeset).to eq changeset_expectation
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should get the names of the repositories" do
|
@@ -26,17 +25,17 @@ describe Sweetie::Bitbucket do
|
|
26
25
|
pmwiki-dropcaps-recipe
|
27
26
|
pmwiki-syntaxlove-recipe
|
28
27
|
pmwiki-twitter-recipe)
|
29
|
-
bitbucket.get_repositories_changes(json_repositories).keys.
|
28
|
+
expect(bitbucket.get_repositories_changes(json_repositories).keys).to eq names
|
30
29
|
end
|
31
30
|
|
32
31
|
it "should parse a timestamp" do
|
33
32
|
timestamp = %Q(2011-04-20 11:31:39)
|
34
|
-
bitbucket.parse_timestamp(timestamp).
|
33
|
+
expect(bitbucket.parse_timestamp(timestamp)).to eq "2011-04-20"
|
35
34
|
end
|
36
35
|
|
37
36
|
it "should create a string representation of a repository" do
|
38
37
|
repository = {"pmwiki" => "2011-10-26"}
|
39
|
-
bitbucket.entry_text(repository.keys.first, repository.values.first).
|
38
|
+
expect(bitbucket.entry_text(repository.keys.first, repository.values.first)).to eq "pmwiki: 2011-10-26"
|
40
39
|
end
|
41
40
|
|
42
41
|
it "should repositories changes write_repository_changes" do
|
@@ -44,8 +43,8 @@ describe Sweetie::Bitbucket do
|
|
44
43
|
bitbucket.config = config
|
45
44
|
bitbucket.write_repository_changes(hash)
|
46
45
|
config_yml_content = File.open(config).read
|
47
|
-
config_yml_content.
|
48
|
-
config_yml_content.
|
46
|
+
expect(config_yml_content).to include "svn: 2011-10-26"
|
47
|
+
expect(config_yml_content).to include "pmwiki: 2011-10-26"
|
49
48
|
|
50
49
|
# remove variables from the text-file
|
51
50
|
text = config_yml_content.gsub!("svn: 2011-10-26\n", "")
|
@@ -54,6 +53,5 @@ describe Sweetie::Bitbucket do
|
|
54
53
|
config_yml_content.puts text
|
55
54
|
config_yml_content.close
|
56
55
|
end
|
57
|
-
|
58
56
|
end
|
59
57
|
|
@@ -1,31 +1,29 @@
|
|
1
1
|
require 'sweetie/conversion'
|
2
2
|
|
3
3
|
describe Sweetie::Conversion do
|
4
|
-
|
5
4
|
let(:current_dir) {File.dirname(__FILE__)}
|
6
5
|
let(:about_page) {File.join(current_dir, 'source', 'site', 'about.html')}
|
7
6
|
let(:site_dir) {File.join(current_dir, 'source', 'site')}
|
8
7
|
let(:sweetie) {Sweetie::Conversion}
|
9
8
|
|
10
9
|
it "should count links of about.html page" do
|
11
|
-
sweetie.count_link_of_one_page(about_page).
|
10
|
+
expect(sweetie.count_link_of_one_page(about_page)).to eq(11)
|
12
11
|
end
|
13
12
|
|
14
13
|
it "should count images of about.html page" do
|
15
|
-
sweetie.count_images_of_one_page(about_page).
|
14
|
+
expect(sweetie.count_images_of_one_page(about_page)).to eq 1
|
16
15
|
end
|
17
16
|
|
18
17
|
it "should count all html pages" do
|
19
|
-
sweetie.count_all_html_pages(site_dir).
|
18
|
+
expect(sweetie.count_all_html_pages(site_dir)).to eq 8
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should count all links of all pages" do
|
23
|
-
sweetie.count_all_links(site_dir).
|
22
|
+
expect(sweetie.count_all_links(site_dir)).to eq 54
|
24
23
|
end
|
25
24
|
|
26
25
|
it "should count all images" do
|
27
|
-
sweetie.count_all_images(site_dir).
|
26
|
+
expect(sweetie.count_all_images(site_dir)).to eq 1
|
28
27
|
end
|
29
|
-
|
30
28
|
end
|
31
29
|
|
data/sweetie.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# magic line that ensures "../lib" is in the load path
|
2
1
|
$:.push File.expand_path("../lib", __FILE__)
|
3
2
|
require 'sweetie/version'
|
4
3
|
|
@@ -7,9 +6,8 @@ Gem::Specification.new do |s|
|
|
7
6
|
s.version = Sweetie::VERSION
|
8
7
|
s.date = '2012-07-15'
|
9
8
|
s.authors = ['Matthias Guenther']
|
10
|
-
s.email = 'matthias
|
11
|
-
s.homepage = 'https://github.com/
|
12
|
-
|
9
|
+
s.email = 'matthias@wikimatze.de'
|
10
|
+
s.homepage = 'https://github.com/wikimatze/sweetie'
|
13
11
|
s.summary = %q{Count links, images, number of html pages, and last-build time of a
|
14
12
|
jekyll project. In addition it can get last updates of all bitbucket
|
15
13
|
repositories of a user.}
|
@@ -18,16 +16,13 @@ Gem::Specification.new do |s|
|
|
18
16
|
time of a jekyll project. In addition it can get the last changes of all
|
19
17
|
bitbuckets repositories of a user.}
|
20
18
|
s.files = `git ls-files`.split("\n")
|
21
|
-
# files that are used for the gem (the line supports TestUnit, MiniTest, RSpec, and Cucumber
|
22
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
-
s.require_paths = ['lib']
|
24
20
|
|
25
21
|
s.extra_rdoc_files = ['README.md']
|
26
22
|
|
27
|
-
s.add_runtime_dependency 'nokogiri', '
|
28
|
-
s.add_runtime_dependency 'json', '
|
29
|
-
s.add_development_dependency 'rake'
|
30
|
-
s.add_development_dependency 'rspec'
|
31
|
-
|
23
|
+
s.add_runtime_dependency 'nokogiri', '~> 1.6'
|
24
|
+
s.add_runtime_dependency 'json', '~> 1.8'
|
25
|
+
s.add_development_dependency 'rake', '~> 10.2'
|
26
|
+
s.add_development_dependency 'rspec', '~> 3.3'
|
32
27
|
end
|
33
28
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweetie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Matthias Guenther
|
@@ -14,78 +13,71 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
19
|
+
version: '1.6'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
26
|
+
version: '1.6'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.
|
33
|
+
version: '1.8'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
40
|
+
version: '1.8'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '10.2'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
54
|
+
version: '10.2'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
61
|
+
version: '3.3'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
78
|
-
description:
|
79
|
-
|
80
|
-
|
81
|
-
|
68
|
+
version: '3.3'
|
69
|
+
description: |-
|
70
|
+
Sweetie counts the links, images, number of html pages, and last-build
|
71
|
+
time of a jekyll project. In addition it can get the last changes of all
|
72
|
+
bitbuckets repositories of a user.
|
73
|
+
email: matthias@wikimatze.de
|
82
74
|
executables: []
|
83
75
|
extensions: []
|
84
76
|
extra_rdoc_files:
|
85
77
|
- README.md
|
86
78
|
files:
|
87
|
-
- .gitignore
|
88
|
-
- .travis.yml
|
79
|
+
- ".gitignore"
|
80
|
+
- ".travis.yml"
|
89
81
|
- Gemfile
|
90
82
|
- README.md
|
91
83
|
- Rakefile
|
@@ -138,32 +130,32 @@ files:
|
|
138
130
|
- spec/source/site/robots.txt
|
139
131
|
- spec/source/site/sitemap.xml
|
140
132
|
- spec/source/site/why-i-use-jekyll-for-blogging.html
|
133
|
+
- spec/spec_helper.rb
|
141
134
|
- spec/sweetie_bitbucket_spec.rb
|
142
135
|
- spec/sweetie_conversion_spec.rb
|
143
136
|
- sweetie.gemspec
|
144
|
-
homepage: https://github.com/
|
137
|
+
homepage: https://github.com/wikimatze/sweetie
|
145
138
|
licenses: []
|
139
|
+
metadata: {}
|
146
140
|
post_install_message:
|
147
141
|
rdoc_options: []
|
148
142
|
require_paths:
|
149
143
|
- lib
|
150
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
145
|
requirements:
|
153
|
-
- -
|
146
|
+
- - ">="
|
154
147
|
- !ruby/object:Gem::Version
|
155
148
|
version: '0'
|
156
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
-
none: false
|
158
150
|
requirements:
|
159
|
-
- -
|
151
|
+
- - ">="
|
160
152
|
- !ruby/object:Gem::Version
|
161
153
|
version: '0'
|
162
154
|
requirements: []
|
163
155
|
rubyforge_project:
|
164
|
-
rubygems_version:
|
156
|
+
rubygems_version: 2.4.8
|
165
157
|
signing_key:
|
166
|
-
specification_version:
|
158
|
+
specification_version: 4
|
167
159
|
summary: Count links, images, number of html pages, and last-build time of a jekyll
|
168
160
|
project. In addition it can get last updates of all bitbucket repositories of a
|
169
161
|
user.
|