vimfluence 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 928465b5411265f890eb4eb83b2e72a6568c220c
4
+ data.tar.gz: d2b94170969fe4c0fb15787b50313fd3ad321c97
5
+ SHA512:
6
+ metadata.gz: 559f675a8fa44e83f50a0e30af79a094d716f75702167b73f7203d5f17c31ba80b8c7573027a5fd7ac084a3ba2e28fe244e20822ac834c2f0f4746ced1542f9f
7
+ data.tar.gz: db6892c80781d633ace65b41a82fc81fd955d587150088cf263ad3758a22f6c389a7ed6fab16ecf860e8d465e4c88b25a902ccbbf4ffc44f5858de0086dfc64f
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vimfluence.rb.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2013, sumit shah
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ Redistributions in binary form must reproduce the above copyright notice, this
11
+ list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
13
+
14
+ Neither the name of the {organization} nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ vimfluence.rb
2
+ =============
3
+
4
+ Pure ruby version of https://github.com/orlandov/vimfluence
5
+
6
+ To use:
7
+
8
+ vimfluence.rb: `vimfluence PageSpace "Wiki Page"`
9
+
10
+ Settings:
11
+
12
+ Location of confluence wiki
13
+ `export WIKI_URL=http://hub.example.com/wiki`
14
+
15
+ Confluence user (or defaults to `Etc.login`)
16
+ `export WIKI_USER=bob`
17
+
18
+ Confluence user password
19
+ `export WIKI_PASS=insecure`
20
+
21
+ or use value stored in OSX keychain
22
+
23
+ `export WIKI_PASS_KEYCHAIN_KEY=keychain_key`
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/vimfluence ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'etc'
5
+ require 'nokogiri'
6
+ require 'tempfile'
7
+ require 'xmlrpc/client'
8
+
9
+ SPACE = ARGV[0]
10
+ PAGE = ARGV[1]
11
+ URL = ENV["WIKI_URL"]
12
+ WIKI_USER = ENV["WIKI_USER"] || Etc.getlogin
13
+ WIKI_PASS = ENV["WIKI_PASS"] || `security find-generic-password -g -w -s #{ENV["WIKI_PASS_KEYCHAIN_KEY"]}`.strip
14
+ client = XMLRPC::Client.new2("#{URL}/rpc/xmlrpc")
15
+ client.http_header_extra = {"Accept-Encoding" => "identity"}
16
+ client = client.proxy("confluence2")
17
+ token = client.login(WIKI_USER, WIKI_PASS)
18
+ page = client.getPage(token, SPACE, PAGE)
19
+ file = Tempfile.new(["#{SPACE}-#{PAGE}", '.xml'])
20
+ old_content = page["content"]
21
+ file.write(old_content)
22
+ system("vim '#{file.path}'")
23
+ new_content = File.read(file.path)
24
+ unless old_content.eql? new_content
25
+ page["content"] = new_content
26
+ client.storePage(token, page)
27
+ `open #{page["url"]}`
28
+ end
29
+ file.unlink
30
+ client.logout(token)
@@ -0,0 +1,3 @@
1
+ module Vimfluence
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vimfluence/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vimfluence"
8
+ spec.version = Vimfluence::VERSION
9
+ spec.authors = ["Sumit Shah"]
10
+ spec.email = ["perdant@gmail.com"]
11
+ spec.description = %q{Edit Confluence with Vim}
12
+ spec.summary = %q{Edit Confluence with Vim}
13
+ spec.homepage = "http://github.com/bigloser/vimfluence.rb"
14
+ spec.license = "BSD"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.add_development_dependency "bundler", "~> 1.3"
19
+ spec.add_development_dependency "rake"
20
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vimfluence
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sumit Shah
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Edit Confluence with Vim
42
+ email:
43
+ - perdant@gmail.com
44
+ executables:
45
+ - vimfluence
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - bin/vimfluence
54
+ - lib/vimfluence/version.rb
55
+ - vimfluence.gemspec
56
+ homepage: http://github.com/bigloser/vimfluence.rb
57
+ licenses:
58
+ - BSD
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.3
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Edit Confluence with Vim
80
+ test_files: []