lyp 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84b01737c53394d03c21532706f716bc76dc2d5a
4
- data.tar.gz: 419c7e10f0803a56bdbb8b93552134d6e9b93769
3
+ metadata.gz: 237b06c5018520e73c24a410d350343e806dd4c5
4
+ data.tar.gz: 67060615bc34efded14ca9ff3b1e8b9134c2f414
5
5
  SHA512:
6
- metadata.gz: 06fedcc0128648cec7a4125e0f418c223a0b75bd461f3dc580e3645052da8c11f9a1cb56c580a23ecc3c7328efbc61a82c2f87a591ba522d7314cd9c928d24e2
7
- data.tar.gz: f8495a11a1f8a7a7a1dcd42bcca97598049b6e77690e871f5e1b65d5822ac189fa1d967a630b26ba6a7c045d3cc964598ee2539ccb8c6a87cccac6673a59b546
6
+ metadata.gz: 4b9325b66427152575d3b7340c7bfea283cad9816d4a330defe75ab88ee6e2d9610b888e1a57b3010dd839455f794b344f7df18e2d3c96b81156edef5701db4b
7
+ data.tar.gz: cfa5bf20c687e24c95a2b7c225b0fb2afe00ffe34e8e06c19b12df583d42458173f3b0adfb9929f84357a80b9d2818174e5e3e588d2f32145a2c1a38b3f5a977
data/README.md CHANGED
@@ -1,9 +1,95 @@
1
1
  [![Build Status](https://travis-ci.org/ciconia/lyp.svg?branch=master)](https://travis-ci.org/ciconia/lyp)
2
2
 
3
- # lyp
3
+ # lyp - a package manager for lilypond
4
4
 
5
- lyp is a package manager for lilypond.
5
+ lyp is a tool to install and manage packages for lilypond, and install versions of lilypond.
6
6
 
7
- Initial spec is [here](https://github.com/ciconia/lyp/wiki/General-spec).
7
+ lyp lets you install lilypond packages that act as code libraries and can be used to enhance your lilypond files with additional functionality. Packages can depend on other packages. Lyp resolves the direct and transitive package dependencies, and selects the correct version to use for each package.
8
8
 
9
+ With lyp you can also install any version of lilypond on your machine with a single command, without having to visit the lilypond website, clicking a link and then copying files around. In addition, lyp lets you install multiple versions of lilypond and easily switch between them.
9
10
 
11
+ ## What is a lilypond package?
12
+
13
+ A package is a library of lilypond code, containing one or more lilypond files, that provide commonly-used functionality for users. A package can be a library of scheme code to extend lilypond, as in openlilylib; or a stylesheet which contains music fonts and additional lilypond code to change the look of the music: font, spacing, line widths, sizes, etc.
14
+
15
+ The difference between merely copying and including a lilypond file in your music, and using a lilypond package is that you can easily share your music file with anyone and let them compile your music without having to download and copy additional code. lyp takes care of installing and resolving any dependencies in your lilypond files, so that you can compile your lilypond files anywhere without schlepping around a bunch of include files. Also, because packages are versioned, repeatable compilation using external code becomes trivial.
16
+
17
+ ## How to add a package to your lilypond file?
18
+
19
+ Lilypond packages are simply git repositories. As such they can be identified by the repository's URL, or by the github repository path. To add a package dependency to your code, use the <code>\require</code> command:
20
+
21
+ ```lilypond
22
+ \require "lypco/lilyjazz" % repository is at: github.com/lypco/lilyjazz
23
+ \require "github.com/lypco/poormans_henle"
24
+ ```
25
+
26
+ Versions can be specified either as specific versions, or as version specifiers which denote a range of versions:
27
+
28
+ ```lilypond
29
+ \require "lypco/lilyjazz@0.3.2"
30
+
31
+ % highest version higher than 0.3.2
32
+ \require "lypco/lilyjazz@>=0.3.2"
33
+
34
+ % highest version higher than 0.4.5 but lower than 0.5.0
35
+ \require "lypco/lilyjazz@~>0.4.5"
36
+ ```
37
+
38
+ Once the dependencies are specified, packages can be installed either using the <install> command:
39
+
40
+ ```bash
41
+ lyp install "lypco/lilyjazz@0.3.2" % OR:
42
+ lyp install "lypco/lilyjazz@>=0.3.2"
43
+ ```
44
+
45
+ ... or the <code>resolve</code> command, which scans the user's file for dependencies and then installs them:
46
+
47
+ ```bash
48
+ lyp resolve maitre_sans_marteau.ly
49
+ ```
50
+
51
+ ## Installation
52
+
53
+ If you have Ruby on your machine, you can simply install the lyp gem, and run the install self command:
54
+
55
+ ```bash
56
+ gem install lyp
57
+ lyp install self
58
+ ```
59
+
60
+ ## Installing packages with lyp
61
+
62
+
63
+
64
+ ## Installing and managing versions of lilypond
65
+
66
+ When installing lilypond, the specific version to download can be specified in different ways:
67
+
68
+ ```bash
69
+ lyp install lilypond % latest stable version
70
+ lyp install lilypond@stable % latest stable version
71
+ lyp install lilypond@unstable % latest stable version
72
+ lyp install lilypond@latest % latest version
73
+ lyp install lilypond@2.18.1 % version 2.18.1
74
+ lyp install lilypond@>=2.19.27 % highest version higher than 2.19.27
75
+ lyp install lilypond@~>2.18.1 % highest 2.18 version higher than 2.18.1
76
+ ```
77
+
78
+ To display all installed versions of lilypond, use the <code>list</code> command:
79
+
80
+ ```bash
81
+ lyp list lilypond
82
+ ```
83
+
84
+ To switch between versions use the <code>use</code>. The same version specifiers could be used as for the <code>install</code> command:
85
+
86
+ ```bash
87
+ lyp use lilypond@2.18.2 % or without the 'lilypond' identifier:
88
+ lyp use stable % use latest stable version
89
+ ```
90
+
91
+ To show all versions available for download, use the <code>search</code> command:
92
+
93
+ ```bash
94
+ lyp search lilypond
95
+ ```
@@ -1,15 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.expand_path("../lib/lyp/version", File.dirname(__FILE__))
3
+ require 'lyp/version'
4
+ require 'lyp/directories'
5
+ require 'lyp/settings'
6
+ require 'lyp/lilypond'
4
7
 
5
- require File.expand_path("../lib/lyp/directories", File.dirname(__FILE__))
6
- require File.expand_path("../lib/lyp/settings", File.dirname(__FILE__))
7
- require File.expand_path("../lib/lyp/lilypond", File.dirname(__FILE__))
8
+ STDERR.puts "Lyp version #{Lyp::VERSION}"
8
9
 
9
10
  lilypond_path = Lyp::Lilypond.current_lilypond
11
+ unless lilypond_path && File.file?(lilypond_path)
12
+ STDERR.puts "No version of lilypond found. To install lilypond run 'lyp install lilypond'."
13
+ exit 1
14
+ end
10
15
 
11
16
  if (ARGV == ['-v']) || (ARGV == ['--warranty'])
12
- puts "Lyp version #{Lyp::VERSION}"
13
17
  # Show lilypond version and exit
14
18
  exec("#{lilypond_path} #{ARGV.join(' ')}")
15
19
  end
data/bin/lyp CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require "lyp"
3
4
  require "lyp/cli"
4
5
 
data/lib/lyp.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  %w{
2
- output
3
- env
4
-
5
2
  directories
3
+ system
6
4
  settings
7
5
 
8
6
  template
@@ -1,26 +1,5 @@
1
- require "lyp"
2
- require "lyp/version"
3
-
4
- INSTALL_MSG = <<EOF
5
- Lyp is currently not installed. In order to use lyp, ~/.lyp/bin has to
6
- be included in the shell $PATH.
7
- EOF
8
-
9
- # test installation
10
- unless Lyp::ENV.installed?
11
- require 'highline'
12
-
13
- cli = HighLine.new
14
- STDERR.puts INSTALL_MSG.gsub("\n", " ")
15
-
16
- if cli.agree("Would you like to install lyp now? (yes/no)")
17
- Lyp::ENV.install!
18
- STDERR.puts "To finish installation please open a new shell"
19
- exit
20
- end
21
- end
22
-
23
1
  require 'commander/import'
2
+ require "lyp/version"
24
3
 
25
4
  program :name, 'lyp'
26
5
  program :version, Lyp::VERSION
@@ -42,6 +42,8 @@ command :list do |c|
42
42
  c.syntax = "list [PATTERN]"
43
43
  c.description = "Lists installed versions of packages whose name matches PATTERN"
44
44
  c.action do |args, opts|
45
+ Lyp::System.test_installed_status!
46
+
45
47
  pattern = args.first
46
48
  if pattern.nil? || pattern == 'lilypond'
47
49
  STDOUT.puts LILYPOND_PREAMBLE
@@ -57,6 +59,8 @@ command :compile do |c|
57
59
  c.syntax = "compile <FILE>"
58
60
  c.description = "Resolves package dependencies and invokes lilypond"
59
61
  c.action do |args, opts|
62
+ Lyp::System.test_installed_status!
63
+
60
64
  begin
61
65
  raise "File not specified" if args.empty?
62
66
  Lyp::Lilypond.compile(ARGV[1..-1])
@@ -71,6 +75,8 @@ command :search do |c|
71
75
  c.syntax = "search <PATTERN>"
72
76
  c.description = "Search for a package or a version of lilypond"
73
77
  c.action do |args, opts|
78
+ Lyp::System.test_installed_status!
79
+
74
80
  pattern = args.first
75
81
  if pattern == 'lilypond'
76
82
  begin
@@ -89,17 +95,22 @@ command :install do |c|
89
95
  c.description = "Install a package or a version of lilypond"
90
96
  c.option "-d", "--default", "Set default version"
91
97
  c.action do |args, opts|
98
+
92
99
  begin
93
100
  raise "No package specified" if args.empty?
94
101
 
95
102
  args.each do |package|
96
- if package =~ /^lilypond(?:@(.+))?$/
103
+ case package
104
+ when 'self'
105
+ Lyp::System.install!
106
+ when /^lilypond(?:@(.+))?$/
107
+ Lyp::System.test_installed_status!
97
108
  Lyp::Lilypond.install($1, opts.__hash__)
98
109
  end
99
110
  end
100
- rescue => e
101
- STDERR.puts e.message
102
- exit 1
111
+ # rescue => e
112
+ # STDERR.puts e.message
113
+ # exit 1
103
114
  end
104
115
  end
105
116
  end
@@ -110,6 +121,8 @@ command :use do |c|
110
121
  c.option "-d", "--default", "Set default version"
111
122
 
112
123
  c.action do |args, opts|
124
+ Lyp::System.test_installed_status!
125
+
113
126
  begin
114
127
  version = args.first
115
128
  if version =~ /^lilypond@(.+)$/
@@ -130,11 +143,17 @@ command :uninstall do |c|
130
143
  c.description = "Uninstall a package or version of lilypond"
131
144
 
132
145
  c.action do |args, opts|
146
+ Lyp::System.test_installed_status!
147
+
133
148
  begin
134
149
  raise "No package specified" if args.empty?
135
150
 
136
151
  args.each do |package|
137
- if package =~ /^lilypond(?:@(.+))?$/
152
+ case package
153
+ when 'self'
154
+ Lyp::System.uninstall!
155
+ when /^lilypond(?:@(.+))?$/
156
+ Lyp::System.test_installed_status!
138
157
  Lyp::Lilypond.uninstall($1)
139
158
  end
140
159
  end
@@ -1,26 +1,34 @@
1
+ require 'fileutils'
2
+
1
3
  module Lyp
2
4
  # A package specifier is of the form <package>@<version specifier>, where
3
5
  # the version specifier can be simply a version number, or include an operator
4
6
  # before the version number. Accepted operators: >=, ~>
5
7
  PACKAGE_RE = /^([^@]+)(?:@(.+))?$/
6
8
 
7
- LYPACK_DIRECTORY = File.expand_path('~/.lyp')
8
- LYPACK_BIN_DIRECTORY = File.join(LYPACK_DIRECTORY, 'bin')
9
- DEFAULT_PACKAGE_DIRECTORY = File.join(LYPACK_DIRECTORY, 'packages')
10
- DEFAULT_LILYPONDS_DIRECTORY = File.join(LYPACK_DIRECTORY, 'lilyponds')
9
+ LYP_DIRECTORY = File.expand_path('~/.lyp')
10
+ LYP_BIN_DIRECTORY = File.join(LYP_DIRECTORY, 'bin')
11
+ DEFAULT_PACKAGE_DIRECTORY = File.join(LYP_DIRECTORY, 'packages')
12
+ DEFAULT_LILYPONDS_DIRECTORY = File.join(LYP_DIRECTORY, 'lilyponds')
11
13
 
12
14
  SETTINGS_FILENAME = 'settings.yml'
13
15
 
14
16
  def self.packages_dir
15
- DEFAULT_PACKAGE_DIRECTORY
17
+ ensure_dir(DEFAULT_PACKAGE_DIRECTORY)
16
18
  end
17
19
 
18
20
  def self.lilyponds_dir
19
- DEFAULT_LILYPONDS_DIRECTORY
21
+ ensure_dir(DEFAULT_LILYPONDS_DIRECTORY)
20
22
  end
21
23
 
22
24
  def self.settings_file
23
- File.join(LYPACK_DIRECTORY, SETTINGS_FILENAME)
25
+ ensure_dir(LYP_DIRECTORY)
26
+ File.join(LYP_DIRECTORY, SETTINGS_FILENAME)
27
+ end
28
+
29
+ def self.ensure_dir(dir)
30
+ FileUtils.mkdir_p(dir) unless File.directory?(dir)
31
+ dir
24
32
  end
25
33
  end
26
34
 
@@ -135,7 +135,7 @@ module Lyp::Lilypond
135
135
  list = `which -a lilypond`
136
136
  list = list.lines.map {|f| f.chomp}.reject do |l|
137
137
  dir = File.dirname(l)
138
- (dir == Lyp::LYPACK_BIN_DIRECTORY) || (dir == self_bin_dir)
138
+ (dir == Lyp::LYP_BIN_DIRECTORY) || (dir == self_bin_dir)
139
139
  end
140
140
  end
141
141
 
@@ -174,7 +174,8 @@ module Lyp::Lilypond
174
174
  def install(version_specifier, opts = {})
175
175
  version = detect_version_from_specifier(version_specifier)
176
176
  raise "No version found matching specifier #{version_specifier}" unless version
177
-
177
+
178
+ STDERR.puts "Installing version #{version}" unless opts[:silent]
178
179
  install_version(version, opts)
179
180
 
180
181
  lilypond_path = "#{Lyp.lilyponds_dir}/#{version}/bin/lilypond"
@@ -186,7 +187,7 @@ module Lyp::Lilypond
186
187
  case version_specifier
187
188
  when /^\d/
188
189
  version_specifier
189
- when 'stable'
190
+ when nil, 'stable'
190
191
  latest_stable_version
191
192
  when 'unstable'
192
193
  latest_unstable_version
@@ -262,30 +263,34 @@ module Lyp::Lilypond
262
263
  end
263
264
 
264
265
  def install_lilypond_files(fn, platform, version, opts)
266
+ tmp_target = "/tmp/lyp-lilypond-#{version}"
267
+ FileUtils.mkdir_p(tmp_target)
268
+
265
269
  case platform
266
270
  when /darwin/
267
- install_lilypond_files_osx(fn, version, opts)
271
+ install_lilypond_files_osx(fn, tmp_target, platform, version, opts)
268
272
  when /linux/
269
- install_lilypond_files_linux(fn, platform, version, opts)
273
+ install_lilypond_files_linux(fn, tmp_target, platform, version, opts)
270
274
  end
275
+
276
+ ensure
277
+ FileUtils.rm_rf(tmp_target)
271
278
  end
272
279
 
273
- def install_lilypond_files_osx(fn, version, opts)
274
- target = "/tmp/lyp/installer/lilypond"
275
- FileUtils.mkdir_p(target)
276
-
280
+ def install_lilypond_files_osx(fn, target, platform, version, opts)
277
281
  STDERR.puts "Extracting..." unless opts[:silent]
278
282
  exec "tar -xjf #{fn} -C #{target}"
279
283
 
280
284
  copy_lilypond_files("#{target}/LilyPond.app/Contents/Resources", version, opts)
281
285
  end
282
286
 
283
- def install_lilypond_files_linux(fn, platform, version, opts)
284
- target = "/tmp/lyp/installer/lilypond"
285
- FileUtils.mkdir_p(target)
286
-
287
- # create temp directory in which to untar file
288
- tmp_dir = "/tmp/lyp/#{Time.now.to_f}"
287
+ # Since linux versions are distributed as sh archives, we need first to
288
+ # extract the sh archive, then extract the resulting tar file
289
+ def install_lilypond_files_linux(fn, target, platform, version, opts)
290
+ STDERR.puts "Extracting..." unless opts[:silent]
291
+
292
+ # create temp directory in which to extract .sh file
293
+ tmp_dir = "/tmp/lyp-#{Time.now.to_f}"
289
294
  FileUtils.mkdir_p(tmp_dir)
290
295
 
291
296
  FileUtils.cd(tmp_dir) do
@@ -294,10 +299,11 @@ module Lyp::Lilypond
294
299
 
295
300
  tmp_fn = "#{tmp_dir}/lilypond-#{version}-1.#{platform}.tar.bz2"
296
301
 
297
- STDERR.puts "Extracting..." unless opts[:silent]
298
302
  exec "tar -xjf #{tmp_fn} -C #{target}"
299
303
 
300
304
  copy_lilypond_files("#{target}/usr", version, opts)
305
+ ensure
306
+ FileUtils.rm_rf(tmp_dir)
301
307
  end
302
308
 
303
309
  def copy_lilypond_files(base_path, version, opts)
@@ -0,0 +1,116 @@
1
+ require 'fileutils'
2
+
3
+ module Lyp::System
4
+ class << self
5
+ INSTALL_MSG = <<EOF
6
+
7
+ lyp is not yet properly installed in your home directory.
8
+
9
+ To install lyp run 'lyp install self'. lyp will then:
10
+ 1. Setup ~/.lyp as its base directory.
11
+ 2. Add ~/.lyp/bin to $PATH.
12
+
13
+ You can uninstall lyp at any time by running 'lyp uninstall self'.
14
+
15
+ EOF
16
+
17
+ def test_installed_status!
18
+ unless installed?
19
+ puts INSTALL_MSG
20
+ exit 1
21
+ end
22
+ end
23
+
24
+ def installed?(opts = {})
25
+ path_is_there = ":#{::ENV['PATH']}:" =~ /#{Lyp::LYP_BIN_DIRECTORY}/
26
+ file_is_there = File.file?("#{Lyp::LYP_BIN_DIRECTORY}/lyp")
27
+
28
+ (opts[:no_path_check] || path_is_there) && file_is_there
29
+ end
30
+
31
+ # Adds ~/.lyp/bin to $PATH to the first profile file that exists, then
32
+ # returns the profile filename
33
+ def install!
34
+ puts "\nInstalling lyp...\n\nAdding ~/.lyp/bin to $PATH..."
35
+ profile_fn = setup_bin_path
36
+ puts "Setting up binary scripts..."
37
+ setup_bin_scripts
38
+
39
+ if installed?(no_path_check: true)
40
+ puts "\nTo finish installation, open a new shell or run 'source ~/#{File.basename(profile_fn)}'.\n\n"
41
+ else
42
+ raise "Failed to install lyp"
43
+ end
44
+ end
45
+
46
+ PROFILE_FILES = %w{
47
+ .profile .bash_profile .bash_login .bashrc .zshenv .zshrc .mkshrc
48
+ }.map {|fn| File.join(Dir.home, fn)}
49
+
50
+ LYP_LOAD_CODE = <<EOF
51
+
52
+ [[ ":${PATH}:" == *":${HOME}/.lyp/bin:"* ]] || PATH="$HOME/.lyp/bin:$PATH"
53
+ EOF
54
+
55
+ def setup_bin_path
56
+ fn = PROFILE_FILES.find {|f| File.file?(f)}
57
+ unless fn
58
+ raise "Could not find a shell profile file"
59
+ end
60
+
61
+ unless (IO.read(fn) =~ /\.lyp\/bin/)
62
+ File.open(fn, 'a') {|f| f << LYP_LOAD_CODE}
63
+ end
64
+ fn
65
+ end
66
+
67
+ def setup_bin_scripts
68
+ bin_dir = File.expand_path(File.dirname($0))
69
+
70
+ if is_gem?(bin_dir)
71
+ setup_gem_bin_scripts(bin_dir)
72
+ else
73
+ setup_release_bin_scripts(bin_dir)
74
+ end
75
+ end
76
+
77
+ RELEASE_BIN_PATH = "lib/app/bin/"
78
+
79
+ def is_gem?(bin_dir)
80
+ bin_dir !~ /#{RELEASE_BIN_PATH}[a-z]+$/
81
+ end
82
+
83
+ def setup_gem_bin_scripts(bin_dir)
84
+ FileUtils.mkdir_p(Lyp::LYP_BIN_DIRECTORY)
85
+ %w{lyp lilypond}.each do |fn|
86
+ FileUtils.ln_sf("#{bin_dir}/#{fn}", "#{Lyp::LYP_BIN_DIRECTORY}/#{fn}")
87
+ end
88
+ end
89
+
90
+ def setup_release_bin_scripts(bin_dir)
91
+ # to be implemented
92
+ end
93
+
94
+ def uninstall!
95
+ puts "\nUninstalling lyp...\n\nRemoving ~/.lyp/bin from $PATH..."
96
+
97
+ # Remove ~/.lyp/bin from $PATH
98
+ PROFILE_FILES.each do |fn|
99
+ next unless File.file?(fn)
100
+
101
+ content = IO.read(fn)
102
+ if (content =~ /\.lyp\/bin/)
103
+ content.gsub!(/\n?.*\.lyp\/bin.*\n/, '')
104
+ File.open(fn, 'w+') {|f| f << content}
105
+ end
106
+ end
107
+
108
+ puts "Removing binary scripts..."
109
+ # Delete bin scripts
110
+ FileUtils.rm("#{Lyp::LYP_BIN_DIRECTORY}/*") rescue nil
111
+
112
+ puts "\nTo completely remove installed packages and lilyponds run 'rm -rf ~/.lyp'.\n\n"
113
+ end
114
+ end
115
+ end
116
+
@@ -1,3 +1,3 @@
1
1
  module Lyp
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lyp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -126,12 +126,11 @@ files:
126
126
  - lib/lyp/cli.rb
127
127
  - lib/lyp/cli/commands.rb
128
128
  - lib/lyp/directories.rb
129
- - lib/lyp/env.rb
130
129
  - lib/lyp/lilypond.rb
131
- - lib/lyp/output.rb
132
130
  - lib/lyp/package.rb
133
131
  - lib/lyp/resolver.rb
134
132
  - lib/lyp/settings.rb
133
+ - lib/lyp/system.rb
135
134
  - lib/lyp/template.rb
136
135
  - lib/lyp/templates/deps_wrapper.rb
137
136
  - lib/lyp/version.rb
@@ -1,32 +0,0 @@
1
- module Lyp::ENV
2
- class << self
3
- PROFILE_FILES = %w{
4
- .profile .bash_profile .bash_login .bashrc .zshenv .zshrc .mkshrc
5
- }.map {|fn| File.join(Dir.home, fn)}
6
-
7
- LYPACK_LOAD_CODE = <<EOF
8
-
9
- [[ ":${PATH}:" == *":${HOME}/.lyp/bin:"* ]] || PATH="$HOME/.lyp/bin:$PATH"
10
- EOF
11
-
12
- def install!
13
- # Install lyp in environment
14
-
15
- PROFILE_FILES.each do |fn|
16
- next unless File.file?(fn)
17
- unless IO.read(fn) =~ /\.lyp\/bin/
18
- begin
19
- File.open(fn, 'a') {|f| f << LYPACK_LOAD_CODE}
20
- rescue
21
- # ignore
22
- end
23
- end
24
- end
25
- end
26
-
27
- def installed?
28
- ":#{::ENV['PATH']}:" =~ /#{Lyp::LYPACK_BIN_DIRECTORY}/
29
- end
30
- end
31
- end
32
-
@@ -1,18 +0,0 @@
1
- require 'ruby-progressbar'
2
-
3
- module Lyp
4
- PROGRESS_FORMAT = '%t:%B:%p%%'
5
-
6
- # Simple wrapper around ProgressBar
7
- def self.show_progress(title, total)
8
- $progress_bar = ProgressBar.create(
9
- title: title,
10
- total: total,
11
- format: PROGRESS_FORMAT,
12
- )
13
- yield $progress_bar
14
- ensure
15
- $progress_bar.stop
16
- $progress_bar = nil
17
- end
18
- end