stg 0.1.2 → 0.1.3
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/lib/actions.rb +6 -9
- data/lib/stg.rb +40 -43
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a24fa114435be573b5b125dc7631052ba02e9b87c071d900aef8be5dd3c771e3
|
|
4
|
+
data.tar.gz: ae2e3189797eb7f737bf2e6f44502458dbf0567d69c8659a1adf18c5a7619a0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9b91105669be9f1b50129e3c347af9c7b9dc6adfd1d476d7c015005db0990927848956587961f16f6e3cd8a134edfc4cf4707ea720bd78423110d807e197e7e
|
|
7
|
+
data.tar.gz: c19cea532598c24f46e8743f6f5af524d087780730b19e1081cc0318dea0ec2a68757effdd440429384e17107abf714161f302f4d9daf90f861a7e0206029fd8
|
data/lib/actions.rb
CHANGED
|
@@ -63,7 +63,7 @@ module Actions
|
|
|
63
63
|
|
|
64
64
|
index = JSON.parse(File.read('.stolen-git/index.json'))
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
stage_file = lambda do |file_path|
|
|
67
67
|
file_hash = get_file_hash(file_path)
|
|
68
68
|
file_content = File.read(file_path)
|
|
69
69
|
|
|
@@ -78,16 +78,13 @@ module Actions
|
|
|
78
78
|
index[file_path]['hash'] = file_hash
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
stage_directory = lambda do |dir_path|
|
|
82
82
|
Dir.children(dir_path).each do |entry|
|
|
83
|
-
# puts "entry: #{entry}"
|
|
84
83
|
path = File.join(dir_path, entry)
|
|
85
84
|
if File.file?(path)
|
|
86
|
-
|
|
87
|
-
stage_file(path)
|
|
85
|
+
stage_file.call(path)
|
|
88
86
|
else
|
|
89
|
-
|
|
90
|
-
stage_directory(path)
|
|
87
|
+
stage_directory.call(path)
|
|
91
88
|
end
|
|
92
89
|
end
|
|
93
90
|
end
|
|
@@ -99,9 +96,9 @@ module Actions
|
|
|
99
96
|
end
|
|
100
97
|
|
|
101
98
|
if File.file?(inp_path)
|
|
102
|
-
stage_file(inp_path)
|
|
99
|
+
stage_file.call(inp_path)
|
|
103
100
|
elsif File.directory? inp_path
|
|
104
|
-
stage_directory(inp_path)
|
|
101
|
+
stage_directory.call(inp_path)
|
|
105
102
|
else
|
|
106
103
|
puts "Error logging #{inp_path}. It's neither a file or a directory"
|
|
107
104
|
end
|
data/lib/stg.rb
CHANGED
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
require_relative 'help'
|
|
2
2
|
require_relative 'actions'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
when '
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
when 'stage'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
when '
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else
|
|
45
|
-
puts "Unknown command: #{command}"
|
|
46
|
-
exit 1
|
|
4
|
+
module Stg
|
|
5
|
+
class CLI
|
|
6
|
+
extend Actions
|
|
7
|
+
extend Help
|
|
8
|
+
|
|
9
|
+
def self.start
|
|
10
|
+
command = ARGV.shift
|
|
11
|
+
case command
|
|
12
|
+
when 'init'
|
|
13
|
+
p_initialize
|
|
14
|
+
when 'commit'
|
|
15
|
+
commit
|
|
16
|
+
when 'diff'
|
|
17
|
+
diff
|
|
18
|
+
when 'test'
|
|
19
|
+
test
|
|
20
|
+
when 'stage'
|
|
21
|
+
stage
|
|
22
|
+
when 'check_router'
|
|
23
|
+
check_router
|
|
24
|
+
when 'reset'
|
|
25
|
+
reset
|
|
26
|
+
when 'log'
|
|
27
|
+
log
|
|
28
|
+
when 'checkout'
|
|
29
|
+
checkout
|
|
30
|
+
when 'branch'
|
|
31
|
+
branch
|
|
32
|
+
when 'help'
|
|
33
|
+
puts print_usage
|
|
34
|
+
exit 1
|
|
35
|
+
when nil
|
|
36
|
+
puts print_usage
|
|
37
|
+
exit 1
|
|
38
|
+
else
|
|
39
|
+
puts "Unknown command: #{command}"
|
|
40
|
+
exit 1
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
47
44
|
end
|