Class: Snaptoken::Commands::Step
Instance Attribute Summary
Attributes inherited from BaseCommand
#config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseCommand
#git_to_litdiff!, inherited, #initialize, #litdiff_to_git!, #needs!, #parseopts!
Class Method Details
.name ⇒ Object
2
3
4
|
# File 'lib/snaptoken/commands/step.rb', line 2
def self.name
"step"
end
|
.summary ⇒ Object
6
7
8
|
# File 'lib/snaptoken/commands/step.rb', line 6
def self.summary
"Select a step for editing."
end
|
.usage ⇒ Object
10
11
12
|
# File 'lib/snaptoken/commands/step.rb', line 10
def self.usage
"<step-number>"
end
|
Instance Method Details
#run ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/snaptoken/commands/step.rb', line 17
def run
needs! :config, :repo
step_number = @args.first.to_i
FileUtils.cd(@git.repo_path) do
@git.each_step do |cur_step, commit|
if cur_step == step_number
`git checkout #{commit.oid}`
@git.copy_repo_to_step!
exit
end
end
puts "Error: Step not found."
exit 1
end
end
|
#setopts!(o) ⇒ Object
14
15
|
# File 'lib/snaptoken/commands/step.rb', line 14
def setopts!(o)
end
|