gistim 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github.url +1 -0
- data/.rubygems.url +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +25 -8
- data/exe/gistim +13 -4
- data/lib/gistim/clone.rb +11 -0
- data/lib/gistim/create.rb +58 -0
- data/lib/gistim/version.rb +1 -1
- data/lib/gistim.rb +4 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c28928cf1dc92cb6a9109e5006c46aea31718e09b5011b8e38f489c741d83127
|
4
|
+
data.tar.gz: 7c6a1d4d6797d02421bc388458a6c4ca17094ddc103d262e79708ad35b02ca87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b047dee82c692140bd614751e01370e38ac270ce7abb0261de4d8814ab7178c493d0edb2220594e2914fab6205b00c34049efdb6bd96b31a652d5c09d55ac34
|
7
|
+
data.tar.gz: 862071d90863a5cee45ff380f053aedf6c16be520af07a26696b87ab80193dccd939e4ec6113fdc482beeeb141692e26bb05a27cbf32a06c6151fc6cf7ad5664
|
data/.github.url
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
https://github.com/YumaInaura/gistim
|
data/.rubygems.url
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
https://rubygems.org/gems/gistim
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,22 +2,39 @@
|
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
gem 'gistim'
|
5
|
+
```
|
6
|
+
$ gem install gistim
|
9
7
|
```
|
10
8
|
|
11
|
-
|
9
|
+
## Ready
|
12
10
|
|
13
|
-
|
11
|
+
```
|
12
|
+
gist --login
|
13
|
+
```
|
14
14
|
|
15
|
-
|
15
|
+
( Not `gistim --login` )
|
16
16
|
|
17
|
-
|
17
|
+
And enable access to github by git protocol.
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
We can clone both specify hash or URL.
|
22
|
+
|
23
|
+
```
|
24
|
+
gistim clone 32b6d6ba379d4a65d22c06e3f8d284c0
|
25
|
+
```
|
26
|
+
|
27
|
+
```
|
28
|
+
gistim clone https://gist.github.com/YumaInaura/32b6d6ba379d4a65d22c06e3f8d284c0
|
29
|
+
```
|
30
|
+
|
31
|
+
Even if you specify https URL gistim clone by git protocol. Because we can push to Gist repository by git protocol.
|
32
|
+
|
33
|
+
We can specifiy directory name.
|
34
|
+
|
35
|
+
```
|
36
|
+
gistim clone https://gist.github.com/YumaInaura/32b6d6ba379d4a65d22c06e3f8d284c0 mac_replace_clipboard
|
37
|
+
```
|
21
38
|
|
22
39
|
## Development
|
23
40
|
|
data/exe/gistim
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'pry'
|
4
|
+
require 'gistim'
|
5
|
+
|
3
6
|
subcommand = ARGV[0]
|
4
7
|
|
5
8
|
if subcommand == 'clone'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
Gistim::Clone.clone(ARGV[1], clone_directory: ARGV[2])
|
10
|
+
elsif subcommand == 'create'
|
11
|
+
Gistim::Create.new(alias_name: ARGV[1]).create
|
12
|
+
else
|
13
|
+
puts <<~TEXT
|
14
|
+
=====================================
|
15
|
+
$ gistim command delegated to $ gist command
|
16
|
+
=====================================
|
17
|
+
TEXT
|
18
|
+
puts `gist #{ARGV.join(' ')}`
|
9
19
|
end
|
10
20
|
|
11
|
-
|
data/lib/gistim/clone.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
module Gistim
|
2
|
+
class Create
|
3
|
+
def initialize(alias_name: nil)
|
4
|
+
@alias_name = alias_name
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :alias_name
|
8
|
+
|
9
|
+
def create
|
10
|
+
File.write(initialize_file_path, 'Wellcome to Gist! ( created by gistim )')
|
11
|
+
|
12
|
+
create_empty
|
13
|
+
clone
|
14
|
+
|
15
|
+
File.delete(initialize_file_path)
|
16
|
+
|
17
|
+
# FIME: write good structured work flow and good test
|
18
|
+
# File.write("#{clone_directory}/.gist.url", gist_url)
|
19
|
+
# File.write("#{clone_directory}/.gist.hash", gist_hash)
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def gist_hash
|
25
|
+
gist_url.chomp.gsub(/\A.+\//, '')
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def clone
|
31
|
+
Clone.clone(gist_url, clone_directory: clone_directory)
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_empty
|
35
|
+
# Execute `$ gist [some_file]` command and get gist url result
|
36
|
+
@gist_url ||= `gist #{initialize_file_path}`.chomp
|
37
|
+
end
|
38
|
+
|
39
|
+
def gist_url
|
40
|
+
@gist_url ||= create_empty
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize_file_path
|
44
|
+
'.gistim.tmp'
|
45
|
+
end
|
46
|
+
|
47
|
+
def clone_directory
|
48
|
+
alias_name || gist_hash
|
49
|
+
end
|
50
|
+
|
51
|
+
# public
|
52
|
+
class << self
|
53
|
+
def implement
|
54
|
+
self.class.new.create
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/gistim/version.rb
CHANGED
data/lib/gistim.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gistim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yumainaura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gist
|
@@ -88,8 +88,10 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
+
- ".github.url"
|
91
92
|
- ".gitignore"
|
92
93
|
- ".rspec"
|
94
|
+
- ".rubygems.url"
|
93
95
|
- ".travis.yml"
|
94
96
|
- CODE_OF_CONDUCT.md
|
95
97
|
- Gemfile
|
@@ -102,6 +104,8 @@ files:
|
|
102
104
|
- exe/gistim
|
103
105
|
- gistim.gemspec
|
104
106
|
- lib/gistim.rb
|
107
|
+
- lib/gistim/clone.rb
|
108
|
+
- lib/gistim/create.rb
|
105
109
|
- lib/gistim/version.rb
|
106
110
|
homepage: https://github.com/YumaInaura/gistim
|
107
111
|
licenses:
|