Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chromebrew
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
chromebrew
Commits
fe6ac03c
Commit
fe6ac03c
authored
Jan 11, 2017
by
Damian Montero
Committed by
GitHub
Jan 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #334 from uberhacker/feature/add-crew-whatprovides-command
Add crew whatprovides command
parents
41258993
4ada4e25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
6 deletions
+37
-6
crew
crew
+37
-6
No files found.
crew
View file @
fe6ac03c
...
...
@@ -28,7 +28,6 @@ case ARCH
SHORTARCH
=
"32"
end
$LOAD_PATH
.
unshift
"
#{
CREW_LIB_PATH
}
lib"
USER
=
`whoami`
.
chomp
...
...
@@ -52,8 +51,8 @@ end
def
list_packages
Find
.
find
(
CREW_LIB_PATH
+
'packages'
)
do
|
filename
|
Find
.
find
(
CREW_CONFIG_PATH
+
'meta/'
)
do
|
packageList
|
packageName
=
File
.
basename
filename
,
'.rb'
print
'(i) '
if
packageList
==
CREW_CONFIG_PATH
+
'meta/'
+
packageName
+
'.filelist'
packageName
=
File
.
basename
filename
,
'.rb'
print
'(i) '
if
packageList
==
CREW_CONFIG_PATH
+
'meta/'
+
packageName
+
'.filelist'
end
puts
File
.
basename
filename
,
'.rb'
if
File
.
extname
(
filename
)
==
'.rb'
end
...
...
@@ -66,6 +65,32 @@ def search (pkgName, silent = false)
abort
"package
#{
pkgName
}
not found :("
end
def
whatprovides
(
pkgName
)
fileArray
=
[]
Find
.
find
(
CREW_CONFIG_PATH
+
'meta/'
)
do
|
packageList
|
if
File
.
file?
packageList
if
packageList
[
/\.filelist$/
]
packageName
=
File
.
basename
packageList
,
'.filelist'
File
.
readlines
(
packageList
).
each
do
|
line
|
found
=
line
[
/
#{
Regexp
.
new
(
pkgName
)
}
/
]
if
found
fileLine
=
packageName
+
': '
+
line
if
not
fileArray
.
include?
fileLine
fileArray
.
push
(
fileLine
)
end
end
end
end
end
end
if
not
fileArray
.
empty?
fileArray
.
sort
.
each
do
|
item
|
puts
item
end
puts
"
\n
Total found:
#{
fileArray
.
length
}
"
end
end
def
update
abort
"'crew update' is used to update crew itself. Use 'crew upgrade <packageName> to upgrade a specific package."
if
@pkgName
...
...
@@ -371,6 +396,12 @@ when "search"
else
list_packages
end
when
"whatprovides"
if
@pkgName
whatprovides
@pkgName
else
puts
"Usage: crew whatprovides [pattern]"
end
when
"download"
search
@pkgName
download
...
...
@@ -386,10 +417,10 @@ when "remove"
search
@pkgName
remove
when
nil
puts
"Chromebrew, version 0.2.
1
"
puts
"Chromebrew, version 0.2.
2
"
puts
"Usage: crew [command] [package]"
puts
"Available commands: search, download, install, remove"
puts
"Available commands: search, download, install, remove
, whatprovides
"
else
puts
"I have no idea how to do
#{
@command
}
:("
puts
"Available commands: search, download, install, remove"
puts
"Available commands: search, download, install, remove
, whatprovides
"
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment