geny 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/geny/actions/files.rb +29 -0
- data/lib/geny/context/invoke.rb +1 -1
- data/lib/geny/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63e0940e39b3fae585bf25fc2203664e3149a9d4
|
4
|
+
data.tar.gz: 0ce7235f5553af6c59bee867cda1e5ab19fdd70c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e49631f224c2741b318f7cf9f9a16b6fc857d176a4a156453d95b3729f3055f77b50a98eb37e4a4513198d80fa17a096f257928d118de0d8efbb31c04ad56915
|
7
|
+
data.tar.gz: 928ad9248746055f875d874ad19998c57a3185de9774bb4e946bbb8b328e618c1599938672239f5511a60c2d09c661e326e1d45d14f8ea398416d85dcf3bd2c7
|
data/lib/geny/actions/files.rb
CHANGED
@@ -8,6 +8,10 @@ module Geny
|
|
8
8
|
class Files
|
9
9
|
extend Forwardable
|
10
10
|
|
11
|
+
def initialize(ui:)
|
12
|
+
@ui = ui
|
13
|
+
end
|
14
|
+
|
11
15
|
# @!method create
|
12
16
|
# Create a file
|
13
17
|
# @see TTY::File.create
|
@@ -68,6 +72,31 @@ module Geny
|
|
68
72
|
# files.insert("Gemfile", "gem 'geny'", after: /gem 'rails'\n/)
|
69
73
|
def_delegator TTY::File, :safe_inject_into_file, :insert
|
70
74
|
|
75
|
+
# Move a file
|
76
|
+
# @param source [String]
|
77
|
+
# @param dest [String]
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# files.move "Gemfile", "Gemfile.bak"
|
81
|
+
def move(source, dest, force: false, verbose: true)
|
82
|
+
@ui.status("move", source) if verbose
|
83
|
+
FileUtils.mv(source, dest, force: force)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Change directory
|
87
|
+
# @param path [String]
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# files.chdir "foo" do
|
91
|
+
# # do something inside foo/
|
92
|
+
# end
|
93
|
+
def chdir(path, verbose: true, &block)
|
94
|
+
@ui.status("cd", path) if verbose
|
95
|
+
Dir.chdir(path, &block)
|
96
|
+
ensure
|
97
|
+
@ui.status("cd", "-") if verbose
|
98
|
+
end
|
99
|
+
|
71
100
|
# Change the permissions of a file
|
72
101
|
# @see TTY::File.chmod
|
73
102
|
#
|
data/lib/geny/context/invoke.rb
CHANGED
data/lib/geny/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Zane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: argy
|