geny 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd2c052d9f741cbe22bc07f6a332f9cff359f1b8
4
- data.tar.gz: a6d6c1a14bebd8595fd9f7728884d47a5051d4d6
3
+ metadata.gz: beb9f0d7d2aa0eb72a51e348333886960c517a90
4
+ data.tar.gz: 8d8abe00a79e1abb08cb9e01290979e8c0a50353
5
5
  SHA512:
6
- metadata.gz: d3dc0a083fa1b61ace358d50698763c0d9f230b4d4b7fa9e3ecb6e04d9e8520e99e0a7ace4813627fbc44f6dd9571f552e77165d8a8a73c21c8b4984b9bca41c
7
- data.tar.gz: 4038ffaab463379e9ec4db8b9fe625e019ad3c15fc94ef7ea897358553d58932b0714aefb480da022eadf0dd1cb2275555015192a883a6e2ad818a30d306e54a
6
+ metadata.gz: d29982e9852f6505962d7befe63b437d12ff8f800230d293e2206547d941558c6689c93218c78fa4360fafc85511d4981781e51079ce2fa2f98866f2b46d0398
7
+ data.tar.gz: 733c66e1014488035c764630bdeb5eb71e07745d5e23bed939eeecfcb189f368f1e3115d16eb26ce74a740b48f80f7c71c7ad85e21918dc1be9f59208c81e459
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ /Gemfile.lock
@@ -1,3 +1,4 @@
1
+ require "forwardable"
1
2
  require "tty-file"
2
3
 
3
4
  module Geny
@@ -5,76 +6,70 @@ module Geny
5
6
  # Utilities for manipulating files.
6
7
  # @see https://rubydoc.info/github/piotrmurach/tty-file/master/TTY/File TTY::File
7
8
  class Files
9
+ extend Forwardable
10
+
11
+ # @!method create
8
12
  # Create a file
13
+ # @see TTY::File.create
9
14
  #
10
15
  # @example
11
16
  # files.create("test.txt")
12
17
  # files.create("test.txt", "hello!")
13
18
  # files.remove("test.txt", force: true)
14
- def create(*args)
15
- TTY::File.create_file(*args)
16
- end
19
+ def_delegator TTY::File, :create_file, :create
17
20
 
21
+ # @!method create_dir
18
22
  # Create a directory recursively
23
+ # @see TTY::File.create_dir
19
24
  #
20
25
  # @example
21
26
  # files.create_dir("app/controllers")
22
- def create_dir(*args)
23
- TTY::File.create_dir(*args)
24
- end
27
+ def_delegator TTY::File, :create_dir
25
28
 
29
+ # @!method remove
26
30
  # Remove a file
31
+ # @see TTY::File.remove_file
27
32
  #
28
33
  # @example
29
- # files.remove("tmp")
30
- # files.remove("tmp", force: true)
31
- def remove(*args)
32
- TTY::File.remove_file(*args)
33
- end
34
+ # files.remove("test.txt")
35
+ # files.remove("test.txt", force: true)
36
+ def_delegator TTY::File, :remove_file, :remove
34
37
 
38
+ # @!method prepend
35
39
  # Add a line to the top of a file
40
+ # @see TTY::File.safe_prepend_to_file
36
41
  #
37
42
  # @example
38
43
  # files.prepend("Gemfile", "gem 'geny'")
39
- def prepend(*args)
40
- TTY::File.safe_prepend_to_file(*args)
41
- end
44
+ def_delegator TTY::File, :safe_prepend_to_file, :prepend
42
45
 
46
+ # @!method append
43
47
  # Add a line to the bottom of a file
48
+ # @see TTY::File.safe_append_to_file
44
49
  #
45
50
  # @example
46
51
  # files.append("Gemfile", "gem 'geny'")
47
- def append(*args)
48
- TTY::File.safe_append_to_file(*args)
49
- end
52
+ def_delegator TTY::File, :safe_append_to_file, :append
50
53
 
54
+ # @!method replace
51
55
  # Replace content in a file
56
+ # @see TTY::File.replace_in_file
52
57
  #
53
58
  # @example
54
59
  # files.replace("Gemfile", /foo/, "bar")
55
- def replace(*args)
56
- TTY::File.replace_in_file(*args)
57
- end
58
-
59
- # Insert a line before a matching line in a file
60
- #
61
- # @example
62
- # files.insert_before("Gemfile", /gem "rails"/, "gem 'geny'")
63
- def insert_before(path, pattern, content, **opts)
64
- opts = {before: pattern, **opts}
65
- TTY::File.safe_inject_into_file(path, content, opts)
66
- end
60
+ def_delegator TTY::File, :replace_in_file, :replace
67
61
 
68
- # Insert a line after a matching line in a file
62
+ # @!method insert
63
+ # Insert content in a file before or after a matching pattern
64
+ # @see TTY::File.safe_inject_into_file
69
65
  #
70
66
  # @example
71
- # files.insert_after("Gemfile", /gem "rails"\n/, "gem 'geny'")
72
- def insert_after(path, pattern, content, **opts)
73
- opts = {after: pattern, **opts}
74
- TTY::File.safe_inject_into_file(path, content, opts)
75
- end
67
+ # files.insert("Gemfile", "gem 'geny'", before: /gem 'rails'/)
68
+ # files.insert("Gemfile", "gem 'geny'", after: /gem 'rails'\n/)
69
+ def_delegator TTY::File, :safe_inject_into_file, :insert
76
70
 
77
71
  # Change the permissions of a file
72
+ # @see TTY::File.chmod
78
73
  #
79
74
  # @example
80
75
  # files.chmod("bin/test", "+x")
data/lib/geny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Geny
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geny
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Zane
@@ -136,7 +136,6 @@ files:
136
136
  - ".yardopts"
137
137
  - CODE_OF_CONDUCT.md
138
138
  - Gemfile
139
- - Gemfile.lock
140
139
  - LICENSE.txt
141
140
  - README.md
142
141
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,69 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- geny (1.0.0)
5
- argy (~> 0.2.2)
6
- pastel (~> 0.7.3)
7
- tty-file (~> 0.8.0)
8
- tty-prompt (~> 0.20.0)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- argy (0.2.2)
14
- diff-lcs (1.3)
15
- docile (1.3.2)
16
- equatable (0.6.1)
17
- json (2.3.0)
18
- necromancer (0.5.1)
19
- pastel (0.7.3)
20
- equatable (~> 0.6)
21
- tty-color (~> 0.5)
22
- rake (10.5.0)
23
- rspec (3.9.0)
24
- rspec-core (~> 3.9.0)
25
- rspec-expectations (~> 3.9.0)
26
- rspec-mocks (~> 3.9.0)
27
- rspec-core (3.9.0)
28
- rspec-support (~> 3.9.0)
29
- rspec-expectations (3.9.0)
30
- diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.9.0)
32
- rspec-mocks (3.9.0)
33
- diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.9.0)
35
- rspec-support (3.9.0)
36
- simplecov (0.17.1)
37
- docile (~> 1.1)
38
- json (>= 1.8, < 3)
39
- simplecov-html (~> 0.10.0)
40
- simplecov-html (0.10.2)
41
- tty-color (0.5.0)
42
- tty-cursor (0.7.0)
43
- tty-file (0.8.0)
44
- diff-lcs (~> 1.3)
45
- pastel (~> 0.7.2)
46
- tty-prompt (~> 0.18)
47
- tty-prompt (0.20.0)
48
- necromancer (~> 0.5.0)
49
- pastel (~> 0.7.0)
50
- tty-reader (~> 0.7.0)
51
- tty-reader (0.7.0)
52
- tty-cursor (~> 0.7)
53
- tty-screen (~> 0.7)
54
- wisper (~> 2.0.0)
55
- tty-screen (0.7.0)
56
- wisper (2.0.1)
57
-
58
- PLATFORMS
59
- ruby
60
-
61
- DEPENDENCIES
62
- bundler (~> 2.0)
63
- geny!
64
- rake (~> 10.0)
65
- rspec (~> 3.0)
66
- simplecov (~> 0.17.1)
67
-
68
- BUNDLED WITH
69
- 2.0.2