{"id":21478511,"url":"https://github.com/kayhide/motion_blender","last_synced_at":"2025-07-15T11:31:09.949Z","repository":{"id":56884564,"uuid":"42657114","full_name":"kayhide/motion_blender","owner":"kayhide","description":"RubyMotion gem for `require`-ing compatible-ruby codes.","archived":false,"fork":false,"pushed_at":"2016-06-30T14:49:25.000Z","size":121,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-31T14:25:57.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kayhide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-17T13:16:16.000Z","updated_at":"2016-11-21T12:59:07.000Z","dependencies_parsed_at":"2022-08-20T13:10:56.782Z","dependency_job_id":null,"html_url":"https://github.com/kayhide/motion_blender","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayhide%2Fmotion_blender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayhide%2Fmotion_blender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayhide%2Fmotion_blender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayhide%2Fmotion_blender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kayhide","download_url":"https://codeload.github.com/kayhide/motion_blender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226033862,"owners_count":17563249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T11:18:40.149Z","updated_at":"2024-11-23T11:18:40.803Z","avatar_url":"https://github.com/kayhide.png","language":"Ruby","readme":"# MotionBlender [![Build Status](https://travis-ci.org/kayhide/motion_blender.svg?branch=master)](https://travis-ci.org/kayhide/motion_blender)\n\nMotionBlender enables to:\n\n- require *Ruby* files (must be RubyMotion-compatible) from RubyMotion files\n- require RubyMotion files from RubyMotion files as well\n\nand then:\n\n- add required files to `app.files`\n- resolve dependencies following require tree and put it to `app.files_dependencies`\n\nThis is a sccessor of [motion-require](https://github.com/clayallsopp/motion-require) and [MotionBundler](https://github.com/archan937/motion-bundler).\n\n*motion-require* is to resolve dependencies between RubyMotion files with `motion_require` method.\nThis is only for RubyMotion files and not for using Ruby gems.\n\n*MotionBundler* aims for using Ruby gems from RubyMotion.\nThis is good for making an application but not for making a gem, because it requires to setup your application Gemfile explicitly.\n\n\nSo, MotionBlender is good for making RubyMotion-compatible gem which depends on other RubyMotion-compatible gems.\n\nI made a fork of MotionSupport which is based on MotionBlender:\n\n- [motion_blender-support](https://github.com/kayhide/motion_blender-support)\n\nThis is ready to use to make RubyMotion-compatible gems.\n\n## Installation\n\n### When making a gem\n\nAdd a dependency:\n\n```ruby\n# in .gemspec file\n\nGem::Specification.new do |spec|\n  # ...\n  spec.add_runtime_dependency \"motion_blender\"\n  # ...\nend\n```\n\n### When making an application\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'motion_blender'\n```\n\n## Usage\n\nAdd RubyMotion-compatible gem into your project (may be an application or a gem).\n\nAnd just call `require` from anywhare:\n\n```ruby\nrequire 'rubymotion_compatible_gem'\n\n# your code goes on...\n```\n\nWriting a gem (*motion_hoge*), this idiom is handy:\n\n```ruby\n# in lib/motion_hoge.rb\nrequire 'motion_blender'\nMotionBlender.incept\n\nrequire 'motion_hoge/version'\nrequire 'motion_hoge/simsim'\nrequire 'motion_hoge/mishmish'\n# ...\n```\n\n`MotionBlender.incept` adds this file to RubyMotion's `app.files` and targets for analyzing.\nTo require this *motion_hoge* makes an application or a gem to load functionalities properly.\n\n`motion_blender` itself is excepted for analyzing,\nso don't worry to require `motion_blender` in *incept*-ed files.\n\n### Parsing\n\nIt parses `require` statements properly in almost all the common cases.\n\nArgument can be a string or an eval-able expression:\n\n```ruby\n# Good\nrequire 'something'\nrequire File.join('path', 'to', 'feature')\nrequire File.expand_path('../otherthing', __FILE__) # __FILE__ works properly\n```\n\nWrapped in outer loop, works fine:\n\n```ruby\n# Good\nDir.glob('lib/**/*.rb').each { |path| require path }\nDir[File.dirname(__FILE__) + '/lib/*.rb'].each { |file| require file }\n```\n\nTakes care of rescue clause:\n\n```ruby\n# Good\nbegin\n  require 'may_not_exist'\nrescue LoadError\n  require 'alternative'\nend\n```\n\n## How does it work?\n\nIn the RubyMotion application's Rakefile, `motion_blender` is to be required, typically via `Bundler.require`.\nThen it hooks `build` tasks.\nYou can hit `rake -P` and see `motion_blender:apply` task is hooked.\n\nIn apply task, MotionBlender runs analyzer on all `Motion::Project::Config#files`.\nIt uses [parser](https://github.com/whitequark/parser) and follows all `require` and `require_relative`.\nAfter that, add the newly encountered files to the head of `Motion::Project::Config#files` and put file dependencies to `Motion::Project::Config#dependencies`.\n\nWhen compiling, `require` and `require_relative` is overwritten as noop.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/kayhide/motion_blender. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayhide%2Fmotion_blender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayhide%2Fmotion_blender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayhide%2Fmotion_blender/lists"}