rlt 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/.rlt.sample.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/rlt/commands/cmt_command.rb +1 -1
- data/lib/rlt/commands/switch_command.rb +6 -0
- data/lib/rlt/config.rb +13 -12
- data/lib/rlt/version.rb +1 -1
- 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: 7d5e0d5c96151a0109da828bea2aceefe7724ae31f1b48db2b857a8be57544fc
|
4
|
+
data.tar.gz: 4bb26123cb6654a975937707851fd789cabd0a6d70a6b53da1e088ea53ab7776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 212073d3b4b2acd1f826124fbf37d70ca267a019d1d0dd724d9ffdf2c5e0468b205d1b6a046f20a51ede74078eb9b8f97be15c2b835a21c80101025dd2970e98
|
7
|
+
data.tar.gz: '09018f8e6be388149a24971bcb84a6879d8ec57de64c161647aee08ee26ecf3082e7d8e926a0532e701ada21242540a09496d51addda4013a2f5e393d91e4bd1'
|
data/.rlt.sample.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -31,7 +31,7 @@ module Rlt
|
|
31
31
|
|
32
32
|
def self.commit(subject, body)
|
33
33
|
commit_msg_file_path = "#{Dir.tmpdir}/.rlt.commit.msg.#{short_random_string}"
|
34
|
-
File.write(commit_msg_file_path, "#{subject}\n\n#{body}")
|
34
|
+
File.write(commit_msg_file_path, "#{subject}\n\n#{body}".strip)
|
35
35
|
Shell.new.run 'git', 'commit', '-F', commit_msg_file_path
|
36
36
|
File.delete(commit_msg_file_path)
|
37
37
|
end
|
@@ -13,11 +13,17 @@ module Rlt
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.change_branch_name(config, branch_name)
|
16
|
+
return branch_name if exclude?(config, branch_name)
|
16
17
|
branch_name_template = config[CONF_BRANCH_NAME_TEMPLATE]
|
17
18
|
return branch_name if branch_name_template.nil?
|
18
19
|
ERB.new(branch_name_template).result binding
|
19
20
|
end
|
20
21
|
|
22
|
+
def self.exclude?(config, branch_name)
|
23
|
+
list = %w[master develop] + (config['exclude'] || [])
|
24
|
+
list.include? branch_name
|
25
|
+
end
|
26
|
+
|
21
27
|
def self.switch(branch_name)
|
22
28
|
create_and_checkout(branch_name) if checkout(branch_name).failure?
|
23
29
|
end
|
data/lib/rlt/config.rb
CHANGED
@@ -5,23 +5,20 @@ require 'yaml'
|
|
5
5
|
module Rlt
|
6
6
|
module Config
|
7
7
|
def config(category, command)
|
8
|
-
|
9
|
-
|
10
|
-
{}
|
8
|
+
c = config_map.dig category, command
|
9
|
+
return c unless c.nil?
|
10
|
+
return {} if command == original_name(command)
|
11
|
+
config_map.dig(category, original_name(command)) || {}
|
11
12
|
end
|
12
13
|
|
13
|
-
def
|
14
|
-
|
14
|
+
def original_name(command)
|
15
|
+
config_map.dig 'alias', command
|
15
16
|
end
|
16
17
|
|
17
18
|
def config_keys(category)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def category_config(category)
|
24
|
-
(@config ||= load_config)[category]
|
19
|
+
c = config_map.dig(category)
|
20
|
+
return [] if c.nil?
|
21
|
+
c.keys
|
25
22
|
end
|
26
23
|
|
27
24
|
def load_config
|
@@ -37,5 +34,9 @@ module Rlt
|
|
37
34
|
"#{Dir.pwd}/.rlt.yml"
|
38
35
|
end
|
39
36
|
end
|
37
|
+
|
38
|
+
def config_map
|
39
|
+
(@config_map ||= load_config)
|
40
|
+
end
|
40
41
|
end
|
41
42
|
end
|
data/lib/rlt/version.rb
CHANGED