File tree Expand file tree Collapse file tree 8 files changed +60
-15
lines changed Expand file tree Collapse file tree 8 files changed +60
-15
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,6 @@ testbench.yaml
16
16
# ide
17
17
/.idea
18
18
/.vscode
19
+
20
+ # mac
21
+ .DS_Store
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,7 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) , and this project adheres
6
6
to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
- ## [ Unreleased] ( https://github.com/BlameButton/laravel-changelog/compare/v1.0.1...main )
8
+ ## [ Unreleased] ( https://github.com/BlameButton/laravel-changelog/compare/v1.0.4...main )
9
+
10
+ ## [ v1.0.4] ( https://github.com/BlameButton/laravel-changelog/compare/v1.0.3...v1.0.4 ) - 2021-11-05
11
+
12
+ ### Fixed
13
+
14
+ - Storage facade does not work outside of storage directory
15
+
16
+ ## [ v1.0.3] ( https://github.com/BlameButton/laravel-changelog/compare/v1.0.2...v1.0.3 ) - 2021-11-05
17
+
18
+ ### Fixed
19
+
20
+ - Filename is retrieved using the wrong key
9
21
10
22
## [ v1.0.2] ( https://github.com/BlameButton/laravel-changelog/compare/v1.0.1...v1.0.2 ) - 2021-11-05
11
23
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ use BlameButton\Laravel\Changelog\ChangelogFacade;
24
24
* Get the raw content of your changelog file.
25
25
*/
26
26
ChangelogFacade::raw();
27
+
28
+ /**
29
+ * Get the HTML version of your changelog file.
30
+ */
31
+ ChangelogFacade::html();
27
32
```
28
33
29
34
### Testing
File renamed without changes.
Original file line number Diff line number Diff line change 3
3
namespace BlameButton \Laravel \Changelog ;
4
4
5
5
use BlameButton \Laravel \Changelog \Exceptions \ChangelogNotFoundException ;
6
- use Illuminate \Support \Facades \Storage ;
6
+ use Illuminate \Mail \Markdown ;
7
+ use Illuminate \Support \HtmlString ;
7
8
8
9
class Changelog
9
10
{
10
- private function getFile (): string
11
+ /**
12
+ * Get the location of the changelog file.
13
+ *
14
+ * @return string
15
+ */
16
+ public function path (): string
11
17
{
12
- return config ('config .file ' , base_path ('CHANGELOG.md ' ));
18
+ return config ('changelog .file ' , base_path ('CHANGELOG.md ' ));
13
19
}
14
20
21
+ /**
22
+ * Get the raw content of the changelog.
23
+ *
24
+ * @return string
25
+ * @throws ChangelogNotFoundException when the changelog file can not be found.
26
+ */
15
27
public function raw (): string
16
28
{
17
- $ file = $ this ->getFile ();
29
+ $ file = $ this ->path ();
18
30
19
- if (! Storage:: exists ($ file )) {
31
+ if (! file_exists ($ file )) {
20
32
throw new ChangelogNotFoundException ();
21
33
}
22
34
23
- return Storage::get ($ file );
35
+ return file_get_contents ($ file );
36
+ }
37
+
38
+ /**
39
+ * Generate a HTML version of your changelog.
40
+ *
41
+ * @return HtmlString
42
+ */
43
+ public function html (): HtmlString
44
+ {
45
+ return Markdown::parse ($ this ->raw ());
24
46
}
25
47
}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function boot()
21
21
22
22
if ($ this ->app ->runningInConsole ()) {
23
23
$ this ->publishes ([
24
- __DIR__ . '/../config/config .php ' => config_path ('changelog.php ' ),
24
+ __DIR__ . '/../config/changelog .php ' => config_path ('changelog.php ' ),
25
25
], 'config ' );
26
26
27
27
// Publishing the views.
@@ -50,7 +50,7 @@ public function boot()
50
50
public function register ()
51
51
{
52
52
// Automatically apply the package configuration
53
- $ this ->mergeConfigFrom (__DIR__ . '/../config/config .php ' , 'changelog ' );
53
+ $ this ->mergeConfigFrom (__DIR__ . '/../config/changelog .php ' , 'changelog ' );
54
54
55
55
// Register the main class to use with the facade
56
56
$ this ->app ->singleton ('changelog ' , function () {
Original file line number Diff line number Diff line change 2
2
3
3
namespace BlameButton \Laravel \Changelog \Tests ;
4
4
5
- use BlameButton \Laravel \Changelog \ChangelogFacade ;
5
+ use BlameButton \Laravel \Changelog \Changelog ;
6
6
use BlameButton \Laravel \Changelog \ChangelogServiceProvider ;
7
7
use Illuminate \Support \Facades \Storage ;
8
+ use Mockery \MockInterface ;
8
9
use Orchestra \Testbench \TestCase ;
9
10
10
11
class ChangelogTest extends TestCase
@@ -29,7 +30,13 @@ public function testRaw(): void
29
30
30
31
Storage::put (base_path ('CHANGELOG.md ' ), $ expected );
31
32
32
- $ content = ChangelogFacade::raw ();
33
+ /** @var Changelog $changelog */
34
+ $ changelog = $ this ->mock (Changelog::class, function (MockInterface $ mock ) {
35
+ $ mock ->shouldReceive ('path ' )->andReturn (Storage::path (base_path ('CHANGELOG.md ' )));
36
+ $ mock ->shouldReceive ('raw ' )->passthru ();
37
+ });
38
+
39
+ $ content = $ changelog ->raw ();
33
40
34
41
self ::assertNotNull ($ content );
35
42
self ::assertEquals ($ expected , $ content );
You can’t perform that action at this time.
0 commit comments