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

Test against Jekyll 2 & 3 #8

Merged
merged 5 commits into from
Nov 25, 2015
Merged

Test against Jekyll 2 & 3 #8

merged 5 commits into from
Nov 25, 2015

Conversation

parkr
Copy link
Member

@parkr parkr commented Nov 16, 2015

No description provided.

@Stargator
Copy link

It seems that Opal is missing a dependency in the tilt gem. I've forked it and added the dependency, but there still is a failure of unknown cause to me.

@elia
Copy link

elia commented Nov 23, 2015

Tilt was a dependency of sprockets v2, since Opal moved to sprockets v3 Opal does not depend on Tilt anymore. That is true for Opal >= 0.8 IIRC.

The fix is to depend on Tilt directly for any app that uses it.

@parkr
Copy link
Member Author

parkr commented Nov 24, 2015

The fix is to depend on Tilt directly for any app that uses it.

@elia If it's a runtime requirement for every case, why isn't it specified as a runtime dependency?

@elia
Copy link

elia commented Nov 24, 2015

@parkr opal relies on sprockets which used to depend on tilt, but we never relied on it directly so the dependency was implicitly gone when we updated to a newer sprockets version (v2 → v3).

@Stargator
Copy link

After adding the tilt dependency, the problem I am seeing is test failures. It's difficult for me to understand because it deals with comparing large sections of code that gets converted which doesn't matched expected results.

@elia
Copy link

elia commented Nov 24, 2015

Glad to help if you can point me to a travis failure or a gist with the failure output / stacktrace.

@Stargator
Copy link

@Stargator
Copy link

So far I have determined that the generated code (for simple_js_output) by Opal in opal_converter_spec.rb is out of date. I can't get versions of Opal before 0.7.0 to run properly to generate the ruby code. It gives the same error as Travis CI when running versions of Opal below 0.7.0.

Though, all of the code generated by 0.7.0+ are the same to each other, they are different from the the current generated code which was done by version 0.6.2. So I would recommend a condition check of which version of Opal is used before the following tests:

"can build the opal stdlib" in opal_generator_spec.rb
"converts Ruby into Opal" in opal_converter_spec.rb

For simple_js_output in opal_converter_spec.rb the following will work for versions above 0.7.0

/* Generated by Opal 0.7.0 */
(function(Opal) {
  Opal.dynamic_require_severity = "error";
  var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;

  Opal.add_stubs(['$puts']);
  return self.$puts("ohai jekyll")
})(Opal);

For "can build the opal stdlib" in opal_generator_spec.rb, I don't know where subject.opal_stdlib is defined so I don't know how it differs from

(Opal);

@elia
Copy link

elia commented Nov 24, 2015

@Stargator any specific reason to support opal versions prior to 0.8.1?
I strongly advise against doing that, instead it's better to concentrate on 0.8.x.

As of 0.8.1 you probably need to specify the main asset you're loading with Opal.load('myapp') that's because proper support for Kernel#require has been introduced (in 0.7 IIRC).

@Stargator
Copy link

@elia I'm just working based off jekyll-opal's gemspec which still lists "opal", "~> 0.6.0". So given that, the tests need to work with those versions. Unless the contributors decide going forward to do it otherwise, I'm not including additional changes.

@elia
Copy link

elia commented Nov 24, 2015

@Stargator of course, it's their call. Consider that just as a heads-up regarding the fact that until Opal v1.0 breaking changes will bump the middle version number, thus making kinda difficult to support wide ranges of them.

Anyway the fix is probably to pass to Opal.compile (as used here) the requirable: false option to have the code ran right away, but that option is valid only in the latest versions

Even better would be to use Opal::Builder that is more high level and should take care of everything.

@parkr
Copy link
Member Author

parkr commented Nov 24, 2015

@Stargator, feel free to upgrade Opal.

@Stargator
Copy link

Will do, @parkr. I'll take a look at that tomorrow @elia. Can either of you inform me where subject.opal_stdlib is defined?

@parkr
Copy link
Member Author

parkr commented Nov 25, 2015

Can either of you inform me where subject.opal_stdlib is defined?

Where did you see that? I don't have the slightest idea. 😄

@Stargator
Copy link

@parkr it's in opal_generator_spec.rb in test "can build the opal stdlib".

@Stargator
Copy link

@elia for opal_stdlib in lib/jekyll/generators/opal.rb It is currently using ::Opal::Builder.build('opal').

This causes a failed test when comparing that to (Opal); as occurs in test "can build the opal stdlib" within opal_generator_spec.rb.

I'm not sure if the upgrade to 0.8.x will require a change on the lib side or the test side (or both). I'm looking into it. If anyone has suggestions let me know. 🐶

@parkr
Copy link
Member Author

parkr commented Nov 25, 2015

This causes a failed test when comparing that to (Opal); as occurs in test "can build the opal stdlib" within opal_generator_spec.rb.

If you do opal_stdlib.to_s, this solves itself. Not sure why that test is there though...

@Stargator
Copy link

@parkr Should I remove it? I think we can do that in another change

parkr added a commit that referenced this pull request Nov 25, 2015
@parkr parkr merged commit 7d36336 into master Nov 25, 2015
@parkr parkr deleted the widen-test-versions branch November 25, 2015 17:11
parkr added a commit that referenced this pull request Nov 25, 2015
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.

3 participants