shufu 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +10 -13
- data/lib/shufu/command.rb +18 -0
- data/lib/shufu/line.rb +3 -9
- data/lib/shufu/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb8875c20791059866fce8a4ffca83b5e6e072561200bd585b89a0124ebd7373
|
4
|
+
data.tar.gz: 583e2f2195d76d16144c2aa49d9914f2a6bd2557a7638114b67e2ef08ef1c267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd87095644fce9a66bd244ea53835313134528c3ac68a97a6516a8991abd26c5c2a4b26651cd3d4c5baa72ca78ceb7e1262a2c799e816c36e7f37bc81b2ae35f
|
7
|
+
data.tar.gz: 13fa0f03aaaf03a8b3313224eede86df53c6b05d1ccbf534d66d47e506d8d7fb10fe11c36ac2f746c4853a2707bc65162928b16afb26febc9f605dfffbd909ad
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shufu (0.1.
|
4
|
+
shufu (0.1.1)
|
5
5
|
dry-schema
|
6
6
|
|
7
7
|
GEM
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
dry-core (0.7.1)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
20
|
dry-inflector (0.2.1)
|
21
|
-
dry-initializer (3.1.
|
21
|
+
dry-initializer (3.1.1)
|
22
22
|
dry-logic (1.2.0)
|
23
23
|
concurrent-ruby (~> 1.0)
|
24
24
|
dry-core (~> 0.5, >= 0.5)
|
data/README.md
CHANGED
@@ -23,19 +23,16 @@ Or install it yourself as:
|
|
23
23
|
```ruby
|
24
24
|
require "shufu"
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
author: "cc-kawakami"
|
37
|
-
}
|
38
|
-
).to_s
|
26
|
+
schema = {
|
27
|
+
schema: [
|
28
|
+
{ name: "amend", type: option, flag: true },
|
29
|
+
{ name: "author", type: option, equal: true }
|
30
|
+
]
|
31
|
+
}
|
32
|
+
|
33
|
+
command = Shufu::Command.new("git commit", schema)
|
34
|
+
|
35
|
+
p command.line({ amend: true, author: "cc-kawakami" })
|
39
36
|
|
40
37
|
# git commit --amend --author=cc-kawakami
|
41
38
|
```
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Shufu
|
2
|
+
class InvalidSchemaError < RuntimeError; end
|
3
|
+
|
4
|
+
class Command
|
5
|
+
def initialize(base, schema)
|
6
|
+
@base = base
|
7
|
+
schema = Shufu::Schema.call(schema)
|
8
|
+
if schema.failure?
|
9
|
+
raise Shufu::InvalidSchemaError, schema.errors(full: true).to_h
|
10
|
+
end
|
11
|
+
@schema = schema
|
12
|
+
end
|
13
|
+
|
14
|
+
def line(values)
|
15
|
+
Line.new(@base, @schema, values).to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/shufu/line.rb
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
module Shufu
|
2
|
-
class InvalidSchemaError < RuntimeError; end
|
3
|
-
|
4
2
|
class Line
|
5
|
-
def initialize(
|
6
|
-
@
|
7
|
-
schema = Shufu::Schema.call(schema)
|
8
|
-
if schema.failure?
|
9
|
-
raise Shufu::InvalidSchemaError, schema.errors(full: true).to_h
|
10
|
-
end
|
3
|
+
def initialize(base, schema, values)
|
4
|
+
@base = base
|
11
5
|
@schema = schema
|
12
6
|
@values = values
|
13
7
|
end
|
14
8
|
|
15
9
|
def to_s
|
16
|
-
[@
|
10
|
+
[@base, items].flatten.join(" ")
|
17
11
|
end
|
18
12
|
|
19
13
|
def items
|
data/lib/shufu/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shufu
|
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
|
- cc-kawakami
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- README.md
|
38
38
|
- Rakefile
|
39
39
|
- lib/shufu.rb
|
40
|
+
- lib/shufu/command.rb
|
40
41
|
- lib/shufu/item.rb
|
41
42
|
- lib/shufu/line.rb
|
42
43
|
- lib/shufu/schema.rb
|