Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path get/set for recording path change #24

Merged
merged 4 commits into from
Aug 28, 2014
Merged

Conversation

popomore
Copy link
Contributor

Implement for #19 (comment)

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling ca8a7bd on popomore:master into 83bd747 on wearefractal:master.

},
set: function(path) {
if (!this.history) {
this.history = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this in the constructor, no reason to do it lazily

@popomore
Copy link
Contributor Author

OK, I have update this PR.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling f3f9be0 on popomore:master into 83bd747 on wearefractal:master.

this.history.push(path);
}

this._path = path;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed? _path shouldnt exist anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forget it

@@ -11,6 +11,9 @@ var cloneBuffer = require('./lib/cloneBuffer');
function File(file) {
if (!file) file = {};

// record path change
this.history = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.history = [file.path] then ditch the this.path == file.path || null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file.path will be null, then this.history = file.path ? [file.path] : [], is that ok?

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling d95023f on popomore:master into 83bd747 on wearefractal:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 7c71bf3 on popomore:master into 83bd747 on wearefractal:master.

return this.history[this.history.length - 1];
},
set: function(path) {
// record history only when path changed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for typeof string on path and throw if its not? this would make the most sense IMO vs. doing null checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I check empty string?

The condition is typeof path === 'string' && path, any suggestion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty string will be ignore when set the path, needn't check. Now updated

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling e50ceac on popomore:master into 83bd747 on wearefractal:master.

@popomore
Copy link
Contributor Author

popomore commented Jul 1, 2014

@contra code has been updated follow your suggestion

@popomore
Copy link
Contributor Author

popomore commented Jul 2, 2014

ping @contra

@yocontra
Copy link
Member

yocontra commented Jul 2, 2014

Still thinking about it

@yocontra yocontra closed this Jul 2, 2014
@yocontra yocontra reopened this Jul 2, 2014
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling e50ceac on popomore:master into 83bd747 on wearefractal:master.

@@ -11,12 +11,13 @@ var cloneBuffer = require('./lib/cloneBuffer');
function File(file) {
if (!file) file = {};

// record path change
this.history = file.path ? [file.path] : [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only noticed this because of the clone issue... I think this line should be
this.history = file.path ? (Array.isArray(file.path) ? file.path : [file.path]) : [];
This allows using clone like it is below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doowb file.path will never be an array though, file.history will though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. I was wondering how history would be cloned when I was looking at this and I think it messed up how I was thinking of this.path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doowb clone will have to be rewritten for custom properties and history support

@popomore
Copy link
Contributor Author

Any response?

@popomore
Copy link
Contributor Author

How about this PR?

yocontra added a commit that referenced this pull request Aug 28, 2014
path get/set for recording path change
@yocontra yocontra merged commit a807acf into gulpjs:master Aug 28, 2014
@yocontra
Copy link
Member

Still need to update clone to support copying history

@popomore
Copy link
Contributor Author

👍

I will send another PR about this.

@yocontra
Copy link
Member

@popomore There are 3 open pull requests and a bunch of issues for clone. If you can roll them all up into one pull request with tests I'll buy you a drink 🍻

@popomore
Copy link
Contributor Author

All right 🍻

line-o added a commit to podlove/podlove-web-player that referenced this pull request Sep 5, 2014
phated pushed a commit that referenced this pull request Sep 27, 2016
path get/set for recording path change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants