Top Level Namespace
Defined Under Namespace
Modules: LiveSetVersion, Run
Classes: AllTracks, AlsDelta, Array, LiveAudioClip, LiveAudioTrack, LiveScene, LiveSet, String
Constant Summary
collapse
- VERBOSITY =
%w[trace debug verbose info warning error fatal panic quiet].freeze
Instance Method Summary
collapse
Instance Method Details
#als_delta ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/live_set.rb', line 10
def als_delta
require_directory "#{__dir__}/als_delta"
help_als_delta if ARGV.empty?
@options = parse_options
set_name = ARGV.join(' ').expand_env
help_als_delta "#{set_name} does not exist" unless File.exist? set_name
help_als_delta "#{set_name} is a directory" if File.directory? set_name
trap('SIGINT') { throw :ctrl_c }
als_delta = AlsDelta.new set_name, **@options
catch :ctrl_c do
als_delta.show
als_delta.cleanup
rescue Exception als_delta.cleanup
end
end
|
#common(command) ⇒ Object
5
6
7
8
|
# File 'lib/live_set.rb', line 5
def common(command)
@options = parse_options command
help_live_set 'Ableton Live set name must be provided.' if ARGV.empty?
end
|
#help_als_delta(msg = nil) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/als_delta/als_delta_options.rb', line 11
def help_als_delta(msg = nil)
printf "Error: #{msg}\n\n".yellow unless msg.nil?
msg = <<~END_HELP
ls_delta: Shows changes to an .als file.
Press enter to compare with previous version.
Syntax: ls_delta OPTIONS PATH_TO_ALS_FILE
Environment variables used in PATH_TO_ALS_FILE are expanded.
Options are:
-k Keep each backup (default is to delete them)
-h Display this help message.
Example:
ls_delta $path/to/my_v12_set.als
END_HELP
printf msg.cyan
exit 1
end
|
#help_live_set(msg = nil) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/live_set/live_set_options.rb', line 6
def help_live_set(msg = nil)
printf "Error: #{msg}\n\n".yellow unless msg.nil?
msg = <<~END_HELP
Live_set displays information about an Ableton Live set or converts a Live 12 set to Live 11 format.
If the special folder called 'Ableton Project Info' is not present in the same folder as the .als file, a warning is generated.
Similarly, if 'Ableton Project Info' is present in any parent folder, a warning is issued and the user is asked if the directory should be renamed.
Syntax: live_set OPTIONS PATH_TO_ALS_FILE
Environment variables used in PATH_TO_ALS_FILE are expanded.
Options are:
-11 Convert the Live 12 set to Live 11 format.
-f If -11 is specified, overwrite any existing Live 11 set.
-h Display this help message.
Example:
live_set -11 -f $path/to/my_v12_set.als
END_HELP
printf msg.cyan
exit 1
end
|
#human_file_size(number, decimal_places = 1) ⇒ Object
31
32
33
|
# File 'lib/common/util.rb', line 31
def human_file_size(number, decimal_places = 1)
ByteSize.new(number).to_s(decimal_places)
end
|
#live_set ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/live_set.rb', line 32
def live_set
require_directory "#{__dir__}/live_set"
help_live_set if ARGV.empty?
@options = parse_options
set_name = ARGV.join(' ').expand_env
help_live_set "#{set_name} does not exist" unless File.exist? set_name
help_live_set "#{set_name} is a directory" if File.directory? set_name
live_set = LiveSet.new set_name, **@options
if @options[:convert11]
live_set.modify_als
else
live_set.show
end
end
|
#parse_options ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/live_set/live_set_options.rb', line 29
def parse_options
options = { loglevel: 'warning' }
opts = do_parse
opts.order!(into: options)
live_set "Invalid verbosity value (#{options[:verbose]}), must be one of one of: #{VERBOSITY.join ', '}." \
if options[:verbose] && !options[:verbose] in VERBOSITY
options
end
|
#require_directory(dir) ⇒ Object
35
36
37
38
39
|
# File 'lib/common/util.rb', line 35
def require_directory(dir)
Dir[File.join(dir, '*.rb')].sort.each do |file|
require file
end
end
|