Giter VIP home page Giter VIP logo

motion-yaml's People

Contributors

alyssais avatar watson1978 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

motion-yaml's Issues

'~' in inline array does not work

Hi, I got this:

(main)> YAML.load('months: [~, Jan, Feb]')
=> #<NSException:0x10b684f80>

while on pure-ruby it goes:

[1] pry(main)> YAML.load('months: [~, Jan, Feb]')
=> {"months"=>[nil, "Jan", "Feb"]}

My versions are:

% motion --version
4.4
% bundle show | grep motion-yaml
  * motion-yaml (1.5.5)

It was working fine on motion-yaml v1.4 and v1.5.
Thanks.

high sierra issue

Whenever I add motion-yaml to a project -- either rubymotion vanilla or generated by redpotion -- I get the following error:

/Library/RubyMotion/bin/gen_bridge_metadata:16:in `symlink': Permission denied @ rb_file_s_symlink - (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain, /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain) (Errno::EACCES)
	from /Library/RubyMotion/bin/gen_bridge_metadata:16:in `<main>'
rake aborted!
Command failed with status (1): [RUBYOPT='' '/Library/RubyMotion/bin/gen_br...]
/Library/RubyMotion/lib/motion/project/xcode_config.rb:476:in `gen_bridge_metadata'
/Library/RubyMotion/lib/motion/project/vendor.rb:242:in `generate_bridgesupport'
/Library/RubyMotion/lib/motion/project/vendor.rb:175:in `build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:48:in `block in build'
/Library/RubyMotion/lib/motion/project/vendor.rb:47:in `chdir'
/Library/RubyMotion/lib/motion/project/vendor.rb:47:in `build'
/Library/RubyMotion/lib/motion/project/builder.rb:68:in `block in build'
/Library/RubyMotion/lib/motion/project/builder.rb:67:in `each'
/Library/RubyMotion/lib/motion/project/builder.rb:67:in `build'
/Library/RubyMotion/lib/motion/project/app.rb:78:in `build'
/Users/grimm/.rvm/gems/ruby-2.4.0/gems/motion-cocoapods-1.9.0/lib/motion/project/cocoapods.rb:54:in `build_with_cocoapods'
/Library/RubyMotion/lib/motion/project/template/ios.rb:69:in `block (2 levels) in <top (required)>'
/Library/RubyMotion/lib/motion/project/template/ios.rb:179:in `block in <top (required)>'
/Users/grimm/.rvm/gems/ruby-2.4.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/Users/grimm/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/Users/grimm/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'

In the /Applications/Xcode.app/Contents/Developer/Toolchains/ there is only XcodeDefault.xctoolchain

Not sure if this is a High Sierra / Xcode 9.1 or Rubymotion 5.5 issue.

Strange argument error starting in 1.5.x

<Warning>: yaml.rb:28:in `load:': wrong number of arguments (-1685773368 for 0) (ArgumentError)
<Warning>: yaml.rb:28:in `load:': wrong number of arguments (-1685773368 for 0) (ArgumentError)
<Error>: *** Terminating app due to uncaught exception 'ArgumentError', reason: 'yaml.rb:28:in `load:': wrong number of arguments (-1685773368 for 0) (ArgumentError)

1.4 does not have this issue, and it only shows up on the device.

See here for context (starting with 2nd comment): infinitered/cdq#105

Tokenize method name collides with private API

Because of this method name, we are getting rejected from the app store, see below:

Thank you for your resubmission.

We still found that your app contains the following issue(s):

Performance - 2.5.1


Your app uses or references the following non-public APIs:

tokenize:

Can you please rename this method so it doesn't collide?

def tokenize(string)

`-[YKParser tokenize:]: unrecognized selector sent to instance` on device and in simulator but not in REPL

Using the latest motion-yaml I get the following crash on device as well as in the simulator but not in the REPL:

2015-08-15 12:04:07.017 Babbo-Voco[27049:403076] -[YKParser tokenize:]: unrecognized selector sent to instance 0x10f701210
2015-08-15 12:04:07.099 Babbo-Voco[27049:403076] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[YKParser tokenize:]: unrecognized selector sent to instance 0x10f701210'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000103f999b5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x00000001009cddeb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000103fa1fdd -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x0000000103eef9fa ___forwarding___ + 970
    4   CoreFoundation                      0x0000000103eef5a8 _CF_forwarding_prep_0 + 120
    5   MyApp                               0x000000010003c6d6 -[YKParser parseWithError:] + 672
    6   MyApp                               0x000000010003b97b +[YAMLKit loadFromString:] + 95
    7   MyApp                               0x0000000100079492 __unnamed_151 + 98
    8   MyApp                               0x00000001004852ce rb_vm_dispatch + 6270
    9   MyApp                               0x0000000100067cec vm_dispatch + 1436
    10  MyApp                               0x0000000100354523 rb_scope__load:__ + 211
    11  MyApp                               0x0000000100485739 rb_vm_dispatch + 7401
    12  MyApp                               0x0000000100067cec vm_dispatch + 1436
    13  MyApp                               0x0000000100355975 rb_scope__validation_scope:__ + 1685
    14  MyApp                               0x0000000100485739 rb_vm_dispatch + 7401
    15  MyApp                               0x0000000100067cec vm_dispatch + 1436
    16  MyApp                               0x000000010036b000 rb_scope3 + 320
    17  MyApp                               0x000000010036ae66 rb_scope2 + 134
    18  MyApp                               0x000000010036ad83 rb_scope1 + 131
    19  MyApp                               0x000000010036ddff MREP_E22E8774DEAA44868E02E624C561EEED + 3631
    20  MyApp                               0x000000010006fd10 RubyMotionInit + 2048
    21  MyApp                               0x000000010006fd85 main + 85
    22  libdyld.dylib                       0x0000000105ac692d start + 1
    23  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

================================================================================
The application terminated. A crash report file may have been generated by the
system, use `rake crashlog' to open it. Use `rake debug=1' to restart the app
in the debugger.
================================================================================

The code that produces this crash is as simple as:

class CrashTest
  def self.crash
    obj = YAML.load('foo: 42')
  end

  crash
end

It seems that the crash only happens when YAML.load is used inside a class method.
It's working fine when called inside an instance method or in the REPL (but not when calling the class method from an instance method).

The crash is reproducible on both iOS 8.4(.1) and and iOS 9 SDKs using RubyMotion 3.14 (stable).
My app is using iOS 7.1 as deployment target if that matters.

YAML anchors and aliases.

motion-yaml seems to choke on the use of anchors and aliases:

All of the following fail:

# Scalars
test_anchor_scalar: &scalar_test
test_alias_scalar: *scalar_test
# Maps
test_anchor_map: &map_test
  a: 1
  b: 2
test_alias_map: *map_test
# Sequences
test_anchor_sequence: &sequence_test
  - a
  - b
test_alias_sequence: *sequence_test
# Scalars inside a sequence
sequence_with_anchor_and_alias:
  - 'hello'
  - &test_inside_sequence 'test'
  - *test_inside_sequence
  - 'goodbye'

They fail on their own, and they fail when they are included with other yaml data. In some cases, they actually mangle the structure of the surrounding data (particularly the maps), while in other cases they just silently disappear.

I'm unsure whether this is a failure in motion-yaml or in the underlying YAMLKit. In the absence of a solution I am attempting to find a pure-ruby YAML implementation I can use.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Symbols in YAML (Ruby implementation)

In Ruby's implementation of YAML, keys beginning with a colon (:) are automatically interned as Symbols ( :key: value loads :key => value ). Using motion-yaml the use of :key: results in ":key" (String), i.e. :key: value loads ":key" => value. Even when using the standard !ruby/symbol (or !ruby/sym) transfer method to serialize symbols the resulting key is a string instead of a symbol.

"Yes" and "No" do not remain as strings

My app needs to be able to store the string "Yes" and the string "No" in yaml.. but when I pull them back out, they are replaced with true and false

>> YAML.load('yes'.to_yaml)
=> true

>> YAML.load(["No"].to_yaml)
=> [false]

>> YAML.load(["yeS"].to_yaml)
=> [true]

The same happens with "true" and "false".

I don't think this is the expected behavior?
It is not how the pure ruby yaml gem works.

rubymotion 2.21: No such file or directory - build-iPhoneSimulator/YAMLKit.bridgesupport

I'm getting this error trying to build my app in rubymotion 2.21. I've done the typical rake clean and gem uninstall/reinstall dance.

Build /Users/theship/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/motion-yaml-1.2/lib/YAMLKit
Received exception: No such file or directory - build-iPhoneSimulator/YAMLKit.bridgesupport:
/usr/bin/gen_bridge_metadata:1852:in `initialize'
/usr/bin/gen_bridge_metadata:1852:in `open'
/usr/bin/gen_bridge_metadata:1852:in `generate_xml'
/usr/bin/gen_bridge_metadata:817:in `write'
/Library/RubyMotion2.21/bin/gen_bridge_metadata:124:in `block in <main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:885:in `initialize'
/Library/RubyMotion2.21/bin/gen_bridge_metadata:32:in `new'
/Library/RubyMotion2.21/bin/gen_bridge_metadata:32:in `<main>'
No such file or directory - build-iPhoneSimulator/YAMLKit.bridgesupport
Usage: gen_bridge_metadata [options] <headers...>
Use the `-h' flag or consult gen_bridge_metadata(1) for help.
rake aborted!
Command failed with status (1): [RUBYOPT='' '/Library/RubyMotion2.21/bin/ge...]
/Library/RubyMotion2.21/lib/motion/project/xcode_config.rb:349:in `gen_bridge_metadata'
/Library/RubyMotion2.21/lib/motion/project/vendor.rb:138:in `block in build_static'
/Library/RubyMotion2.21/lib/motion/project/vendor.rb:65:in `chdir'
/Library/RubyMotion2.21/lib/motion/project/vendor.rb:65:in `build_static'
/Library/RubyMotion2.21/lib/motion/project/vendor.rb:42:in `build'
/Library/RubyMotion2.21/lib/motion/project/builder.rb:65:in `block in build'
/Library/RubyMotion2.21/lib/motion/project/builder.rb:64:in `each'
/Library/RubyMotion2.21/lib/motion/project/builder.rb:64:in `build'
/Library/RubyMotion2.21/lib/motion/project/app.rb:76:in `build'
/Library/RubyMotion2.21/lib/motion/project/template/ios.rb:46:in `block (2 levels) in <top (required)>'
/Library/RubyMotion2.21/lib/motion/project/template/ios.rb:63:in `block in <top (required)>'
/Library/RubyMotion2.21/lib/motion/project/template/ios.rb:140:in `block (2 levels) in <top (required)>'

Let me know if you need more info.

Cuts off the last character when loading YAML

In Rubymotion, this is cutting off the last character off the YAML file.

If it's not a \n then the YAML breaks and it returns nil

Example:

---
mylist:
  - one
  - two

This would return {"mylist"=>["one", "tw"]}.

---
mylist:
  - "one"
  - "two"

This would return nil - a serious bug.

This doesn't happen using the YAML gem in MRI.

YAML structures

YAML structures aren't working in motion-yaml.

Here's a quick example showing the differences I see between the default Ruby 2.0 parser and the motion-yaml parser:

# Ruby 2.0 YAML parser
require 'yaml'
YAML.load('--- "abc" ...')
=> "abc"

# motion-yaml
YAML.load('--- "abc" ...')
=> []

Building in Framework

Adding gem 'motion-yaml' to the Gemfile of a Framework doesn't appear to build it into the framework. Calling YAML or YAMLKit in the REPL just returns this:

(main)> YAMLKit
2014-12-19 21:23:54.967 YAMLFramework[2180:13399] uninitialized constant YAMLKit (NameError)
=> #<NameError: uninitialized constant YAMLKit>
(main)> YAML
2014-12-19 21:24:27.470 YAMLFramework[2180:13399] uninitialized constant YAML (NameError)
=> #<NameError: uninitialized constant YAML>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.