sweetie 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
- rbenv:
2
- - 1.9.2-p290
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
3
5
 
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in sweetie.gemspec
4
4
  gemspec
5
5
 
6
+
File without changes
@@ -3,6 +3,7 @@ module Sweetie
3
3
 
4
4
  class Bitbucket
5
5
  require 'json'
6
+
6
7
  @@config = "_config.yml"
7
8
 
8
9
  class << self
@@ -18,126 +19,189 @@ module Sweetie
18
19
  @@config = config
19
20
  end
20
21
 
21
- # Wrapper to start all the other methods
22
- # @param [user] a valid bitbucket user
22
+ # Public: Wrapper to start all the other methods
23
+ #
24
+ # user - The String of the bitbucket user
25
+ #
26
+ # Example:
27
+ #
28
+ # bitbucket('wikimatze')
29
+ #
30
+ # Returns nothing but write the changes in the _config.yml file
23
31
  def bitbucket(user)
24
- # json represetnation of user repositories
25
- json_repositories = get_repositories_json(user)
26
-
27
- # get the names of the repositories
28
- repositories_names = read_repositories(json_repositories)
29
-
30
- # get the hash with repository-name and last changes
31
- repositories_changes_hash = repositories_changes(user, repositories_names)
32
+ json_repositories = get_repositories(user)
33
+ repositories_change_hashs = get_repositories_changes(json_repositories)
34
+ write_repository_changes(repositories_change_hashs)
35
+ end
32
36
 
33
- # write the repository information in the _config.yml
34
- write_repository_changes(repositories_changes_hash)
37
+ # Public: Fire up curl request to bitbucket
38
+ #
39
+ # user - The String of the bitbucket user
40
+ #
41
+ # Example:
42
+ #
43
+ # bitbucket('wikimatze')
44
+ #
45
+ # # =>
46
+ # {
47
+ # "repositories": [
48
+ # {
49
+ # "scm": "git",
50
+ # "has_wiki": false,
51
+ # "last_updated": "2012-07-01 07:03:08",
52
+ # "creator": null,
53
+ # "created_on": "2012-07-01 07:03:08",
54
+ # "owner": "wikimatze",
55
+ # "logo": null,
56
+ # "email_mailinglist": "",
57
+ # "is_mq": false,
58
+ # "size": 580,
59
+ # "read_only": false,
60
+ # "fork_of": null,
61
+ # "mq_of": null,
62
+ # "followers_count": 1,
63
+ # "state": "available",
64
+ # "utc_created_on": "2012-07-01 05:03:08+00:00",
65
+ # "website": "",
66
+ # "description": "",
67
+ # "has_issues": false,
68
+ # "is_fork": false,
69
+ # "slug": "knoppix-6-01",
70
+ # "is_private": false,
71
+ # "name": "knoppix-6-01",
72
+ # "language": "",
73
+ # "utc_last_updated": "2012-07-01 05:03:08+00:00",
74
+ # "email_writers": true,
75
+ # "no_public_forks": false,
76
+ # "resource_uri": "/1.0/repositories/wikimatze/knoppix-6-01"
77
+ # },
78
+ # ... other repositories
79
+ # }
80
+ # ],
81
+ # "user": {
82
+ # "username": "wikimatze",
83
+ # "first_name": "Matthias",
84
+ # "last_name": "Guenther",
85
+ # "avatar": "https://secure.gravatar.com/avatar/208673d619b63131cbfd7205366ad16e?d=identicon&s=32",
86
+ # "resource_uri": "/1.0/users/wikimatze"
87
+ # }
88
+ # }
89
+ #
90
+ # Returns a json representation the specified user
91
+ def get_repositories(user)
92
+ `curl -s https://api.bitbucket.org/1.0/users/#{user}/`
35
93
  end
36
94
 
37
- # names of all repositories of a user
38
- # @param [json_repositories] repositories in json format
39
- # @return array with the names of all repositories of the user
40
- def read_repositories(json_repositories)
95
+ # Public: Grab for each repository the recent update
96
+ #
97
+ # json_repositories: A json object of the bitbucket API response
98
+ #
99
+ # Example:
100
+ #
101
+ # get_repositories_changes(wikimatze_json)
102
+ # # => {"pmwiki-headlineimage-recipe"=>"2011-10-29", "pmwiki-linkicons-recipe"=>"2011-10-29"}
103
+ #
104
+ # Returns a hash of the form {repository_name => last_updated}
105
+ def get_repositories_changes(json_repositories)
41
106
  repository_hash = parse_json(json_repositories)
42
- repositories_names = []
107
+ repositories_changsets = {}
43
108
 
44
- repository_hash["repositories"].each do |repo|
45
- repositories_names << repo["slug"]
109
+ repository_hash["repositories"].each do |repository|
110
+ repository_name = repository['name']
111
+ repository_last_updated = parse_timestamp(repository['last_updated'])
112
+ repositories_changsets.merge!({repository_name => repository_last_updated})
46
113
  end
47
114
 
48
- repositories_names
49
- end
50
-
51
- # Get the last changes for each repository and the name
52
- # @param [user] a valid bitbucket user
53
- # @param [repositories] array with names of all repositories of a user
54
- # @return hash with all the repositories of the user and the last changes
55
- def repositories_changes(user, repositories)
56
- repositories_lastmodifications = {}
57
- repositories.each do |repository|
58
- changeset = repository_changeset(user, repository)
59
- repositories_lastmodifications.merge(repository_last_modification(repository, changeset))
60
- end
61
-
62
- repositories_lastmodifications
63
- end
64
-
65
- # Get the last modification of a repository
66
- # @param [repository_name] a valid repository name
67
- # @param [repository_json] json representation of the repository
68
- def repository_last_modification(repository_name, repository_json)
69
- changeset_parsed = parse_json(repository_json)
70
- timestamp = changeset_parsed["changesets"].last["timestamp"]
71
-
72
- # create the hash
73
- {repository_name => parse_timestamp(timestamp)}
74
- end
75
-
76
- # Parse JSON file to format be read by ruby
77
- def parse_json(file)
78
- JSON.parse file
79
- end
80
-
81
- # Get the changeset of a repository
82
- # @param [user] a valid bitbucket user
83
- # @param [repository] a repository of a user
84
- # @return information about the repository in json
85
- def repository_changeset(user, repository)
86
- `curl -s https://api.bitbucket.org/1.0/repositories/#{user}/#{repository}/changesets/`
115
+ repositories_changsets
87
116
  end
88
117
 
89
- # Get the json representation of each repository of the user
90
- # @param [user] a valid bitbucket user
91
- # @return json representation of all bitbucket repositories
92
- def get_repositories_json(user)
93
- `curl -s https://api.bitbucket.org/1.0/users/#{user}/`
118
+ # Public: Wrapper for calling the json_parsing
119
+ #
120
+ # file: A String in JSON format
121
+ #
122
+ # Example:
123
+ #
124
+ # json = {
125
+ # "user": {
126
+ # "username": "wikimatze",
127
+ # "first_name": "Matthias",
128
+ # "last_name": "Guenther",
129
+ # "resource_uri": "/1.0/users/wikimatze"
130
+ # }
131
+ # }
132
+
133
+ # parse_json(json)
134
+ # # => {"user"=>{"username"=>"wikimatze", "first_name"=>"Matthias", "last_name"=>"Guenther", "resource_uri"=>"/1.0/users/wikimatze"}}
135
+ #
136
+ # Returns Parse JSON file to format be read by ruby
137
+ def parse_json(json)
138
+ JSON.parse(json)
94
139
  end
95
140
 
96
- # Parse timestamp to display only the date ("2011-04-20 11:31:39" will be converted to "2011-04-20")
97
- # @param [timestamp] a time display as a string in the 'Time.now' format
98
- # @return "yyyy-mm-dd"
141
+ # Public: Parse a timestamp in a wanted format
142
+ #
143
+ # timestamp - A string in the form 2011-04-20 11:31:39
144
+ #
145
+ # Example:
146
+ #
147
+ # parse_timestamp("2011-04-20 11:31:39")
148
+ # # => 2011-04-20
149
+ #
150
+ # Returns a string in the format "yyyy-mm-dd"
99
151
  def parse_timestamp(timestamp)
100
152
  regex = Regexp.new(/(\d+)-(\d+)-(\d+)/)
101
153
  regex.match(timestamp)[0]
102
154
  end
103
155
 
104
- # Writes the changes into the _config.yml
105
- # @param [repositories] a hash with the following scheme {"svn" => "2011-10-26", "pmwiki" => "2011-10-26"}
156
+ # Public: Parse a hash and write its key/value pairs in a file
157
+ #
158
+ # repositories - A hash in the form {<name> => <last_updated}
159
+ #
160
+ # Example:
161
+ #
162
+ # write_repository_changes({"svn" => "2011-10-26", "pmwiki" => "2011-10-26"})
163
+ # # => svn: 2011-10-26\npmwiki: 2011-10-26
164
+ #
165
+ # Returns nothing but writes the information in the specified _config.yml file
106
166
  def write_repository_changes(repositories)
107
- repositories.each do |repository, last_change|
167
+ repositories.each do |name, last_updated|
108
168
  file = File.open(@@config)
109
169
  text = ""
110
170
  match = false
111
171
  while line = file.gets
112
- if line.match(/#{repository}/)
172
+ if line.match(/#{name}/)
113
173
  match = true
114
174
  # create string and replace this line with the new changes
115
- text << create_entry(repository, last_change) + "\n"
175
+ text << entry_text(name, last_updated) + "\n"
116
176
  else
117
177
  text << line
118
178
  end
119
179
  end
120
180
 
121
- # append the repository if it is not in there
122
- text << create_entry(repository, last_change) unless match
181
+ # append the name if it is not in there
182
+ text << entry_text(name, last_updated) unless match
123
183
 
124
184
  file.close
125
-
126
185
  write_config(@@config, text)
127
186
  end
128
187
  end
129
188
 
130
- # Create a string representation of a repository entry
131
- # @param [repository_name] string contains the name of the repository
132
- # @param [last_change] string contains the date of the change
133
- # @return a string in the form "<reponame>: <date>"
134
- def create_entry(repository_name, last_change)
135
- "#{repository_name}: #{last_change}"
189
+ # Public: Create a string representation of a repository entry
190
+ #
191
+ # name - A string containing the name of the repository
192
+ # last_updated - A string containing the date of the last change of the repo
193
+ #
194
+ # Example:
195
+ #
196
+ # entry_text({"pmwiki" => "2011-10-26"}
197
+ # # => "pmwiki: 2011-10-26"
198
+ #
199
+ # Return a string in the form "<name>: <last_updated>"
200
+ def entry_text(name, last_updated)
201
+ "#{name}: #{last_updated}"
136
202
  end
137
203
 
138
- end
139
-
140
- end
141
-
142
- end
204
+ end # self
205
+ end # Bitbucket
206
+ end # Sweetie
143
207
 
@@ -9,7 +9,6 @@ module Sweetie
9
9
  @@config = "_config.yml"
10
10
  @@dir = "_site"
11
11
 
12
-
13
12
  include Sweetie::Helper
14
13
 
15
14
  # Opens the config file and search after the specified parameters.
@@ -1,4 +1,4 @@
1
1
  module Sweetie
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
4
4
 
@@ -1,143 +1,161 @@
1
1
  {
2
2
  "repositories": [
3
3
  {
4
- "website": "",
5
- "scm": "git",
6
- "name": "svn",
7
- "followers_count": 1,
8
- "owner": "wikimatze",
9
- "logo": null,
10
- "resource_uri": "/api/1.0/repositories/wikimatze/svn",
11
- "slug": "svn",
12
- "description": ""
13
- },
4
+ "scm": "git",
5
+ "has_wiki": false,
6
+ "last_updated": "2011-10-29 15:27:33",
7
+ "creator": null,
8
+ "created_on": "2011-10-07 23:18:03",
9
+ "owner": "wikimatze",
10
+ "logo": null,
11
+ "email_mailinglist": "",
12
+ "is_mq": false,
13
+ "size": 51772,
14
+ "read_only": false,
15
+ "fork_of": null,
16
+ "mq_of": null,
17
+ "followers_count": 1,
18
+ "state": "available",
19
+ "utc_created_on": "2011-10-07 21:18:03+00:00",
20
+ "website": "",
21
+ "description": "",
22
+ "has_issues": false,
23
+ "is_fork": false,
24
+ "slug": "pmwiki-headlineimage-recipe",
25
+ "is_private": false,
26
+ "name": "pmwiki-headlineimage-recipe",
27
+ "language": "",
28
+ "utc_last_updated": "2011-10-29 13:27:33+00:00",
29
+ "email_writers": true,
30
+ "no_public_forks": false,
31
+ "resource_uri": "/1.0/repositories/wikimatze/pmwiki-headlineimage-recipe"
32
+ },
14
33
  {
15
- "website": "",
16
- "scm": "git",
17
- "name": "sql",
18
- "followers_count": 1,
19
- "owner": "wikimatze",
20
- "logo": null,
21
- "resource_uri": "/api/1.0/repositories/wikimatze/sql",
22
- "slug": "sql",
23
- "description": ""
24
- },
34
+ "scm": "git",
35
+ "has_wiki": false,
36
+ "last_updated": "2011-10-29 15:46:59",
37
+ "creator": null,
38
+ "created_on": "2011-10-07 23:01:39",
39
+ "owner": "wikimatze",
40
+ "logo": null,
41
+ "email_mailinglist": "",
42
+ "is_mq": false,
43
+ "size": 25278,
44
+ "read_only": false,
45
+ "fork_of": null,
46
+ "mq_of": null,
47
+ "followers_count": 1,
48
+ "state": "available",
49
+ "utc_created_on": "2011-10-07 21:01:39+00:00",
50
+ "website": "",
51
+ "description": "",
52
+ "has_issues": false,
53
+ "is_fork": false,
54
+ "slug": "pmwiki-linkicons-recipe",
55
+ "is_private": false,
56
+ "name": "pmwiki-linkicons-recipe",
57
+ "language": "",
58
+ "utc_last_updated": "2011-10-29 13:46:59+00:00",
59
+ "email_writers": true,
60
+ "no_public_forks": false,
61
+ "resource_uri": "/1.0/repositories/wikimatze/pmwiki-linkicons-recipe"
62
+ },
25
63
  {
26
- "website": "",
27
- "scm": "git",
28
- "name": "shell",
29
- "followers_count": 1,
30
- "owner": "wikimatze",
31
- "logo": null,
32
- "resource_uri": "/api/1.0/repositories/wikimatze/shell",
33
- "slug": "shell",
34
- "description": ""
35
- },
64
+ "scm": "git",
65
+ "has_wiki": false,
66
+ "last_updated": "2011-10-29 15:34:33",
67
+ "creator": null,
68
+ "created_on": "2011-10-07 23:15:50",
69
+ "owner": "wikimatze",
70
+ "logo": null,
71
+ "email_mailinglist": "",
72
+ "is_mq": false,
73
+ "size": 19055,
74
+ "read_only": false,
75
+ "fork_of": null,
76
+ "mq_of": null,
77
+ "followers_count": 1,
78
+ "state": "available",
79
+ "utc_created_on": "2011-10-07 21:15:50+00:00",
80
+ "website": "",
81
+ "description": "",
82
+ "has_issues": false,
83
+ "is_fork": false,
84
+ "slug": "pmwiki-dropcaps-recipe",
85
+ "is_private": false,
86
+ "name": "pmwiki-dropcaps-recipe",
87
+ "language": "",
88
+ "utc_last_updated": "2011-10-29 13:34:33+00:00",
89
+ "email_writers": true,
90
+ "no_public_forks": false,
91
+ "resource_uri": "/1.0/repositories/wikimatze/pmwiki-dropcaps-recipe"
92
+ },
36
93
  {
37
- "website": "",
38
- "scm": "git",
39
- "name": "scrum",
40
- "followers_count": 1,
41
- "owner": "wikimatze",
42
- "logo": null,
43
- "resource_uri": "/api/1.0/repositories/wikimatze/scrum",
44
- "slug": "scrum",
45
- "description": ""
46
- },
94
+ "scm": "git",
95
+ "has_wiki": false,
96
+ "last_updated": "2011-10-29 16:02:00",
97
+ "creator": null,
98
+ "created_on": "2011-10-07 23:37:43",
99
+ "owner": "wikimatze",
100
+ "logo": null,
101
+ "email_mailinglist": "",
102
+ "is_mq": false,
103
+ "size": 115972,
104
+ "read_only": false,
105
+ "fork_of": null,
106
+ "mq_of": null,
107
+ "followers_count": 1,
108
+ "state": "available",
109
+ "utc_created_on": "2011-10-07 21:37:43+00:00",
110
+ "website": "",
111
+ "description": "",
112
+ "has_issues": false,
113
+ "is_fork": false,
114
+ "slug": "pmwiki-syntaxlove-recipe",
115
+ "is_private": false,
116
+ "name": "pmwiki-syntaxlove-recipe",
117
+ "language": "",
118
+ "utc_last_updated": "2011-10-29 14:02:00+00:00",
119
+ "email_writers": true,
120
+ "no_public_forks": false,
121
+ "resource_uri": "/1.0/repositories/wikimatze/pmwiki-syntaxlove-recipe"
122
+ },
47
123
  {
48
- "website": "",
49
- "scm": "git",
50
- "name": "ruby",
51
- "followers_count": 1,
52
- "owner": "wikimatze",
53
- "logo": null,
54
- "resource_uri": "/api/1.0/repositories/wikimatze/ruby",
55
- "slug": "ruby",
56
- "description": ""
57
- },
58
- {
59
- "website": "",
60
- "scm": "git",
61
- "name": "rails",
62
- "followers_count": 1,
63
- "owner": "wikimatze",
64
- "logo": null,
65
- "resource_uri": "/api/1.0/repositories/wikimatze/rails",
66
- "slug": "rails",
67
- "description": ""
68
- },
69
- {
70
- "website": "",
71
- "scm": "git",
72
- "name": "git",
73
- "followers_count": 1,
74
- "owner": "wikimatze",
75
- "logo": null,
76
- "resource_uri": "/api/1.0/repositories/wikimatze/git",
77
- "slug": "git",
78
- "description": ""
79
- },
80
- {
81
- "website": "",
82
- "scm": "git",
83
- "name": "pmwiki-twitter-recipe",
84
- "followers_count": 1,
85
- "owner": "wikimatze",
86
- "logo": null,
87
- "resource_uri": "/api/1.0/repositories/wikimatze/pmwiki-twitter-recipe",
88
- "slug": "pmwiki-twitter-recipe",
89
- "description": ""
90
- },
91
- {
92
- "website": "",
93
- "scm": "git",
94
- "name": "pmwiki-syntaxlove-recipe",
95
- "followers_count": 1,
96
- "owner": "wikimatze",
97
- "logo": null,
98
- "resource_uri": "/api/1.0/repositories/wikimatze/pmwiki-syntaxlove-recipe",
99
- "slug": "pmwiki-syntaxlove-recipe",
100
- "description": ""
101
- },
102
- {
103
- "website": "",
104
- "scm": "git",
105
- "name": "pmwiki-linkicons-recipe",
106
- "followers_count": 1,
107
- "owner": "wikimatze",
108
- "logo": null,
109
- "resource_uri": "/api/1.0/repositories/wikimatze/pmwiki-linkicons-recipe",
110
- "slug": "pmwiki-linkicons-recipe",
111
- "description": ""
112
- },
113
- {
114
- "website": "",
115
- "scm": "git",
116
- "name": "pmwiki-headlineimage-recipe",
117
- "followers_count": 1,
118
- "owner": "wikimatze",
119
- "logo": null,
120
- "resource_uri": "/api/1.0/repositories/wikimatze/pmwiki-headlineimage-recipe",
121
- "slug": "pmwiki-headlineimage-recipe",
122
- "description": ""
123
- },
124
- {
125
- "website": "",
126
- "scm": "git",
127
- "name": "pmwiki-dropcaps-recipe",
128
- "followers_count": 1,
129
- "owner": "wikimatze",
130
- "logo": null,
131
- "resource_uri": "/api/1.0/repositories/wikimatze/pmwiki-dropcaps-recipe",
132
- "slug": "pmwiki-dropcaps-recipe",
133
- "description": ""
124
+ "scm": "git",
125
+ "has_wiki": false,
126
+ "last_updated": "2011-10-29 16:19:34",
127
+ "creator": null,
128
+ "created_on": "2011-10-07 23:38:22",
129
+ "owner": "wikimatze",
130
+ "logo": null,
131
+ "email_mailinglist": "",
132
+ "is_mq": false,
133
+ "size": 45329,
134
+ "read_only": false,
135
+ "fork_of": null,
136
+ "mq_of": null,
137
+ "followers_count": 1,
138
+ "state": "available",
139
+ "utc_created_on": "2011-10-07 21:38:22+00:00",
140
+ "website": "",
141
+ "description": "",
142
+ "has_issues": false,
143
+ "is_fork": false,
144
+ "slug": "pmwiki-twitter-recipe",
145
+ "is_private": false,
146
+ "name": "pmwiki-twitter-recipe",
147
+ "language": "",
148
+ "utc_last_updated": "2011-10-29 14:19:34+00:00",
149
+ "email_writers": true,
150
+ "no_public_forks": false,
151
+ "resource_uri": "/1.0/repositories/wikimatze/pmwiki-twitter-recipe"
134
152
  }
135
- ],
153
+ ],
136
154
  "user": {
137
- "username": "wikimatze",
138
- "first_name": "Matthias",
139
- "last_name": "Günther",
140
- "avatar": "https://secure.gravatar.com/avatar/208673d619b63131cbfd7205366ad16e?d=identicon&s=32",
155
+ "username": "wikimatze",
156
+ "first_name": "Matthias",
157
+ "last_name": "Guenther",
158
+ "avatar": "https://secure.gravatar.com/avatar/208673d619b63131cbfd7205366ad16e?d=identicon&s=32",
141
159
  "resource_uri": "/1.0/users/wikimatze"
142
160
  }
143
161
  }
@@ -0,0 +1 @@
1
+ {"repositories"=>[{"scm"=>"git", "has_wiki"=>false, "last_updated"=>"2011-10-29 15:27:33", "creator"=>nil, "created_on"=>"2011-10-07 23:18:03", "owner"=>"wikimatze", "logo"=>nil, "email_mailinglist"=>"", "is_mq"=>false, "size"=>51772, "read_only"=>false, "fork_of"=>nil, "mq_of"=>nil, "followers_count"=>1, "state"=>"available", "utc_created_on"=>"2011-10-07 21:18:03+00:00", "website"=>"", "description"=>"", "has_issues"=>false, "is_fork"=>false, "slug"=>"pmwiki-headlineimage-recipe", "is_private"=>false, "name"=>"pmwiki-headlineimage-recipe", "language"=>"", "utc_last_updated"=>"2011-10-29 13:27:33+00:00", "email_writers"=>true, "no_public_forks"=>false, "resource_uri"=>"/1.0/repositories/wikimatze/pmwiki-headlineimage-recipe"}, {"scm"=>"git", "has_wiki"=>false, "last_updated"=>"2011-10-29 15:46:59", "creator"=>nil, "created_on"=>"2011-10-07 23:01:39", "owner"=>"wikimatze", "logo"=>nil, "email_mailinglist"=>"", "is_mq"=>false, "size"=>25278, "read_only"=>false, "fork_of"=>nil, "mq_of"=>nil, "followers_count"=>1, "state"=>"available", "utc_created_on"=>"2011-10-07 21:01:39+00:00", "website"=>"", "description"=>"", "has_issues"=>false, "is_fork"=>false, "slug"=>"pmwiki-linkicons-recipe", "is_private"=>false, "name"=>"pmwiki-linkicons-recipe", "language"=>"", "utc_last_updated"=>"2011-10-29 13:46:59+00:00", "email_writers"=>true, "no_public_forks"=>false, "resource_uri"=>"/1.0/repositories/wikimatze/pmwiki-linkicons-recipe"}, {"scm"=>"git", "has_wiki"=>false, "last_updated"=>"2011-10-29 15:34:33", "creator"=>nil, "created_on"=>"2011-10-07 23:15:50", "owner"=>"wikimatze", "logo"=>nil, "email_mailinglist"=>"", "is_mq"=>false, "size"=>19055, "read_only"=>false, "fork_of"=>nil, "mq_of"=>nil, "followers_count"=>1, "state"=>"available", "utc_created_on"=>"2011-10-07 21:15:50+00:00", "website"=>"", "description"=>"", "has_issues"=>false, "is_fork"=>false, "slug"=>"pmwiki-dropcaps-recipe", "is_private"=>false, "name"=>"pmwiki-dropcaps-recipe", "language"=>"", "utc_last_updated"=>"2011-10-29 13:34:33+00:00", "email_writers"=>true, "no_public_forks"=>false, "resource_uri"=>"/1.0/repositories/wikimatze/pmwiki-dropcaps-recipe"}, {"scm"=>"git", "has_wiki"=>false, "last_updated"=>"2011-10-29 16:02:00", "creator"=>nil, "created_on"=>"2011-10-07 23:37:43", "owner"=>"wikimatze", "logo"=>nil, "email_mailinglist"=>"", "is_mq"=>false, "size"=>115972, "read_only"=>false, "fork_of"=>nil, "mq_of"=>nil, "followers_count"=>1, "state"=>"available", "utc_created_on"=>"2011-10-07 21:37:43+00:00", "website"=>"", "description"=>"", "has_issues"=>false, "is_fork"=>false, "slug"=>"pmwiki-syntaxlove-recipe", "is_private"=>false, "name"=>"pmwiki-syntaxlove-recipe", "language"=>"", "utc_last_updated"=>"2011-10-29 14:02:00+00:00", "email_writers"=>true, "no_public_forks"=>false, "resource_uri"=>"/1.0/repositories/wikimatze/pmwiki-syntaxlove-recipe"}, {"scm"=>"git", "has_wiki"=>false, "last_updated"=>"2011-10-29 16:19:34", "creator"=>nil, "created_on"=>"2011-10-07 23:38:22", "owner"=>"wikimatze", "logo"=>nil, "email_mailinglist"=>"", "is_mq"=>false, "size"=>45329, "read_only"=>false, "fork_of"=>nil, "mq_of"=>nil, "followers_count"=>1, "state"=>"available", "utc_created_on"=>"2011-10-07 21:38:22+00:00", "website"=>"", "description"=>"", "has_issues"=>false, "is_fork"=>false, "slug"=>"pmwiki-twitter-recipe", "is_private"=>false, "name"=>"pmwiki-twitter-recipe", "language"=>"", "utc_last_updated"=>"2011-10-29 14:19:34+00:00", "email_writers"=>true, "no_public_forks"=>false, "resource_uri"=>"/1.0/repositories/wikimatze/pmwiki-twitter-recipe"}], "user"=>{"username"=>"wikimatze", "first_name"=>"Matthias", "last_name"=>"Guenther", "avatar"=>"https://secure.gravatar.com/avatar/208673d619b63131cbfd7205366ad16e?d=identicon&s=32", "resource_uri"=>"/1.0/users/wikimatze"}}
@@ -4,31 +4,29 @@ describe Sweetie::Bitbucket do
4
4
 
5
5
  let(:current_dir) {File.dirname(__FILE__)}
6
6
  let(:user_repositories) {File.join(current_dir, 'source', 'bitbucket', 'user_repositories.json')}
7
- let(:user_changeset) {File.join(current_dir, 'source', 'bitbucket', 'user_changeset.json')}
7
+ let(:user_repositories_expectation) {File.join(current_dir, 'source', 'bitbucket', 'user_repositories_expectation.txt')}
8
8
  let(:site_dir) {File.join(current_dir, 'source', 'site')}
9
- let(:user_changeset_expectation) {File.join(current_dir, 'source', 'bitbucket', 'user_changeset_expectation.txt')}
10
9
  let(:config) {File.join(current_dir, "source", "_config.yml")}
11
10
  let(:svn_hash) {{"svn" => "2011-10-16"}}
12
11
 
13
12
  let(:bitbucket) {Sweetie::Bitbucket}
14
13
 
15
14
  it "should parse a json file" do
16
- changeset = File.open(user_changeset).read
15
+ changeset = File.open(user_repositories).read
17
16
  # gsub replace trailing newline at the end of the file
18
- changeset_expectation = File.open(user_changeset_expectation).read.gsub("\n", "")
17
+ changeset_expectation = File.open(user_repositories_expectation).read.gsub("\n", "")
19
18
  changeset = bitbucket.parse_json(changeset).to_s
20
19
  changeset.should == changeset_expectation
21
20
  end
22
21
 
23
22
  it "should get the names of the repositories" do
24
23
  json_repositories = File.open(user_repositories).read
25
- names = %w(svn sql shell scrum ruby rails
26
- git pmwiki-twitter-recipe
27
- pmwiki-syntaxlove-recipe
24
+ names = %w(pmwiki-headlineimage-recipe
28
25
  pmwiki-linkicons-recipe
29
- pmwiki-headlineimage-recipe
30
- pmwiki-dropcaps-recipe)
31
- bitbucket.read_repositories(json_repositories).should == names
26
+ pmwiki-dropcaps-recipe
27
+ pmwiki-syntaxlove-recipe
28
+ pmwiki-twitter-recipe)
29
+ bitbucket.get_repositories_changes(json_repositories).keys.should == names
32
30
  end
33
31
 
34
32
  it "should parse a timestamp" do
@@ -38,12 +36,7 @@ describe Sweetie::Bitbucket do
38
36
 
39
37
  it "should create a string representation of a repository" do
40
38
  repository = {"pmwiki" => "2011-10-26"}
41
- bitbucket.create_entry(repository.keys.first, repository.values.first).should == "pmwiki: 2011-10-26"
42
- end
43
-
44
- it "should create last modification of each repository" do
45
- repo = File.open(user_changeset).read
46
- bitbucket.repository_last_modification("svn", repo).should == svn_hash
39
+ bitbucket.entry_text(repository.keys.first, repository.values.first).should == "pmwiki: 2011-10-26"
47
40
  end
48
41
 
49
42
  it "should repositories changes write_repository_changes" do
@@ -5,30 +5,29 @@ require 'sweetie/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'sweetie'
7
7
  s.version = Sweetie::VERSION
8
- s.date = '2012-06-05'
8
+ s.date = '2012-07-15'
9
9
  s.authors = ['Matthias Guenther']
10
10
  s.email = 'matthias.guenther@wikimatze.de'
11
11
  s.homepage = 'https://github.com/matthias-guenther/sweetie'
12
12
 
13
13
  s.summary = %q{Count links, images, number of html pages, and last-build time of a
14
- jekyll project + last changes of bitbucket repositories.}
14
+ jekyll project. In addition it can get last updates of all bitbucket
15
+ repositories of a user.}
16
+
15
17
  s.description = %q{Sweetie counts the links, images, number of html pages, and last-build
16
18
  time of a jekyll project. In addition it can get the last changes of all
17
- bitbuckets repositories of a certain user.}
18
-
19
- # the files included in the gem
19
+ bitbuckets repositories of a user.}
20
20
  s.files = `git ls-files`.split("\n")
21
21
  # files that are used for the gem (the line supports TestUnit, MiniTest, RSpec, and Cucumber
22
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
- s.require_paths = ["lib"]
23
+ s.require_paths = ['lib']
24
24
 
25
- s.extra_rdoc_files = ["README.md"]
25
+ s.extra_rdoc_files = ['README.md']
26
26
 
27
- s.add_runtime_dependency 'nokogiri', ">= 1.4.6"
28
- s.add_runtime_dependency 'json', ">= 1.6.1"
27
+ s.add_runtime_dependency 'nokogiri', '>= 1.4.6'
28
+ s.add_runtime_dependency 'json', '>= 1.6.1'
29
29
  s.add_development_dependency 'rake'
30
30
  s.add_development_dependency 'rspec'
31
- s.add_development_dependency 'yard'
32
31
 
33
32
  end
34
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweetie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-05 00:00:00.000000000 Z
12
+ date: 2012-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -75,26 +75,9 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: yard
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
78
  description: ! "Sweetie counts the links, images, number of html pages, and last-build\n
95
79
  \ time of a jekyll project. In addition it can get the
96
- last changes of all\n bitbuckets repositories of a certain
97
- user."
80
+ last changes of all\n bitbuckets repositories of a user."
98
81
  email: matthias.guenther@wikimatze.de
99
82
  executables: []
100
83
  extensions: []
@@ -102,7 +85,6 @@ extra_rdoc_files:
102
85
  - README.md
103
86
  files:
104
87
  - .gitignore
105
- - .rspec
106
88
  - .travis.yml
107
89
  - Gemfile
108
90
  - README.md
@@ -113,9 +95,8 @@ files:
113
95
  - lib/sweetie/helper.rb
114
96
  - lib/sweetie/version.rb
115
97
  - spec/source/_config.yml
116
- - spec/source/bitbucket/user_changeset.json
117
- - spec/source/bitbucket/user_changeset_expectation.txt
118
98
  - spec/source/bitbucket/user_repositories.json
99
+ - spec/source/bitbucket/user_repositories_expectation.txt
119
100
  - spec/source/site/404.html
120
101
  - spec/source/site/about.html
121
102
  - spec/source/site/archiv.html
@@ -180,10 +161,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
161
  version: '0'
181
162
  requirements: []
182
163
  rubyforge_project:
183
- rubygems_version: 1.8.23
164
+ rubygems_version: 1.8.24
184
165
  signing_key:
185
166
  specification_version: 3
186
167
  summary: Count links, images, number of html pages, and last-build time of a jekyll
187
- project + last changes of bitbucket repositories.
168
+ project. In addition it can get last updates of all bitbucket repositories of a
169
+ user.
188
170
  test_files: []
189
171
  has_rdoc:
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format Fuubar
2
- --color
3
-
@@ -1,30 +0,0 @@
1
- {
2
- "count": 1,
3
- "start": null,
4
- "limit": 15,
5
- "changesets": [
6
- {
7
- "node": "0b1b929fac46",
8
- "files": [
9
- {
10
- "type": "added",
11
- "file": "svn.pdf"
12
- },
13
- {
14
- "type": "added",
15
- "file": "svn.tex"
16
- }
17
- ],
18
- "raw_author": "Matthias Guenther <matthias.guenther@wikimatze.de>",
19
- "utctimestamp": "2011-10-16 19:24:53+00:00",
20
- "author": "wikimatze",
21
- "timestamp": "2011-10-16 21:24:53",
22
- "raw_node": "0b1b929fac46825ab9a445ccc307d078df8ea342",
23
- "parents": [],
24
- "branch": "master",
25
- "message": "initial commit\n",
26
- "revision": null,
27
- "size": -1
28
- }
29
- ]
30
- }
@@ -1 +0,0 @@
1
- {"count"=>1, "start"=>nil, "limit"=>15, "changesets"=>[{"node"=>"0b1b929fac46", "files"=>[{"type"=>"added", "file"=>"svn.pdf"}, {"type"=>"added", "file"=>"svn.tex"}], "raw_author"=>"Matthias Guenther <matthias.guenther@wikimatze.de>", "utctimestamp"=>"2011-10-16 19:24:53+00:00", "author"=>"wikimatze", "timestamp"=>"2011-10-16 21:24:53", "raw_node"=>"0b1b929fac46825ab9a445ccc307d078df8ea342", "parents"=>[], "branch"=>"master", "message"=>"initial commit\n", "revision"=>nil, "size"=>-1}]}