skippy 0.2.0.a → 0.3.0.a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.gitmodules +3 -0
- data/.idea/.rakeTasks +6 -6
- data/.idea/codeStyleSettings.xml +8 -8
- data/.idea/encodings.xml +5 -5
- data/.idea/inspectionProfiles/Project_Default.xml +7 -7
- data/.idea/misc.xml +3 -3
- data/.idea/modules.xml +7 -7
- data/.idea/skippy.iml +89 -82
- data/.idea/vcs.xml +5 -5
- data/.rubocop.yml +93 -0
- data/.rubocop_todo.yml +24 -0
- data/.vscode/launch.json +51 -61
- data/.vscode/settings.json +41 -2
- data/.vscode/tasks.json +16 -16
- data/Gemfile +11 -2
- data/README.md +194 -15
- data/Rakefile +1 -1
- data/app/boot.rb +1 -1
- data/app/commands/install.rb +41 -0
- data/app/commands/lib.rb +42 -2
- data/app/commands/new.rb +22 -8
- data/app/commands/template.rb +2 -2
- data/bin/rubocop +17 -0
- data/bin/ruby-parse +17 -0
- data/bin/ruby-rewrite +17 -0
- data/debug/skippy.bat +2 -0
- data/fixtures/my_lib/{src → modules}/command.rb +0 -0
- data/fixtures/my_lib/{src → modules}/geometry.rb +0 -0
- data/fixtures/my_lib/modules/gl.rb +4 -0
- data/fixtures/my_lib/modules/gl/container.rb +8 -0
- data/fixtures/my_lib/modules/gl/control.rb +6 -0
- data/fixtures/my_lib/modules/gl/nested/nested.rb +8 -0
- data/fixtures/my_lib/{src → modules}/tool.rb +0 -0
- data/fixtures/my_lib/skippy.json +1 -1
- data/fixtures/my_project/skippy.json +2 -1
- data/fixtures/my_project/src/hello_world.rb +2 -2
- data/fixtures/my_project/src/hello_world/extension.json +9 -9
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/command.rb +4 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl.rb +4 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl/container.rb +8 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/modules/gl/control.rb +6 -0
- data/fixtures/project_with_lib/.skippy/libs/my-lib/skippy.json +5 -0
- data/fixtures/project_with_lib/.skippy/libs/my-other-lib/modules/something.rb +4 -0
- data/fixtures/project_with_lib/.skippy/libs/my-other-lib/skippy.json +5 -0
- data/fixtures/project_with_lib/skippy.json +25 -0
- data/fixtures/project_with_lib/skippy/commands/example.rb +14 -0
- data/fixtures/project_with_lib/src/hello_world.rb +47 -0
- data/fixtures/project_with_lib/src/hello_world/extension.json +10 -0
- data/fixtures/project_with_lib/src/hello_world/main.rb +21 -0
- data/fixtures/project_with_lib/src/hello_world/vendor/my-lib/command.rb +4 -0
- data/fixtures/project_with_lib/src/hello_world/vendor/my-other-lib/something.rb +4 -0
- data/lib/skippy.rb +2 -0
- data/lib/skippy/app.rb +2 -2
- data/lib/skippy/cli.rb +41 -20
- data/lib/skippy/command.rb +2 -4
- data/lib/skippy/config.rb +27 -22
- data/lib/skippy/config_accessors.rb +12 -12
- data/lib/skippy/group.rb +1 -3
- data/lib/skippy/helpers/file.rb +3 -3
- data/lib/skippy/installer.rb +49 -0
- data/lib/skippy/installer/git.rb +115 -0
- data/lib/skippy/installer/local.rb +19 -0
- data/lib/skippy/lib_module.rb +16 -16
- data/lib/skippy/lib_source.rb +139 -0
- data/lib/skippy/library.rb +50 -10
- data/lib/skippy/library_manager.rb +116 -18
- data/lib/skippy/module_manager.rb +104 -26
- data/lib/skippy/namespace.rb +17 -1
- data/lib/skippy/project.rb +34 -4
- data/lib/skippy/version.rb +3 -1
- data/skippy.gemspec +10 -5
- metadata +85 -29
- data/cSpell.json +0 -18
data/.vscode/settings.json
CHANGED
@@ -1,5 +1,44 @@
|
|
1
1
|
// Place your settings in this file to overwrite default and user settings.
|
2
2
|
{
|
3
|
-
"editor.
|
4
|
-
"
|
3
|
+
"editor.wordWrap": "off",
|
4
|
+
"editor.rulers": [
|
5
|
+
80
|
6
|
+
],
|
7
|
+
|
8
|
+
|
9
|
+
"files.insertFinalNewline": true,
|
10
|
+
|
11
|
+
"ruby.lint": {
|
12
|
+
"rubocop": true
|
13
|
+
},
|
14
|
+
|
15
|
+
"[markdown]": {
|
16
|
+
"editor.wordWrap": "bounded",
|
17
|
+
"editor.wordWrapColumn": 80
|
18
|
+
},
|
19
|
+
|
20
|
+
"todohighlight.keywordsPattern": "(TODO|FIXME|KLUDGE)(\\([^)]+\\))?:",
|
21
|
+
"todohighlight.include": [
|
22
|
+
"**/*.rb",
|
23
|
+
"**/*.md",
|
24
|
+
"**/*.html",
|
25
|
+
"**/*.js",
|
26
|
+
"**/*.css"
|
27
|
+
],
|
28
|
+
"todohighlight.exclude": [
|
29
|
+
"**/node_modules/**",
|
30
|
+
"**/bower_components/**",
|
31
|
+
"**/dist/**",
|
32
|
+
"**/build/**",
|
33
|
+
"**/.vscode/**",
|
34
|
+
"**/.github/**",
|
35
|
+
"**/_output/**",
|
36
|
+
"**/*.min.*",
|
37
|
+
"**/*.map",
|
38
|
+
"**/.next/**",
|
39
|
+
"fixtures/**",
|
40
|
+
"pkg/**",
|
41
|
+
"tmp/**",
|
42
|
+
"vendor/**",
|
43
|
+
]
|
5
44
|
}
|
data/.vscode/tasks.json
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
{
|
2
|
-
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
3
|
-
// for the documentation about the tasks.json format
|
4
|
-
"version": "0.1.0",
|
5
|
-
"command": "bundle",
|
6
|
-
"isShellCommand": true,
|
7
|
-
"showOutput": "always",
|
8
|
-
"echoCommand": true,
|
9
|
-
"args": ["exec", "rake"],
|
10
|
-
"tasks": [{
|
11
|
-
"taskName": "test",
|
12
|
-
"args": ["TEST=${relativeFile}"],
|
13
|
-
"isTestCommand": true,
|
14
|
-
"isBuildCommand": true
|
15
|
-
}]
|
16
|
-
}
|
1
|
+
{
|
2
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
3
|
+
// for the documentation about the tasks.json format
|
4
|
+
"version": "0.1.0",
|
5
|
+
"command": "bundle",
|
6
|
+
"isShellCommand": true,
|
7
|
+
"showOutput": "always",
|
8
|
+
"echoCommand": true,
|
9
|
+
"args": ["exec", "rake"],
|
10
|
+
"tasks": [{
|
11
|
+
"taskName": "test",
|
12
|
+
"args": ["TEST=${relativeFile}"],
|
13
|
+
"isTestCommand": true,
|
14
|
+
"isBuildCommand": true
|
15
|
+
}]
|
16
|
+
}
|
data/Gemfile
CHANGED
@@ -4,6 +4,15 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
group :development do
|
7
|
-
|
8
|
-
#gem 'aruba', :
|
7
|
+
# Original fork with bug-fix. Appear to be gone now.
|
8
|
+
# gem 'aruba', git: 'https://github.com/daynix/aruba.git', branch: 'd-win-fix'
|
9
|
+
# Backup fork of the bug fix:
|
10
|
+
gem 'aruba', git: 'https://github.com/thomthom/aruba.git',
|
11
|
+
branch: 'd-win-fix'
|
12
|
+
# TODO: This might be a newer fix:
|
13
|
+
# gem 'aruba', git: 'https://github.com/rbld/aruba.git',
|
14
|
+
# branch: 'aruba-win-fix'
|
15
|
+
gem 'pry'
|
16
|
+
gem 'rubocop', '~> 0.51.0', require: false
|
17
|
+
gem 'webmock', '~> 3.1'
|
9
18
|
end
|
data/README.md
CHANGED
@@ -4,28 +4,39 @@
|
|
4
4
|
|
5
5
|
Skippy is a Command Line Interface which aims to automate common developer tasks for SketchUp Ruby extension development.
|
6
6
|
|
7
|
+
![](https://github.com/thomthom/skippy/wiki/images/skippy-cli.gif)
|
8
|
+
|
7
9
|
It is currently in very early stage of development so many things are incomplete. Feedback and contributions are welcome.
|
8
10
|
|
9
11
|
Some of the main goals are:
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
- [x] Quick initialization of new project with templates
|
14
|
+
- [ ] Add/Remove/Update user templates
|
15
|
+
- [ ] Automate common tasks
|
16
|
+
- [ ] Packaging the extension
|
17
|
+
- [ ] Start SketchUp in debug mode
|
18
|
+
- [x] Easy interface to add per-project custom commands/tasks
|
19
|
+
- [x] Library dependency management
|
20
|
+
- [x] Pull in third-party modules into extension namespace
|
21
|
+
- [x] Add/Remove/Update dependencies
|
22
|
+
|
23
|
+
## Requirements
|
24
|
+
|
25
|
+
Your system will need a version of Ruby 2.0 or newer installed.
|
26
|
+
|
27
|
+
macOS have a system version of Ruby already installed. If you need/want a different version you can for instance use [RVM](https://rvm.io/).
|
28
|
+
|
29
|
+
For Windows the easiest way to get Ruby running is using the [Ruby Installer for Windows](https://rubyinstaller.org/).
|
19
30
|
|
20
31
|
## Installation
|
21
32
|
|
22
|
-
|
33
|
+
```bash
|
34
|
+
gem install skippy
|
35
|
+
```
|
23
36
|
|
24
37
|
## Usage
|
25
38
|
|
26
|
-
|
27
|
-
|
28
|
-
Install the gem on your system, afterwards the `skippy` command should become available.
|
39
|
+
After installing the gem on your system, the `skippy` command should become available.
|
29
40
|
|
30
41
|
### Quick-Reference
|
31
42
|
|
@@ -33,11 +44,35 @@ Type `skippy` to list available commands.
|
|
33
44
|
|
34
45
|
Type `skippy help [COMMAND]` for more information on how to use each command.
|
35
46
|
|
36
|
-
Use `skippy new` to create a new project in the current folder.
|
47
|
+
Use `skippy new NAMESPACE` to create a new project in the current folder.
|
37
48
|
|
38
49
|
You can add custom per-project commands to a `skippy` folder in your project. Look at `skippy/example.rb` for an example of a simple custom command.
|
39
50
|
|
40
|
-
###
|
51
|
+
### Project Setup
|
52
|
+
|
53
|
+
Create a new Skippy powered project by using the `skippy new` command in the project's root directory. Provide Skippy with the extension namespace:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
skippy new Example::HelloWorld
|
57
|
+
```
|
58
|
+
|
59
|
+
Skippy will then scaffold the bare minimum for a SketchUp extension.
|
60
|
+
|
61
|
+
Currently Skippy assumes that the source for the extension is located under a directory named `src`.
|
62
|
+
|
63
|
+
![](https://github.com/thomthom/skippy/wiki/images/skippy-project.gif)
|
64
|
+
|
65
|
+
#### Project Templates
|
66
|
+
|
67
|
+
TODO: ...
|
68
|
+
|
69
|
+
### Custom Project Commands
|
70
|
+
|
71
|
+
In addition to scaffold the extension source code Skippy also creates a directory named `skippy` in the project root. Here it is possible to add custom Skippy commands to aid your project development. For instance running build scripts and other task automations.
|
72
|
+
|
73
|
+
Look at the default [`skippy/example.rb`](app/resources/commands/example.rb).
|
74
|
+
|
75
|
+
#### Power of Thor
|
41
76
|
|
42
77
|
Skippy is built on [Thor](https://github.com/erikhuda/thor). Refer to [Thor's Website](http://whatisthor.com/) and [documentation](http://www.rubydoc.info/github/wycats/thor/index) for details on creating commands.
|
43
78
|
|
@@ -46,12 +81,156 @@ When creating Skippy command use the following replacements:
|
|
46
81
|
* Instead of class `Thor`, use `Skippy::Command`
|
47
82
|
* Instead of class `Thor::Group`, use `Skippy::Command::Group`
|
48
83
|
|
84
|
+
### Installing Libraries
|
85
|
+
|
86
|
+
Skippy offer a simple library dependency system. It can install a third party library into project workspace where by its various modules can be integrated into your extension project.
|
87
|
+
|
88
|
+
The installed library is cached into `.skippy` directory. Don't check this into version control.
|
89
|
+
|
90
|
+
When you check out an existing Skippy Project from source control use `skippy install` to install the required dependencies.
|
91
|
+
|
92
|
+
#### Installing from Git Repositories
|
93
|
+
|
94
|
+
```bash
|
95
|
+
skippy lib:install https://github.com/thomthom/tt-lib.git
|
96
|
+
```
|
97
|
+
|
98
|
+
#### Installing from Git shorthand.
|
99
|
+
|
100
|
+
```bash
|
101
|
+
skippy lib:install thomthom/tt-lib
|
102
|
+
```
|
103
|
+
|
104
|
+
In the above example Skippy will look for the library `tt-lib` under the username `thomthom` from either [bitbucket.org](https://bitbucket.org/) or [github.com](https://github.com/)
|
105
|
+
|
106
|
+
The sources can be altered per project by modifying `sources` in `skippy.json`:
|
107
|
+
|
108
|
+
```
|
109
|
+
"sources": [
|
110
|
+
"github.com",
|
111
|
+
"bitbucket.org"
|
112
|
+
],
|
113
|
+
```
|
114
|
+
|
115
|
+
Note that currently all source will be prefixed `https://` and post-fixed with the provided short-name. E.g., `thomthom/tt-lib` will resolve to `http://github.com/thomthom/tt-lib.git` and `http://bitbucket.org/thomthom/tt-lib.git` as `skippy` searches for matching sources.
|
116
|
+
|
117
|
+
#### Installing from Local Directory
|
118
|
+
|
119
|
+
```bash
|
120
|
+
skippy lib:install ~/source/my-lib
|
121
|
+
```
|
122
|
+
|
123
|
+
It is also possible to install from a local directory. Pass in the path to the directory that contains the `skippy.json` of the library.
|
124
|
+
|
125
|
+
![](https://github.com/thomthom/skippy/wiki/images/skippy-install-library.gif)
|
126
|
+
|
127
|
+
### Using Modules
|
128
|
+
|
129
|
+
Once a library is installed its modules can be used within the extension project. List the names of the available modules using `skippy lib:list`.
|
130
|
+
|
131
|
+
Once you know the name you can instruct Skippy to use it:
|
132
|
+
|
133
|
+
```bash
|
134
|
+
skippy lib:use tt-lib/gl
|
135
|
+
```
|
136
|
+
|
137
|
+
This will copy the module from the `.skippy` directory and into `src/<ExtensionName>/vendor/<LibraryName>`. At the same time the outer namespace in the source code is changed to match your project's namespace.
|
138
|
+
|
139
|
+
![](https://github.com/thomthom/skippy/wiki/images/skippy-use-module.gif)
|
140
|
+
|
141
|
+
### Removing Modules
|
142
|
+
|
143
|
+
A library module can be removed by using `skippy lib:remove`:
|
144
|
+
|
145
|
+
```bash
|
146
|
+
skippy lib:remove tt-lib/gl
|
147
|
+
```
|
148
|
+
|
149
|
+
This removes the files for that module from the `vendor` directory.
|
150
|
+
|
151
|
+
![](https://github.com/thomthom/skippy/wiki/images/skippy-remove-module.gif)
|
152
|
+
|
153
|
+
### Uninstalling Libraries
|
154
|
+
|
155
|
+
Libraries can be completely removed from a project using `skippy lib::uninstall`:
|
156
|
+
|
157
|
+
```bash
|
158
|
+
skippy lib:uninstall tt-lib
|
159
|
+
```
|
160
|
+
|
161
|
+
This will remove all the library's modules in the `vendor` directory as well as removing the cached library in `.skippy`.
|
162
|
+
|
163
|
+
![](https://github.com/thomthom/skippy/wiki/images/skippy-uninstall-library.gif)
|
164
|
+
|
165
|
+
### Anatomy of a Skippy Library
|
166
|
+
|
167
|
+
Below is an example of a simple Skippy Library:
|
168
|
+
|
169
|
+
```
|
170
|
+
example-library/
|
171
|
+
├── modules/
|
172
|
+
│ ├── hello/
|
173
|
+
│ │ ├── extra.html
|
174
|
+
│ │ └── extra.rb
|
175
|
+
│ ├── hello.rb
|
176
|
+
│ └── world.rb
|
177
|
+
└── skippy.json
|
178
|
+
```
|
179
|
+
|
180
|
+
Each `.rb` under the `modules` directory is a Skippy Module. In this example the library contains the modules `hello` and `world`.
|
181
|
+
|
182
|
+
Each Skippy Module can have a support directories where additional source code or assets can be organized. This support directory must match the filename of the module. In the example above this is illustrated by the Ruby file `modules/hello.rb` along with directory `modules/hello`.
|
183
|
+
|
184
|
+
`skippy.json` contains meta data which is required to identify the library:
|
185
|
+
|
186
|
+
```json
|
187
|
+
{
|
188
|
+
"library": true,
|
189
|
+
"name": "my-lib",
|
190
|
+
"version": "1.0.0"
|
191
|
+
}
|
192
|
+
```
|
193
|
+
|
194
|
+
The `name` value from `skippy.json` is the name that the users will use to refer to the library via `skippy`.
|
195
|
+
|
196
|
+
If distributing the library via Git, the `version` value should match the tag from source control.
|
197
|
+
|
198
|
+
A library can contain additional files or directories, for instance tests. They will simply be ignored by `skippy`.
|
199
|
+
|
200
|
+
For more examples, refer to:
|
201
|
+
* [github.com/thomthom/tt-lib](https://github.com/thomthom/tt-lib)
|
202
|
+
* [github.com/thomthom/skippy-test-lib](https://github.com/thomthom/skippy-test-lib)
|
203
|
+
|
49
204
|
## Development
|
50
205
|
|
51
|
-
After checking out the
|
206
|
+
After checking out the repository, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
207
|
+
|
208
|
+
If there are problems installing dependencies try installing them locally and see if that works: `bundle install --path vendor/bundle`
|
52
209
|
|
53
210
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
54
211
|
|
212
|
+
### Reminders
|
213
|
+
|
214
|
+
Run individual tests: `bundle exec rake test TEST=test/library_source.rb`
|
215
|
+
|
216
|
+
Run individual cucumber features: `bundle exec cucumber features/library.feature`
|
217
|
+
|
218
|
+
## FAQ
|
219
|
+
|
220
|
+
### SSL Errors?
|
221
|
+
|
222
|
+
https://github.com/oneclick/rubyinstaller/issues/324#issuecomment-221383285
|
223
|
+
|
224
|
+
> Download newest certs (cacert.pem) from here
|
225
|
+
>
|
226
|
+
> https://curl.haxx.se/docs/caextract.html
|
227
|
+
>
|
228
|
+
> Set environment variable to the full path location of the downloaded file. Eg:
|
229
|
+
>
|
230
|
+
> set SSL_CERT_FILE=C:\somewhere\cacert.pem
|
231
|
+
>
|
232
|
+
> To make it permanent, set `SSL_CERT_FILE` in "Advanced System Settings"
|
233
|
+
|
55
234
|
## Contributing
|
56
235
|
|
57
236
|
Bug reports and pull requests are welcome on GitHub at https://github.com/thomthom/skippy.
|
data/Rakefile
CHANGED
data/app/boot.rb
CHANGED
@@ -24,7 +24,7 @@ begin
|
|
24
24
|
require 'thor/runner'
|
25
25
|
# This is also needed to be set in order for Thor's utilities to output
|
26
26
|
# command names correctly.
|
27
|
-
$thor_runner = true
|
27
|
+
$thor_runner = true # rubocop:disable Style/GlobalVars
|
28
28
|
ensure
|
29
29
|
$VERBOSE = original_verbose
|
30
30
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
require 'skippy/app'
|
4
|
+
require 'skippy/group'
|
5
|
+
require 'skippy/project'
|
6
|
+
|
7
|
+
class Install < Skippy::Command::Group
|
8
|
+
|
9
|
+
attr_reader :project
|
10
|
+
|
11
|
+
def initialize_project
|
12
|
+
@project = Skippy::Project.current_or_fail
|
13
|
+
end
|
14
|
+
|
15
|
+
def installing_libraries
|
16
|
+
say ''
|
17
|
+
say 'Installing libraries...'
|
18
|
+
say ''
|
19
|
+
project.config.get(:libraries, []).each { |library|
|
20
|
+
say 'Missing library version', :red if library[:version].nil?
|
21
|
+
say 'Missing library source', :red if library[:source].nil?
|
22
|
+
next if library[:version].nil? || library[:source].nil?
|
23
|
+
|
24
|
+
options = {
|
25
|
+
requirement: library[:version]
|
26
|
+
}
|
27
|
+
options[:branch] = library[:branch] unless library[:branch].nil?
|
28
|
+
lib = project.libraries.install(library[:source], options)
|
29
|
+
|
30
|
+
unless lib.version == library[:version]
|
31
|
+
say "Expected version #{library[:version]}, got #{lib.version}", :red
|
32
|
+
end
|
33
|
+
|
34
|
+
say "Installed library: #{lib.name} (#{lib.version})", :green
|
35
|
+
say lib.path
|
36
|
+
}
|
37
|
+
# Don't save project - as all that is being done here is installing missing
|
38
|
+
# library cache into the .skippy directory.
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/app/commands/lib.rb
CHANGED
@@ -18,7 +18,7 @@ class Lib < Skippy::Command
|
|
18
18
|
say 'Installed libraries:', :yellow
|
19
19
|
libraries.each { |library|
|
20
20
|
say
|
21
|
-
say "#{library.
|
21
|
+
say "#{library.name} (#{library.version})", [:bold, :yellow]
|
22
22
|
library.modules.each { |lib_module|
|
23
23
|
lib_info = " #{lib_module}"
|
24
24
|
lib_info << ' (installed)' if project.modules.installed?(lib_module)
|
@@ -29,18 +29,58 @@ class Lib < Skippy::Command
|
|
29
29
|
end
|
30
30
|
default_command(:list)
|
31
31
|
|
32
|
+
method_option :version,
|
33
|
+
aliases: ['-v'],
|
34
|
+
type: :string
|
35
|
+
method_option :branch,
|
36
|
+
aliases: ['-b'],
|
37
|
+
type: :string
|
32
38
|
desc 'install SOURCE', 'Install a new library'
|
33
39
|
def install(source)
|
34
40
|
project = Skippy::Project.current_or_fail
|
35
|
-
|
41
|
+
libraries = project.libraries
|
42
|
+
library = libraries.install(source, install_options(options)) { |type, message|
|
43
|
+
color = type == :warning ? :red : :yellow
|
44
|
+
say message, color
|
45
|
+
}
|
46
|
+
project.save
|
36
47
|
say "Installed library: #{library.name} (#{library.version})"
|
37
48
|
end
|
38
49
|
|
50
|
+
desc 'uninstall LIBRARY', 'Uninstall a library'
|
51
|
+
def uninstall(library_name)
|
52
|
+
project = Skippy::Project.current_or_fail
|
53
|
+
library = project.libraries.uninstall(library_name)
|
54
|
+
project.save
|
55
|
+
say "Uninstalled library: #{library.name} (#{library.version})"
|
56
|
+
end
|
57
|
+
|
39
58
|
desc 'use MODULE', 'Use a library module'
|
40
59
|
def use(module_path)
|
41
60
|
project = Skippy::Project.current_or_fail
|
42
61
|
lib_module = project.modules.use(module_path)
|
62
|
+
project.save
|
43
63
|
say "Using module: #{lib_module}"
|
44
64
|
end
|
45
65
|
|
66
|
+
desc 'remove MODULE', 'Remove a library module'
|
67
|
+
def remove(module_path)
|
68
|
+
project = Skippy::Project.current_or_fail
|
69
|
+
lib_module = project.modules.remove(module_path)
|
70
|
+
project.save
|
71
|
+
say "Removed module: #{lib_module}"
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def install_options(cli_options)
|
77
|
+
options = cli_options.map { |k, v| [k.to_sym, v] }.to_h
|
78
|
+
# The CLI options "version" is internally a "requirement".
|
79
|
+
if options.key?(:version)
|
80
|
+
options[:requirement] = options[:version]
|
81
|
+
options.delete(:version)
|
82
|
+
end
|
83
|
+
options
|
84
|
+
end
|
85
|
+
|
46
86
|
end
|