gimme-octo-kitty-wiki 0.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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Joshua Nichols
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ = gimme-octo-kitty-wiki
2
+
3
+ A script to pull down a project's wiki on GitHub locally.
4
+
5
+ gimme-octo-kitty-wiki technicalpickles jeweler
6
+
7
+ == Note on Patches/Pull Requests
8
+
9
+ * Fork the project.
10
+ * Make your feature addition or bug fix.
11
+ * Add tests for it. This is important so I don't break it in a
12
+ future version unintentionally.
13
+ * Commit, do not mess with rakefile, version, or history.
14
+ (if you want to have your own version, that is fine but
15
+ bump version in a commit by itself I can ignore when I pull)
16
+ * Send me a pull request. Bonus points for topic branches.
17
+
18
+ == Copyright
19
+
20
+ Copyright (c) 2009 Joshua Nichols. See LICENSE for details.
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "gimme-octo-kitty-wiki"
8
+ gem.summary = %Q{A script to pull down a project's wiki on GitHub locally.}
9
+ gem.description = %Q{GitHub's wiki doesn't currently have an API to call it's own, so this gem was created as a stopgap. For now, it lets you pull down the content of a project's GitHub wiki}
10
+ gem.email = "josh@technicalpickles.com"
11
+ gem.homepage = "http://github.com/technicalpickles/gimme-octo-kitty-wiki"
12
+ gem.authors = ["Joshua Nichols"]
13
+ gem.add_dependency 'nokogiri'
14
+ gem.add_dependency 'stringex'
15
+ gem.add_dependency 'git'
16
+
17
+ gem.add_development_dependency "rspec"
18
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
23
+ end
24
+
25
+ require 'spec/rake/spectask'
26
+ Spec::Rake::SpecTask.new(:spec) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.spec_files = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
32
+ spec.libs << 'lib' << 'spec'
33
+ spec.pattern = 'spec/**/*_spec.rb'
34
+ spec.rcov = true
35
+ end
36
+
37
+ task :spec => :check_dependencies
38
+
39
+ task :default => :spec
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ if File.exist?('VERSION')
44
+ version = File.read('VERSION')
45
+ else
46
+ version = ""
47
+ end
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "gimme-octo-kitty-wiki #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'github_wiki'
6
+
7
+ username = ARGV[0]
8
+ repo = ARGV[1]
9
+
10
+ wiki_directory = "#{username}-#{repo}-wiki"
11
+
12
+
13
+ scrapper = GithubWiki::Scrapper.new(username, repo)
14
+ scrapper.run
15
+
16
+ puts "#{username}/#{repo} wiki has been scrapped into #{wiki_directory}"
File without changes
@@ -0,0 +1,53 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+ require 'stringex'
4
+ require 'git'
5
+
6
+ class GithubWiki
7
+ class Scrapper
8
+ def initialize(github_user, github_repo, output_directory = nil)
9
+ @output_directory = output_directory || "#{github_user}-#{github_repo}-wiki"
10
+
11
+ @github_user, @github_repo = github_user, github_repo
12
+
13
+ end
14
+
15
+ def index_url
16
+ "http://wiki.github.com/#{@github_user}/#{@github_repo}"
17
+ end
18
+
19
+ def build_edit_url(page_slug)
20
+ my_user = Git.global_config('github.user')
21
+ my_token = Git.global_config('github.token')
22
+
23
+ "http://github.com/#{@github_user}/#{@github_repo}/wikis/#{page_slug}/edit?login=#{my_user}&token=#{my_token}"
24
+ end
25
+
26
+ def run
27
+ doc = Nokogiri::HTML(open(index_url))
28
+
29
+ FileUtils.mkdir_p @output_directory
30
+
31
+ doc.search('.sidebar ul li a').each do |page_link|
32
+ page_title = page_link.content
33
+ page_slug = page_title.to_url
34
+
35
+ edit_url = build_edit_url(page_slug)
36
+ edit_html = open(edit_url)
37
+ edit_doc = Nokogiri::HTML(edit_html)
38
+
39
+ textile = nil
40
+ edit_doc.search('textarea').each do |wiki_body|
41
+ textile = wiki_body.content
42
+ end
43
+
44
+ File.open("#{@output_directory}/#{page_slug}.textile", "w") do |file|
45
+ file.write textile
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "GimmeOctoKittyWiki" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'gimme-octo-kitty-wiki'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gimme-octo-kitty-wiki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joshua Nichols
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-24 00:00:00 -04:00
13
+ default_executable: gimme-octo-kitty-wiki
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: stringex
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: git
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: rspec
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ description: GitHub's wiki doesn't currently have an API to call it's own, so this gem was created as a stopgap. For now, it lets you pull down the content of a project's GitHub wiki
56
+ email: josh@technicalpickles.com
57
+ executables:
58
+ - gimme-octo-kitty-wiki
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - LICENSE
63
+ - README.rdoc
64
+ files:
65
+ - .document
66
+ - .gitignore
67
+ - LICENSE
68
+ - README.rdoc
69
+ - Rakefile
70
+ - VERSION
71
+ - bin/gimme-octo-kitty-wiki
72
+ - lib/gimme-octo-kitty-wiki.rb
73
+ - lib/github_wiki.rb
74
+ - spec/gimme-octo-kitty-wiki_spec.rb
75
+ - spec/spec_helper.rb
76
+ has_rdoc: true
77
+ homepage: http://github.com/technicalpickles/gimme-octo-kitty-wiki
78
+ licenses: []
79
+
80
+ post_install_message:
81
+ rdoc_options:
82
+ - --charset=UTF-8
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ version:
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ version:
97
+ requirements: []
98
+
99
+ rubyforge_project:
100
+ rubygems_version: 1.3.5
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: A script to pull down a project's wiki on GitHub locally.
104
+ test_files:
105
+ - spec/gimme-octo-kitty-wiki_spec.rb
106
+ - spec/spec_helper.rb