Skip to content

Commit

Permalink
closes #100; closes #103; added ability to fetch all strawberry perls…
Browse files Browse the repository at this point in the history
… with the "brewbuild fetch all" command
  • Loading branch information
stevieb9 committed Feb 16, 2018
1 parent cc99177 commit b2417db
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Changes
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ Revision history for berrybrew
- fixed issue where the orphaned Perls that were installed prior to - fixed issue where the orphaned Perls that were installed prior to
using "fetch" weren't being registered as custom correctly (required using "fetch" weren't being registered as custom correctly (required
two calls to "fetch"). To fix, added new two calls to "fetch"). To fix, added new
PerlUpdateAvailableListOrphans()(closes #102; closes #99) PerlUpdateAvailableListOrphans()(closes #102; closes #99) (Thanks

@pryrt for the notice!)
- added ability to fetch every single Perl version Strawberry has to
offer with the new "all" argument to "berrybrew fetch" (closes #100;
closes #103) (thanks @pryrt for the notice!)

1.17 2017-10-04 1.17 2017-10-04
- task information displayed during install operation is now in logical - task information displayed during install operation is now in logical
order (fixes #95) order (fixes #95)
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ will reside.
config Add berrybrew to your PATH config Add berrybrew to your PATH
clean * Remove all temporary berrybrew files clean * Remove all temporary berrybrew files
clone Clones an installed version to a custom-named one clone Clones an installed version to a custom-named one
fetch Upgrade the list of Strawberry Perl instances available fetch * Upgrade the list of Strawberry Perl instances available
install Download, extract and install a Strawberry Perl install Download, extract and install a Strawberry Perl
register Manually register a custom installation directory register Manually register a custom installation directory
remove Uninstall a Strawberry Perl remove Uninstall a Strawberry Perl
Expand Down Expand Up @@ -241,6 +241,9 @@ Use `berrybrew fetch` to retrieve the most recent availability list from
Strawberry Perl. If any new or changed versions are found, we'll update the Strawberry Perl. If any new or changed versions are found, we'll update the
local `perls.json` file with them. local `perls.json` file with them.


If you supply the `all` subcommand to `berrybrew fetch`, we will load all
available Perls that Strawberry has to offer.

## Configure Root Directory ## Configure Root Directory


By default, we manage Perls out of the `C:\berrybrew` directory. To By default, we manage Perls out of the `C:\berrybrew` directory. To
Expand Down
19 changes: 15 additions & 4 deletions data/messages.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
" clone Make a complete copy of a Perl installation", " clone Make a complete copy of a Perl installation",
" config Add berrybrew to your PATH", " config Add berrybrew to your PATH",
" exec * Run a command for every installed Strawberry Perl", " exec * Run a command for every installed Strawberry Perl",
" fetch Update the list of Strawberry Perl instances available", " fetch * Update the list of Strawberry Perl instances available",
" install Download, extract and install a Strawberry Perl", " install Download, extract and install a Strawberry Perl",
" off Disable berrybrew perls (use 'switch' to re-enable)", " off Disable berrybrew perls (use 'switch' to re-enable)",
" register Manually register a custom installation directory", " register Manually register a custom installation directory",
Expand Down Expand Up @@ -206,7 +206,7 @@
"", "",
" temp Removes all downloaded Perl installation files", " temp Removes all downloaded Perl installation files",
" orphan Deletes all orphaned Perl installations", " orphan Deletes all orphaned Perl installations",
" all Clean everything", " all Clean everything"
] ]
}, },
{ {
Expand All @@ -221,6 +221,18 @@
" Execute a command across only select versions of Perl" " Execute a command across only select versions of Perl"
] ]
}, },
{
"label": "subcmd.fetch",

"content": [
"",
" berrybrew 'fetch' subcommands:",
"",
" all",
"",
" When fetching the updated Perl list, fetch all available versions."
]
},
{ {
"label": "subcmd.use", "label": "subcmd.use",


Expand All @@ -244,8 +256,7 @@
"", "",
" Use the given version (or versions) of Perl temporarily,", " Use the given version (or versions) of Perl temporarily,",
" with each new version spawning its own command window.", " with each new version spawning its own command window.",
" When done with a given version, type exit to close that window.", " When done with a given version, type exit to close that window."
] ]
} }

] ]
8 changes: 7 additions & 1 deletion doc/Berrybrew API.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -488,12 +488,18 @@ the corresponding object.


#### PerlUpdateAvailableList #### PerlUpdateAvailableList


public void PerlUpdateAvailableList() public void PerlUpdateAvailableList(bool allPerls=false)


argument: allPerls
value: Bool
Fetches the JSON list of Strawberry Perl instances available from Fetches the JSON list of Strawberry Perl instances available from
[Strawberry's releases.json](https://strawberryperl.com/releases.json), and [Strawberry's releases.json](https://strawberryperl.com/releases.json), and
updates the internal `perls.json` available list with the updated data. updates the internal `perls.json` available list with the updated data.


If the `allPerls` bool is set to true, we will fetch all available Strawberry
Perl listings.

#### PerlUpdateAvailableListOrphans() #### PerlUpdateAvailableListOrphans()


Automatically registered any orphaned Perls after using the `Fetch()` method. This Automatically registered any orphaned Perls after using the `Fetch()` method. This
Expand Down
6 changes: 5 additions & 1 deletion doc/berrybrew.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -109,12 +109,16 @@ Also, by default, we don't execute on custom (cloned) instances. Set


#### fetch #### fetch


Usage: `berrybrew fetch` Usage: `berrybrew fetch [all]`


Pulls the JSON list of available Strawberry Perl instances from the Strawberry Pulls the JSON list of available Strawberry Perl instances from the Strawberry
website, and puts them into the `data/perls.json` file. Any updates will be website, and puts them into the `data/perls.json` file. Any updates will be
available immediately with `berrybrew available`. available immediately with `berrybrew available`.


Send in the all string as a subcommand and instead of listing the most
recent version for every major version, we'll download every version that
Strawberry has to offer.

#### install #### install


Usage: `berrybrew install <version>` Usage: `berrybrew install <version>`
Expand Down
14 changes: 13 additions & 1 deletion src/bbconsole.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ static void Main(string[] args){
break; break;


case "fetch": case "fetch":
BB.PerlUpdateAvailableList(); bool allPerls = false;
if (args.Length > 1){
if (args[1].StartsWith("h"))
BB.Message.Say("subcmd.fetch");
else
allPerls = args[1].Equals("all");
}

BB.PerlUpdateAvailableList(allPerls);
BB.PerlUpdateAvailableListOrphans(); BB.PerlUpdateAvailableListOrphans();
break; break;


Expand All @@ -97,6 +105,10 @@ static void Main(string[] args){
BB.Message.Say("subcmd.exec"); BB.Message.Say("subcmd.exec");
break; break;


case "fetch":
BB.Message.Say("subcmd.fetch");
break;

case "use": case "use":
BB.Message.Say("subcmd.use"); BB.Message.Say("subcmd.use");
break; break;
Expand Down
4 changes: 2 additions & 2 deletions src/berrybrew.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ public void PerlRegisterCustomInstall(string perlName, StrawberryPerl perlBase=n
this.bypassOrphanCheck = true; this.bypassOrphanCheck = true;
} }


public void PerlUpdateAvailableList(){ public void PerlUpdateAvailableList(bool allPerls=false){


Console.WriteLine("Attempting to fetch the updated Perls list..."); Console.WriteLine("Attempting to fetch the updated Perls list...");


Expand Down Expand Up @@ -1019,7 +1019,7 @@ public void PerlUpdateAvailableList(){
string majorVersion = majorVersionParts[0] + "." + majorVersionParts[1]; string majorVersion = majorVersionParts[0] + "." + majorVersionParts[1];
string bbMajorVersion = majorVersion + "_" + bits; string bbMajorVersion = majorVersion + "_" + bits;


if (perls.Contains(bbMajorVersion)) if (perls.Contains(bbMajorVersion) && ! allPerls)
continue; continue;


perls.Add(bbMajorVersion); perls.Add(bbMajorVersion);
Expand Down

0 comments on commit b2417db

Please sign in to comment.