streaming_wiki 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/swiki +7 -0
- data/lib/streaming_wiki.rb +5 -0
- data/lib/streaming_wiki/cli.rb +27 -0
- data/lib/streaming_wiki/differences.rb +26 -0
- data/lib/streaming_wiki/version.rb +3 -0
- data/streaming_wiki.gemspec +27 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ea7c3632c33dd08f7eee05a907cb8965bf156b102205398d8bb58b3f66ed6e2d
|
4
|
+
data.tar.gz: 88174267559415d1ef4c398a7b5e0800acce3cc251465d1259fd5ca2ccb0583c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 720e99e6d4ee303bbbcf2d7a40f1f53f54236c1fc4683c09e1292f62236e0efc64375c3b3fef0e49f5d2205d96270562527aba19b9ae40f82dbf16b88a6ee322
|
7
|
+
data.tar.gz: 8d4021f0f92f2148a3341fb5aa85c2a0fead31b023cffa3053bfc73735a0b958d643a4f6562f5e52195a8cf8fc4a554df8f21d5f7a691a19d0f1f38865020d83
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in streaming_wiki.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "dotenv", "~> 2.5.0"
|
9
|
+
gem "minitest", "~> 5.0"
|
10
|
+
gem "pry", "~> 0.13.1"
|
11
|
+
gem "rake", "~> 12.0"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Caleb Buxton
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# StreamingWiki
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/streaming_wiki`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'streaming_wiki'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install streaming_wiki
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cpb/streaming_wiki.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "streaming_wiki"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/swiki
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "thor"
|
3
|
+
require "listen"
|
4
|
+
require "git"
|
5
|
+
|
6
|
+
require "pry"
|
7
|
+
|
8
|
+
require "streaming_wiki/differences"
|
9
|
+
|
10
|
+
module StreamingWiki
|
11
|
+
class Cli < Thor
|
12
|
+
|
13
|
+
desc "live [PATH]", "watches for changes and pushes ./wiki or PATH"
|
14
|
+
def live(path="./wiki")
|
15
|
+
logger = Logger.new(STDOUT)
|
16
|
+
git = Git.open(path, log: logger)
|
17
|
+
listen = Listen.to(path) do |modified, added, removed|
|
18
|
+
Differences.in(git).commit("notes")
|
19
|
+
git.push
|
20
|
+
end
|
21
|
+
listen.start
|
22
|
+
sleep
|
23
|
+
rescue
|
24
|
+
binding.pry
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module StreamingWiki
|
2
|
+
class Differences
|
3
|
+
class NoopCommit
|
4
|
+
def commit(*)
|
5
|
+
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.in(base)
|
10
|
+
adds = base.status.untracked.merge(base.status.changed)
|
11
|
+
removes = base.status.deleted
|
12
|
+
|
13
|
+
return NoopCommit.new if adds.empty? && removes.empty?
|
14
|
+
|
15
|
+
adds.each do |path, diff|
|
16
|
+
base.add(path)
|
17
|
+
end
|
18
|
+
|
19
|
+
removes.each do |path, diff|
|
20
|
+
base.remove(path)
|
21
|
+
end
|
22
|
+
|
23
|
+
base
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'lib/streaming_wiki/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "streaming_wiki"
|
5
|
+
spec.version = StreamingWiki::VERSION
|
6
|
+
spec.authors = ["Caleb Buxton"]
|
7
|
+
spec.email = ["me+streaming_wiki@cpb.ca"]
|
8
|
+
|
9
|
+
spec.summary = %q{Streams changes to a remote git wiki}
|
10
|
+
spec.description = %q{Watches a markdown git wiki for changes, automatically commits and pushes.}
|
11
|
+
spec.homepage = "https://gitlab.com/cpb.ca/streaming_wiki"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "git", "~> 1.7.0"
|
25
|
+
spec.add_dependency "listen", "~> 3.1.5"
|
26
|
+
spec.add_dependency "thor", "~> 1.0.1"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: streaming_wiki
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Caleb Buxton
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.7.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.7.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: listen
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.1
|
55
|
+
description: Watches a markdown git wiki for changes, automatically commits and pushes.
|
56
|
+
email:
|
57
|
+
- me+streaming_wiki@cpb.ca
|
58
|
+
executables:
|
59
|
+
- swiki
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- exe/swiki
|
71
|
+
- lib/streaming_wiki.rb
|
72
|
+
- lib/streaming_wiki/cli.rb
|
73
|
+
- lib/streaming_wiki/differences.rb
|
74
|
+
- lib/streaming_wiki/version.rb
|
75
|
+
- streaming_wiki.gemspec
|
76
|
+
homepage: https://gitlab.com/cpb.ca/streaming_wiki
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.3.0
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubygems_version: 3.1.4
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Streams changes to a remote git wiki
|
99
|
+
test_files: []
|