sink_utility 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1e5193a165bb9d878bf82e1f8fb87ce71a111a82
4
+ data.tar.gz: 0a847d15d0a7ff224a52b2e8d3c0b581221ea235
5
+ SHA512:
6
+ metadata.gz: 9abb94effcf42b3a9fb8969c8608af8162b025268fb68d9396110f91a179e657c1a7fcdfb9fb4262049e5623414e607452e8af79b730c336365cce5582906896
7
+ data.tar.gz: a1d9211a4de223fcc7ea624d2f971a5d63658a2b2310847d82c7f0f980b9b210dba38863be76e1866353e0ddf741e99ac773c92ad433e9281dd126dd41144565
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sink_utility.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Grantlyk
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Sink
2
+
3
+ Sink was inspired by the DDoS of github and was created to help keep its users secure in knowing that their repo is safer as it's shared among several hosting services rather than one.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'sink'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install sink
18
+
19
+ ## Usage
20
+
21
+ ### Basic
22
+ Currently Sink is in its very early stages and therefore has basic functionality, the basic idea behind sink version 0.1.0 is to be able to "Sink" (Sync) a github/bitbucket repo with a bitbucket/github repo. To use the software you will first need a github/bitbucket repo and an account on both services, once you have the repo that you want to "back up" on the opposite hosting service, you must go to the opposite hosting service and create a repo, then you may continue with this setup.
23
+
24
+ ** Sink can currently only be used for one Repo at a time
25
+
26
+ ### Setup
27
+ To begin setup run:
28
+
29
+ $ sink setup
30
+
31
+ and follow the on screen prompts
32
+
33
+ ### Sync all repos
34
+ To Sync all repositories run:
35
+
36
+ $ sink all
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/sink ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+ require 'sink_utility'
3
+
4
+ user = SinkUtility::User.new
5
+ initit = SinkUtility::Initialize.new
6
+
7
+ case ARGV[0]
8
+ when "setup"
9
+ repo_type = nil
10
+ puts "Is your current git repo a github repo or a bitbucket repo?"
11
+ repo_type = STDIN.gets.chomp
12
+ case repo_type.downcase
13
+ when "bitbucket"
14
+ initit.bitbucket()
15
+ puts "Please enter your github username"
16
+ username = STDIN.gets.chomp
17
+ puts "Please enter the name of your Github repo"
18
+ repo_name = STDIN.gets.chomp
19
+ initit.remote_add(repo_type, username, repo_name)
20
+ when "github"
21
+ initit.github()
22
+ puts "Please enter your bitbucket username"
23
+ username = STDIN.gets.chomp
24
+ puts "Please enter the name of your Bitbucket repo"
25
+ repo_name = STDIN.gets.chomp
26
+ initit.remote_add(repo_type, username, repo_name)
27
+ else
28
+ puts "Invalid entry"
29
+ end
30
+ when "init"
31
+ user.setup(ARGV[2])
32
+ when "all"
33
+ store = YAML::Store.new("data.yml")
34
+ setup_check = store.transaction { store[:setup_complete] } if store.transaction { store[:setup_complete] }
35
+ if setup_check == true
36
+ `git push github HEAD`
37
+ `git push bitbucket HEAD`
38
+ else
39
+ puts "Please run sink setup first"
40
+ end
41
+ when "github"
42
+ `git push github HEAD` if store.transaction { store[:setup_complete] }
43
+ when "bitbucket"
44
+ `git push bitbucket HEAD` if store.transaction { store[:setup_complete] }
45
+ when "version"
46
+ puts SinkUtility::VERSION
47
+ when "me"
48
+ puts user.current_users()
49
+ else
50
+ puts "Command not recognised, soz"
51
+ end
@@ -0,0 +1,3 @@
1
+ module SinkUtility
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,55 @@
1
+ require "sink_utility/version"
2
+ require "yaml/store"
3
+
4
+ module SinkUtility
5
+ class Initialize
6
+ def bitbucket
7
+ `git remote rename origin bitbucket`
8
+ end
9
+ def github
10
+ `git remote rename origin github`
11
+ end
12
+ def remote_add(repo_type, username, repo_name)
13
+ store = YAML::Store.new("data.yml")
14
+ case repo_type.downcase
15
+ when "github"
16
+ `git remote add bitbucket git@bitbucket.org:#{username}/#{repo_name}.git`
17
+ store.transaction do
18
+ store[:setup_complete] = true
19
+ end
20
+ when "bitbucket"
21
+ `git remote add github git@github.com/#{username}/#{repo_name}.git`
22
+ store.transaction do
23
+ store[:setup_complete] = true
24
+ end
25
+ else
26
+ puts "Invalid repo type"
27
+ end
28
+ end
29
+ end
30
+ class User
31
+ def setup(username)
32
+ case ARGV[1]
33
+ when "bitbucket"
34
+ store = YAML::Store.new("data.yml")
35
+ store.transaction do
36
+ store[:bitbucket_user] = username
37
+ end
38
+ when "github"
39
+ store = YAML::Store.new("data.yml")
40
+ store.transaction do
41
+ store[:github_user] = username
42
+ end
43
+ else
44
+ puts "Please specify either github or bitbucket"
45
+ end
46
+ end
47
+ def current_users
48
+ store = YAML::Store.new("data.yml")
49
+ current_users = []
50
+ current_users << "Bitbucket: " + store.transaction { store[:bitbucket_user] }
51
+ current_users << "Github: " + store.transaction { store[:github_user] }
52
+ return current_users
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sink_utility/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sink_utility"
8
+ spec.version = SinkUtility::VERSION
9
+ spec.authors = ["Grantlyk"]
10
+ spec.email = ["grant@nespite.io"]
11
+ spec.description = %q{Sink was inspired by the DDoS of github and was created to help keep its users secure in knowing that their repo is safer as it's shared among several hosting services rather than one}
12
+ spec.summary = %q{Sink is a command line tool created to sync your github to your bitbucket}
13
+ spec.homepage = "http://www.nespite.io"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = ["sink"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sink_utility
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Grantlyk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-30 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: Sink was inspired by the DDoS of github and was created to help keep
42
+ its users secure in knowing that their repo is safer as it's shared among several
43
+ hosting services rather than one
44
+ email:
45
+ - grant@nespite.io
46
+ executables:
47
+ - sink
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - .gitignore
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - bin/sink
57
+ - lib/sink_utility.rb
58
+ - lib/sink_utility/version.rb
59
+ - sink_utility.gemspec
60
+ homepage: http://www.nespite.io
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.4.4
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Sink is a command line tool created to sync your github to your bitbucket
84
+ test_files: []