lyp-win 0.2.2 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeeb07e71da27f2b64f82ed5857c27595ecce50c
4
- data.tar.gz: 8cdf9309856d240e99a172171c33f25d8938f86c
3
+ metadata.gz: e98a618ed6bc2fd2168aa288e5ab0f0228b04de9
4
+ data.tar.gz: ce18add67cbbe485000918a16f97ab843d3aa46c
5
5
  SHA512:
6
- metadata.gz: f58acdac29428959fd4e4585ceeabc2bf884f73691d965e104058de218a5fcd94f676f66cc33f7e0396b5a21889a7d006d63889a7d5d5fbe1889fc53a2b83ba8
7
- data.tar.gz: 813b94150f002c21118331f3d70bff586471c3d4c78a67323cb0a07a404427b52a7fda4fd2a06df1eab2184424c03743c8c32c6c42a9087b95dc11ccc81c58f2
6
+ metadata.gz: a9b35eb5a49c493c8b198b1f1bcf202dd037b1ef4ae0c41c10d8d61bb7c1bb911b7a737e50211bdcdac034251360b4bfc5252b2c8e5ec38cf086d0de156b249d
7
+ data.tar.gz: 5a490c2c2234b969f38a55206560a2c6283ca31070e03b8dbf052efa3f6603ecfefe30772b61d7105d278bf8022ac8cdc9957e914440429b7deda7dfd9ac7781
data/README.md CHANGED
@@ -11,8 +11,11 @@ __No hassle Lilypond installation__: With lyp you can also install any version o
11
11
  ## Table of contents
12
12
 
13
13
  - [Installation](#installation)
14
- - [How lyp works](#how-lyp-works)
15
- - [Uninstalling](#uninstalling)
14
+ - [System requirements](#system-requirements)
15
+ - [Installing lyp as a Ruby gem](#installing-lyp-as-a-ruby-gem)
16
+ - [Installing lyp as a standalone release](#installing-lyp-as-a-standalone-release)
17
+ - [Uninstalling lyp](#uninstalling-lyp)
18
+ - [How lyp works](#how-lyp-works)
16
19
  - [Working with packages](#working-with-packages)
17
20
  - [What constitutes a package?](#what-constitutes-a-package)
18
21
  - [Installing packages](#installing-packages)
@@ -36,20 +39,33 @@ __No hassle Lilypond installation__: With lyp you can also install any version o
36
39
 
37
40
  ## Installation
38
41
 
39
- **Note**: lyp is tested to work on Linux and Mac OSX. Installing and using it on Windows would probably be problematic.
42
+ ### System requirements
40
43
 
41
- #### Installing lyp as a Ruby gem
44
+ Lyp is tested to work on Linux, Mac OSX and Windows 7+.
42
45
 
43
- If you have a recent (>=1.9.3) version of Ruby on your machine, you can install lyp as a gem:
46
+ **Note**: Windows users will currently need to install lyp as a Ruby gem, and will also need to have git installed in order to be able to install packages.
47
+
48
+ ### Installing lyp as a Ruby gem
49
+
50
+ If you have a recent (>=1.9.3) version of Ruby on your machine, you can install lyp as a gem.
44
51
 
45
52
  ```bash
53
+ # Linux/OSX only
46
54
  $ gem install lyp
47
55
  $ lyp install self
48
56
  ```
49
57
 
50
58
  The `lyp install self` command is needed in order to setup the `~/.lyp` working directory and add the lyp binaries directory to your `PATH` (see below), by adding a line of code to your shell profile file.
51
59
 
52
- #### Installing lyp without Ruby
60
+ Windows users should install the lyp-win gem:
61
+
62
+ ```bash
63
+ > gem install lyp-win
64
+ ```
65
+
66
+ On Windows, there's no need to run the `lyp install self` command.
67
+
68
+ ### Installing lyp as a standalone release
53
69
 
54
70
  If you don't have Ruby on your machine you can install lyp as a stand alone package using the install script ([view source](https://git.io/getlyp)):
55
71
 
@@ -76,19 +92,7 @@ https://github.com/noteflakes/lyp/releases/download/v0.2.1/lyp-0.2.1-linux-x86_6
76
92
 
77
93
  **Note**: using the standalone release of lyp requires having git on your machine.
78
94
 
79
- ### How lyp works
80
-
81
- Lyp sets up a working directory in `~/.lyp` where it keeps its binaries, installed packages, and installed versions of lilypond. Lyp provides a wrapper script for lilypond, which does the following:
82
-
83
- - Select the correct version of lilypond to use (see below).
84
- - Scan the given lilypond file for any dependencies (specified using `\require`), and also recursively scan any include files for dependencies
85
- - Resolve the dependency tree and calculate the correct versions to use for each required package.
86
- - Create a wrapper lilypond file that loads the packages.
87
- - Invoke the selected version of lilypond.
88
-
89
- For more information on running lilypond see the section on [Running lilypond](#running-lilypond).
90
-
91
- ### Uninstalling
95
+ ### Uninstalling lyp
92
96
 
93
97
  In order to remove lyp from your system use the `uninstall self` command:
94
98
 
@@ -104,6 +108,18 @@ In order to completely remove all files in `~/.lyp` you can simply delete the di
104
108
  $ rm -rf ~/.lyp
105
109
  ```
106
110
 
111
+ ## How lyp works
112
+
113
+ Lyp sets up a working directory in `~/.lyp` where it keeps its binaries, installed packages, and installed versions of lilypond. Lyp provides a wrapper script for lilypond, which does the following:
114
+
115
+ - Select the correct version of lilypond to use (see below).
116
+ - Scan the given lilypond file for any dependencies (specified using `\require`), and also recursively scan any include files for dependencies
117
+ - Resolve the dependency tree and calculate the correct versions to use for each required package.
118
+ - Create a wrapper lilypond file that loads the packages.
119
+ - Invoke the selected version of lilypond.
120
+
121
+ For more information on running lilypond see the section on [Running lilypond](#running-lilypond).
122
+
107
123
  ## Working with Packages
108
124
 
109
125
  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.
@@ -18,7 +18,7 @@ download() {
18
18
  }
19
19
 
20
20
  WORKDIR="/tmp/lyp-release-installer"
21
- LYP_VERSION="0.2.2"
21
+ LYP_VERSION="0.2.3"
22
22
  URL_BASE="https://github.com/noteflakes/lyp/releases/download/v$LYP_VERSION"
23
23
 
24
24
  PLATFORM=`uname -sp`
data/lib/lyp.rb CHANGED
@@ -1,42 +1,15 @@
1
- $WINDOWS = Gem.win_platform?
1
+ def req(f); require File.expand_path("lyp/#{f}", File.dirname(__FILE__)); end
2
2
 
3
- # test for existence of
4
- $rugged_available = begin
5
- gem 'rugged', '>=0.23.0'
6
- require 'rugged'
7
- rescue Exception
8
- nil
9
- end
3
+ req 'base'
4
+ req 'system'
5
+ req 'settings'
10
6
 
11
- $git_available = `git --version` rescue nil
7
+ Lyp::System.test_rugged_gem!
12
8
 
13
- unless $rugged_available || $git_available
14
- raise "Lyp needs git in order to be able to install packages. Please install git and then try again."
15
- end
9
+ req 'template'
10
+ req 'resolver'
11
+ req 'wrapper'
12
+ req 'package'
13
+ req 'lilypond'
16
14
 
17
- unless $rugged_available
18
- require 'lyp/git_based_rugged'
19
- end
20
-
21
- require 'tmpdir'
22
- require 'fileutils'
23
- $TMP_DIR = $WINDOWS ? "#{Dir.home}/AppData/Local/Temp" : "/tmp"
24
- $TMP_ROOT = "#{$TMP_DIR}/lyp"
25
- FileUtils.mkdir_p($TMP_ROOT)
26
-
27
- %w{
28
- base
29
- system
30
- settings
31
-
32
- template
33
- resolver
34
- wrapper
35
-
36
- package
37
- lilypond
38
- }.each do |f|
39
- require File.expand_path("lyp/#{f}", File.dirname(__FILE__))
40
- end
41
-
42
- require File.expand_path("lyp/windows", File.dirname(__FILE__)) if $WINDOWS
15
+ req 'windows' if Lyp::WINDOWS
data/lib/lyp/base.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'fileutils'
2
2
 
3
3
  module Lyp
4
+ WINDOWS = Gem.win_platform?
5
+ TMP_DIR = WINDOWS ? "#{Dir.home}/AppData/Local/Temp" : "/tmp"
6
+ TMP_ROOT = "#{TMP_DIR}/lyp"
7
+ FileUtils.mkdir_p(TMP_ROOT)
8
+
4
9
  # A package specifier is of the form <package>@<version specifier>, where
5
10
  # the version specifier can be simply a version number, or include an operator
6
11
  # before the version number.
data/lib/lyp/lilypond.rb CHANGED
@@ -110,7 +110,7 @@ module Lyp::Lilypond
110
110
  end
111
111
 
112
112
  def session_settings_filename
113
- "#{$TMP_ROOT}/session.#{Process.getsid}.yml"
113
+ "#{Lyp::TMP_ROOT}/session.#{Process.getsid}.yml"
114
114
  end
115
115
 
116
116
  CMP_VERSION = proc do |x, y|
@@ -336,7 +336,7 @@ module Lyp::Lilypond
336
336
 
337
337
  def temp_install_filename(url)
338
338
  u = URI(url)
339
- "#{$TMP_ROOT}/#{File.basename(u.path)}"
339
+ "#{Lyp::TMP_ROOT}/#{File.basename(u.path)}"
340
340
  end
341
341
 
342
342
  def download_lilypond(url, fn, opts)
@@ -365,7 +365,7 @@ module Lyp::Lilypond
365
365
  end
366
366
 
367
367
  def install_lilypond_files(fn, platform, version, opts)
368
- tmp_target = "#{$TMP_ROOT}/lilypond-#{version}"
368
+ tmp_target = "#{Lyp::TMP_ROOT}/lilypond-#{version}"
369
369
  FileUtils.mkdir_p(tmp_target)
370
370
 
371
371
  case platform
@@ -394,7 +394,7 @@ module Lyp::Lilypond
394
394
  STDERR.puts "Extracting..." unless opts[:silent]
395
395
 
396
396
  # create temp directory in which to extract .sh file
397
- tmp_dir = "#{$TMP_ROOT}/#{Time.now.to_f}"
397
+ tmp_dir = "#{Lyp::TMP_ROOT}/#{Time.now.to_f}"
398
398
  FileUtils.mkdir_p(tmp_dir)
399
399
 
400
400
  FileUtils.cd(tmp_dir) do
data/lib/lyp/package.rb CHANGED
@@ -313,7 +313,7 @@ module Lyp::Package
313
313
  @lyp_index ||= YAML.load(open(LYP_INDEX_URL))
314
314
  end
315
315
 
316
- TEMP_REPO_ROOT_PATH = "#{$TMP_ROOT}/repos"
316
+ TEMP_REPO_ROOT_PATH = "#{Lyp::TMP_ROOT}/repos"
317
317
 
318
318
  def git_url_to_temp_path(url)
319
319
  case url
data/lib/lyp/system.rb CHANGED
@@ -2,6 +2,36 @@ require 'fileutils'
2
2
 
3
3
  module Lyp::System
4
4
  class << self
5
+ RUGGED_REQ = Gem::Requirement.new('>=0.23.0')
6
+
7
+ def test_rugged_gem!
8
+ return if find_rugged_gem || use_git_based_rugged_gem
9
+
10
+ STDERR.puts "Lyp needs git in order to be able to install packages. Please install git and then try again."
11
+ exit 1
12
+ end
13
+
14
+ def find_rugged_gem
15
+ found = Gem::Specification.find_all_by_name('rugged').find do |s|
16
+ RUGGED_REQ =~ s.version
17
+ end
18
+
19
+ require_rugged_gem if found
20
+ found
21
+ end
22
+
23
+ def require_rugged_gem
24
+ gem 'rugged', RUGGED_REQ.to_s
25
+ require 'rugged'
26
+ end
27
+
28
+ def use_git_based_rugged_gem
29
+ git_available = `git --version` rescue nil
30
+ return false unless git_available
31
+
32
+ require File.expand_path('git_based_rugged', File.dirname(__FILE__))
33
+ end
34
+
5
35
  INSTALL_MSG = <<EOF
6
36
 
7
37
  Warning! Lyp is not yet properly installed in your home directory.
@@ -17,7 +47,7 @@ EOF
17
47
 
18
48
  def test_installed_status!
19
49
  unless installed?
20
- puts INSTALL_MSG
50
+ STDERR.puts INSTALL_MSG
21
51
  end
22
52
  end
23
53
 
@@ -13,7 +13,7 @@ user_filename = File.expand_path(_[:user_file])
13
13
  user_dirname = File.dirname(user_filename)
14
14
 
15
15
  quote_path = lambda do |path|
16
- path = path.gsub("\\", "/") if $WINDOWS
16
+ path = path.gsub("\\", "/") if Lyp::WINDOWS
17
17
  path.inspect
18
18
  end
19
19
 
data/lib/lyp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lyp
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/lyp/wrapper.rb CHANGED
@@ -12,8 +12,8 @@ module Lyp
12
12
  r[:current_package_dir] = opts[:current_package_dir]
13
13
 
14
14
  if !r[:package_dirs].empty? || opts[:force_wrap]
15
- FileUtils.mkdir_p("#{$TMP_ROOT}/wrappers")
16
- fn = "#{$TMP_ROOT}/wrappers/#{File.basename(fn)}"
15
+ FileUtils.mkdir_p("#{Lyp::TMP_ROOT}/wrappers")
16
+ fn = "#{Lyp::TMP_ROOT}/wrappers/#{File.basename(fn)}"
17
17
 
18
18
  File.open(fn, 'w+') {|f| f << WRAPPER_TEMPLATE.render(r)}
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lyp-win
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.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-02-01 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient