engineyard-serverside 2.8.0.pre → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/engineyard-serverside-execute-service-hook +1 -1
- data/features/hook/running-a-deploy-hook.feature +277 -0
- data/features/hook/step_definitions/running-a-deploy-hook-steps.rb +200 -0
- data/features/step_definitions/command_steps.rb +8 -0
- data/features/step_definitions/version_steps.rb +5 -0
- data/features/support/env.rb +63 -0
- data/features/support/error_codes.rb +17 -0
- data/features/support/fs_helpers.rb +82 -0
- data/features/support/output_helpers.rb +7 -0
- data/features/support/runner.rb +41 -0
- data/features/version.feature +7 -0
- data/lib/engineyard-serverside.rb +2 -5
- data/lib/engineyard-serverside/callbacks/collection/base.rb +12 -5
- data/lib/engineyard-serverside/callbacks/distributor.rb +2 -7
- data/lib/engineyard-serverside/callbacks/executor/executable.rb +2 -0
- data/lib/engineyard-serverside/cli/app.rb +6 -0
- data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +1 -2
- data/lib/engineyard-serverside/configuration.rb +3 -3
- data/lib/engineyard-serverside/deploy.rb +4 -8
- data/lib/engineyard-serverside/shell.rb +38 -10
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/engineyard-serverside/callbacks/collection/combined_spec.rb +232 -0
- data/spec/engineyard-serverside/callbacks/collection/deploy_hooks_spec.rb +170 -0
- data/spec/engineyard-serverside/callbacks/collection/service_hooks/collection_spec.rb +171 -0
- data/spec/engineyard-serverside/callbacks/collection/service_hooks/combined_spec.rb +174 -0
- data/spec/engineyard-serverside/callbacks/collection/service_hooks_spec.rb +31 -0
- data/spec/engineyard-serverside/callbacks/collection_spec.rb +49 -0
- data/spec/engineyard-serverside/callbacks/distributor/remote_spec.rb +135 -0
- data/spec/engineyard-serverside/callbacks/distributor/viability_filter_spec.rb +208 -0
- data/spec/engineyard-serverside/callbacks/distributor_spec.rb +43 -0
- data/spec/engineyard-serverside/callbacks/executor/executable_spec.rb +386 -0
- data/spec/engineyard-serverside/callbacks/executor/ruby/context_spec.rb +538 -0
- data/spec/engineyard-serverside/callbacks/executor/ruby/executor_spec.rb +313 -0
- data/spec/engineyard-serverside/callbacks/executor/ruby_spec.rb +35 -0
- data/spec/engineyard-serverside/callbacks/executor_spec.rb +45 -0
- data/spec/engineyard-serverside/callbacks_spec.rb +31 -0
- data/spec/engineyard-serverside/cli/workflows/base_spec.rb +237 -0
- data/spec/engineyard-serverside/cli/workflows/calling_deploy_hooks_spec.rb +65 -0
- data/spec/engineyard-serverside/cli/workflows/deploying_applications_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/disabling_maintenance_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/enabling_maintenance_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/helpers_spec.rb +64 -0
- data/spec/engineyard-serverside/cli/workflows/rolling_back_applications_spec.rb +61 -0
- data/spec/engineyard-serverside/cli/workflows/showing_maintenance_status_spec.rb +60 -0
- data/spec/engineyard-serverside/cli/workflows_spec.rb +87 -0
- data/spec/engineyard-serverside/dependency_manager/base_spec.rb +139 -0
- data/spec/engineyard-serverside/paths_spec.rb +820 -0
- data/spec/engineyard-serverside/propagator_spec.rb +56 -0
- data/spec/engineyard-serverside/server_spec.rb +390 -0
- data/spec/engineyard-serverside/shell/helpers_spec.rb +98 -0
- data/spec/engineyard-serverside/shell/yieldio_spec.rb +33 -0
- data/spec/engineyard-serverside/shell_spec.rb +543 -0
- data/spec/engineyard-serverside/slug/distributor_spec.rb +199 -0
- data/spec/engineyard-serverside/slug/enabler_spec.rb +191 -0
- data/spec/engineyard-serverside/slug/failure_handler_spec.rb +114 -0
- data/spec/engineyard-serverside/slug/finalizer_spec.rb +191 -0
- data/spec/engineyard-serverside/slug/generator_spec.rb +82 -0
- data/spec/engineyard-serverside/slug/migrator_spec.rb +137 -0
- data/spec/engineyard-serverside/slug/restarter_spec.rb +226 -0
- data/spec/engineyard-serverside/slug/source/updater_spec.rb +710 -0
- data/spec/engineyard-serverside/slug/source_spec.rb +40 -0
- data/spec/engineyard-serverside/source_spec.rb +171 -0
- data/spec/railway_spec.rb +130 -0
- data/spec/result/failure_spec.rb +113 -0
- data/spec/result/success_spec.rb +109 -0
- data/spec/result_spec.rb +23 -0
- data/spec/spec_helper.rb +3 -349
- metadata +327 -602
- data/lib/vendor/json_pure/COPYING +0 -57
- data/lib/vendor/json_pure/GPL +0 -340
- data/lib/vendor/json_pure/README.rdoc +0 -358
- data/lib/vendor/json_pure/VERSION +0 -1
- data/lib/vendor/json_pure/lib/json.rb +0 -62
- data/lib/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
- data/lib/vendor/json_pure/lib/json/add/complex.rb +0 -22
- data/lib/vendor/json_pure/lib/json/add/core.rb +0 -11
- data/lib/vendor/json_pure/lib/json/add/date.rb +0 -34
- data/lib/vendor/json_pure/lib/json/add/date_time.rb +0 -48
- data/lib/vendor/json_pure/lib/json/add/exception.rb +0 -31
- data/lib/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
- data/lib/vendor/json_pure/lib/json/add/range.rb +0 -29
- data/lib/vendor/json_pure/lib/json/add/rational.rb +0 -22
- data/lib/vendor/json_pure/lib/json/add/regexp.rb +0 -30
- data/lib/vendor/json_pure/lib/json/add/struct.rb +0 -30
- data/lib/vendor/json_pure/lib/json/add/symbol.rb +0 -25
- data/lib/vendor/json_pure/lib/json/add/time.rb +0 -38
- data/lib/vendor/json_pure/lib/json/common.rb +0 -484
- data/lib/vendor/json_pure/lib/json/ext.rb +0 -21
- data/lib/vendor/json_pure/lib/json/generic_object.rb +0 -70
- data/lib/vendor/json_pure/lib/json/pure.rb +0 -21
- data/lib/vendor/json_pure/lib/json/pure/generator.rb +0 -522
- data/lib/vendor/json_pure/lib/json/pure/parser.rb +0 -359
- data/lib/vendor/json_pure/lib/json/version.rb +0 -8
- data/lib/vendor/multi_json/CHANGELOG.md +0 -121
- data/lib/vendor/multi_json/CONTRIBUTING.md +0 -46
- data/lib/vendor/multi_json/Gemfile +0 -31
- data/lib/vendor/multi_json/LICENSE.md +0 -20
- data/lib/vendor/multi_json/README.md +0 -105
- data/lib/vendor/multi_json/Rakefile +0 -12
- data/lib/vendor/multi_json/lib/multi_json.rb +0 -137
- data/lib/vendor/multi_json/lib/multi_json/adapters/gson.rb +0 -20
- data/lib/vendor/multi_json/lib/multi_json/adapters/json_common.rb +0 -35
- data/lib/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +0 -12
- data/lib/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +0 -12
- data/lib/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +0 -35
- data/lib/vendor/multi_json/lib/multi_json/adapters/oj.rb +0 -29
- data/lib/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +0 -58
- data/lib/vendor/multi_json/lib/multi_json/adapters/yajl.rb +0 -20
- data/lib/vendor/multi_json/lib/multi_json/vendor/okjson.rb +0 -602
- data/lib/vendor/multi_json/lib/multi_json/version.rb +0 -3
- data/lib/vendor/multi_json/spec/adapter_shared_example.rb +0 -162
- data/lib/vendor/multi_json/spec/helper.rb +0 -45
- data/lib/vendor/multi_json/spec/json_common_shared_example.rb +0 -36
- data/lib/vendor/multi_json/spec/multi_json_spec.rb +0 -151
- data/spec/archive_deploy_spec.rb +0 -53
- data/spec/basic_deploy_spec.rb +0 -26
- data/spec/bundler_deploy_spec.rb +0 -160
- data/spec/configuration_spec.rb +0 -206
- data/spec/custom_deploy_spec.rb +0 -128
- data/spec/deploy_hook_spec.rb +0 -378
- data/spec/deprecation_spec.rb +0 -23
- data/spec/ey_yml_customized_deploy_spec.rb +0 -99
- data/spec/fixtures/gitrepo.tar.gz +0 -0
- data/spec/fixtures/invalid_hook.rb +0 -1
- data/spec/fixtures/lockfiles/0.9-no-bundler +0 -111
- data/spec/fixtures/lockfiles/0.9-with-bundler +0 -117
- data/spec/fixtures/lockfiles/1.0-no-bundler +0 -54
- data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +0 -162
- data/spec/fixtures/lockfiles/1.0.18-do_mysql +0 -88
- data/spec/fixtures/lockfiles/1.0.18-do_postgres +0 -79
- data/spec/fixtures/lockfiles/1.0.18-mysql +0 -43
- data/spec/fixtures/lockfiles/1.0.18-mysql2 +0 -43
- data/spec/fixtures/lockfiles/1.0.18-pg +0 -43
- data/spec/fixtures/lockfiles/1.0.6-no-bundler +0 -51
- data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +0 -52
- data/spec/fixtures/lockfiles/1.0.6-with-bundler +0 -52
- data/spec/fixtures/lockfiles/1.15.1-no-bundler +0 -51
- data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +0 -112
- data/spec/fixtures/lockfiles/not-a-lockfile +0 -1
- data/spec/fixtures/repos/assets_detected/Gemfile +0 -5
- data/spec/fixtures/repos/assets_detected/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_detected/README +0 -1
- data/spec/fixtures/repos/assets_detected/Rakefile +0 -5
- data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_detected/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_detected/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_disabled/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled/README +0 -1
- data/spec/fixtures/repos/assets_disabled/Rakefile +0 -6
- data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_disabled/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +0 -1
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +0 -6
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled_utf8/README +0 -3
- data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +0 -7
- data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_enabled_all/Gemfile +0 -5
- data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_enabled_all/README +0 -1
- data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_all/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +0 -6
- data/spec/fixtures/repos/assets_enabled_all/script/assets +0 -5
- data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +0 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +0 -3
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +0 -10
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +0 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +0 -8
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +0 -4
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +0 -5
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_enabled_util_only/README +0 -1
- data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +0 -6
- data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +0 -6
- data/spec/fixtures/repos/assets_error/Gemfile +0 -5
- data/spec/fixtures/repos/assets_error/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_error/README +0 -1
- data/spec/fixtures/repos/assets_error/Rakefile +0 -4
- data/spec/fixtures/repos/assets_error/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_error/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_error/config/ey.yml +0 -4
- data/spec/fixtures/repos/assets_in_hook/Gemfile +0 -5
- data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_in_hook/README +0 -2
- data/spec/fixtures/repos/assets_in_hook/Rakefile +0 -5
- data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_in_hook/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_in_hook/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +0 -2
- data/spec/fixtures/repos/bundle_fails/Gemfile +0 -1
- data/spec/fixtures/repos/bundle_fails/README +0 -1
- data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_disabled/Gemfile +0 -4
- data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +0 -12
- data/spec/fixtures/repos/bundler_disabled/README +0 -1
- data/spec/fixtures/repos/bundler_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_old/Gemfile +0 -5
- data/spec/fixtures/repos/bundler_old/Gemfile.lock +0 -15
- data/spec/fixtures/repos/bundler_old/README +0 -1
- data/spec/fixtures/repos/default/Gemfile +0 -4
- data/spec/fixtures/repos/default/Gemfile.lock +0 -12
- data/spec/fixtures/repos/default/README +0 -5
- data/spec/fixtures/repos/default/ey.yml +0 -3
- data/spec/fixtures/repos/executable_hooks/README +0 -1
- data/spec/fixtures/repos/executable_hooks/deploy/before_restart +0 -72
- data/spec/fixtures/repos/executable_hooks_not_executable/README +0 -3
- data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +0 -3
- data/spec/fixtures/repos/ey_yml/Gemfile +0 -4
- data/spec/fixtures/repos/ey_yml/Gemfile.lock +0 -12
- data/spec/fixtures/repos/ey_yml/README +0 -1
- data/spec/fixtures/repos/ey_yml/config/ey.yml +0 -18
- data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +0 -6
- data/spec/fixtures/repos/ey_yml_alt/Gemfile +0 -4
- data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +0 -12
- data/spec/fixtures/repos/ey_yml_alt/README +0 -1
- data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +0 -6
- data/spec/fixtures/repos/ey_yml_alt/ey.yml +0 -12
- data/spec/fixtures/repos/hook_fails/README +0 -1
- data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/README +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_restart.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_restart.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +0 -1
- data/spec/fixtures/repos/multi_dep_manager/README +0 -1
- data/spec/fixtures/repos/multi_dep_manager/composer.json +0 -5
- data/spec/fixtures/repos/multi_dep_manager/composer.lock +0 -462
- data/spec/fixtures/repos/multi_dep_manager/package.json +0 -7
- data/spec/fixtures/repos/multi_dep_manager/public/index.php +0 -4
- data/spec/fixtures/repos/no_ey_config/Gemfile +0 -3
- data/spec/fixtures/repos/no_ey_config/Gemfile.lock +0 -10
- data/spec/fixtures/repos/no_ey_config/README +0 -1
- data/spec/fixtures/repos/no_ey_config/ey.yml +0 -3
- data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile +0 -3
- data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile.lock +0 -10
- data/spec/fixtures/repos/no_ey_config_no_warning/README +0 -1
- data/spec/fixtures/repos/no_ey_config_no_warning/ey.yml +0 -5
- data/spec/fixtures/repos/no_gemfile_lock/Gemfile +0 -4
- data/spec/fixtures/repos/no_gemfile_lock/README +0 -1
- data/spec/fixtures/repos/no_gemfile_lock/ey.yml +0 -3
- data/spec/fixtures/repos/nodejs/README +0 -1
- data/spec/fixtures/repos/nodejs/package.json +0 -7
- data/spec/fixtures/repos/not_bundled/README +0 -1
- data/spec/fixtures/repos/npm_disabled/README +0 -1
- data/spec/fixtures/repos/npm_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/npm_disabled/package.json +0 -7
- data/spec/fixtures/repos/php_composer_disabled/README +0 -1
- data/spec/fixtures/repos/php_composer_disabled/composer.json +0 -5
- data/spec/fixtures/repos/php_composer_disabled/composer.lock +0 -462
- data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/php_composer_disabled/public/index.php +0 -4
- data/spec/fixtures/repos/php_composer_lock/README +0 -1
- data/spec/fixtures/repos/php_composer_lock/composer.json +0 -5
- data/spec/fixtures/repos/php_composer_lock/composer.lock +0 -462
- data/spec/fixtures/repos/php_composer_lock/public/index.php +0 -4
- data/spec/fixtures/repos/php_no_composer_lock/README +0 -1
- data/spec/fixtures/repos/php_no_composer_lock/composer.json +0 -21
- data/spec/fixtures/repos/php_no_composer_lock/public/index.php +0 -4
- data/spec/fixtures/repos/public_system/Gemfile +0 -4
- data/spec/fixtures/repos/public_system/Gemfile.lock +0 -12
- data/spec/fixtures/repos/public_system/README +0 -5
- data/spec/fixtures/repos/public_system/ey.yml +0 -3
- data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +0 -3
- data/spec/fixtures/repos/sqlite3/Gemfile +0 -4
- data/spec/fixtures/repos/sqlite3/Gemfile.lock +0 -89
- data/spec/fixtures/repos/sqlite3/README +0 -1
- data/spec/fixtures/retwisj.war +0 -0
- data/spec/fixtures/valid_hook.rb +0 -1
- data/spec/git_strategy_spec.rb +0 -34
- data/spec/lockfile_parser_spec.rb +0 -126
- data/spec/maintenance_spec.rb +0 -44
- data/spec/multi_dependency_manager_spec.rb +0 -25
- data/spec/nodejs_deploy_spec.rb +0 -30
- data/spec/php_deploy_spec.rb +0 -81
- data/spec/platform_configure_spec.rb +0 -61
- data/spec/rails31_deploy_spec.rb +0 -172
- data/spec/restart_spec.rb +0 -43
- data/spec/rollback_spec.rb +0 -87
- data/spec/server_spec.rb +0 -70
- data/spec/services_deploy_spec.rb +0 -165
- data/spec/shell_spec.rb +0 -57
- data/spec/source/archive_spec.rb +0 -33
- data/spec/source/git_spec.rb +0 -44
- data/spec/sqlite3_deploy_spec.rb +0 -38
- data/spec/support/integration.rb +0 -103
- data/spec/support/source_doubles.rb +0 -28
- data/spec/support/timecop.rb +0 -5
- data/spec/symlink_spec.rb +0 -15
@@ -1,46 +0,0 @@
|
|
1
|
-
## Contributing
|
2
|
-
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
3
|
-
improve this project.
|
4
|
-
|
5
|
-
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
6
|
-
|
7
|
-
Here are some ways *you* can contribute:
|
8
|
-
|
9
|
-
* by using alpha, beta, and prerelease versions
|
10
|
-
* by reporting bugs
|
11
|
-
* by suggesting new features
|
12
|
-
* by writing or editing documentation
|
13
|
-
* by writing specifications
|
14
|
-
* by writing code (**no patch is too small**: fix typos, add comments, clean up
|
15
|
-
inconsistent whitespace)
|
16
|
-
* by refactoring code
|
17
|
-
* by closing [issues][]
|
18
|
-
* by reviewing patches
|
19
|
-
|
20
|
-
[issues]: https://github.com/intridea/multi_json/issues
|
21
|
-
|
22
|
-
## Submitting an Issue
|
23
|
-
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
24
|
-
submitting a bug report or feature request, check to make sure it hasn't
|
25
|
-
already been submitted. When submitting a bug report, please include a [Gist][]
|
26
|
-
that includes a stack trace and any details that may be necessary to reproduce
|
27
|
-
the bug, including your gem version, Ruby version, and operating system.
|
28
|
-
Ideally, a bug report should include a pull request with failing specs.
|
29
|
-
|
30
|
-
[gist]: https://gist.github.com/
|
31
|
-
|
32
|
-
## Submitting a Pull Request
|
33
|
-
1. [Fork the repository.][fork]
|
34
|
-
2. [Create a topic branch.][branch]
|
35
|
-
3. Add specs for your unimplemented feature or bug fix.
|
36
|
-
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
37
|
-
5. Implement your feature or bug fix.
|
38
|
-
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
|
39
|
-
7. Run `open coverage/index.html`. If your changes are not completely covered
|
40
|
-
by your tests, return to step 3.
|
41
|
-
8. Add, commit, and push your changes.
|
42
|
-
9. [Submit a pull request.][pr]
|
43
|
-
|
44
|
-
[fork]: http://help.github.com/fork-a-repo/
|
45
|
-
[branch]: http://learn.github.com/p/branching.html
|
46
|
-
[pr]: http://help.github.com/send-pull-requests/
|
@@ -1,31 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rake', '>= 0.9'
|
4
|
-
gem 'yard', '>= 0.8'
|
5
|
-
|
6
|
-
platforms :ruby_18 do
|
7
|
-
gem 'json', '~> 1.4', :require => nil
|
8
|
-
end
|
9
|
-
|
10
|
-
gem 'json_pure', '~> 1.4', :require => nil
|
11
|
-
|
12
|
-
platforms :ruby, :mswin, :mingw do
|
13
|
-
gem 'oj', '~> 2.0', :require => nil
|
14
|
-
gem 'yajl-ruby', '~> 1.0', :require => nil
|
15
|
-
end
|
16
|
-
platforms :jruby do
|
17
|
-
gem 'gson', '>= 0.6', :require => nil
|
18
|
-
end
|
19
|
-
|
20
|
-
group :development do
|
21
|
-
gem 'kramdown', '>= 0.14'
|
22
|
-
gem 'pry'
|
23
|
-
gem 'pry-debugger', :platforms => :mri_19
|
24
|
-
end
|
25
|
-
|
26
|
-
group :test do
|
27
|
-
gem 'rspec', '>= 2.11'
|
28
|
-
gem 'simplecov', :require => false
|
29
|
-
end
|
30
|
-
|
31
|
-
gemspec
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2010-2013 Michael Bleigh, Josh Kalderimis, Erik Michaels-Ober, Pavel Pravosud
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,105 +0,0 @@
|
|
1
|
-
# MultiJSON
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/multi_json.png)][gem]
|
3
|
-
[![Build Status](https://secure.travis-ci.org/intridea/multi_json.png?branch=master)][travis]
|
4
|
-
[![Dependency Status](https://gemnasium.com/intridea/multi_json.png?travis)][gemnasium]
|
5
|
-
[![Code Climate](https://codeclimate.com/github/intridea/multi_json.png)][codeclimate]
|
6
|
-
|
7
|
-
[gem]: https://rubygems.org/gems/multi_json
|
8
|
-
[travis]: http://travis-ci.org/intridea/multi_json
|
9
|
-
[gemnasium]: https://gemnasium.com/intridea/multi_json
|
10
|
-
[codeclimate]: https://codeclimate.com/github/intridea/multi_json
|
11
|
-
|
12
|
-
Lots of Ruby libraries parse JSON and everyone has their favorite JSON coder.
|
13
|
-
Instead of choosing a single JSON coder and forcing users of your library to be
|
14
|
-
stuck with it, you can use MultiJSON instead, which will simply choose the
|
15
|
-
fastest available JSON coder. Here's how to use it:
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
require 'multi_json'
|
19
|
-
|
20
|
-
MultiJson.load('{"abc":"def"}') #=> {"abc" => "def"}
|
21
|
-
MultiJson.load('{"abc":"def"}', :symbolize_keys => true) #=> {:abc => "def"}
|
22
|
-
MultiJson.dump({:abc => 'def'}) # convert Ruby back to JSON
|
23
|
-
MultiJson.dump({:abc => 'def'}, :pretty => true) # encoded in a pretty form (if supported by the coder)
|
24
|
-
```
|
25
|
-
|
26
|
-
When loading invalid JSON, multiJSON will throw a `MultiJson::LoadError`. `MultiJson::DecodeError` is an alias for backwards compatibility.
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
MultiJson.load('invalid json') #=> MultiJson::LoadError
|
30
|
-
```
|
31
|
-
|
32
|
-
The `use` method, which sets the MultiJson adapter, takes either a symbol or a
|
33
|
-
class (to allow for custom JSON parsers) that responds to both `.load` and `.dump`
|
34
|
-
at the class level.
|
35
|
-
|
36
|
-
MultiJSON tries to have intelligent defaulting. That is, if you have any of the
|
37
|
-
supported engines already loaded, it will utilize them before attempting to
|
38
|
-
load any. When loading, libraries are ordered by speed. First Oj, then Yajl,
|
39
|
-
then the JSON gem, then JSON pure. If no other JSON library is available,
|
40
|
-
MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
|
41
|
-
|
42
|
-
[okjson]: https://github.com/kr/okjson
|
43
|
-
|
44
|
-
## Supported JSON Engines
|
45
|
-
|
46
|
-
* [Oj](https://github.com/ohler55/oj) Optimized JSON by Peter Ohler
|
47
|
-
* [Yajl](https://github.com/brianmario/yajl-ruby) Yet Another JSON Library by Brian Lopez
|
48
|
-
* [JSON](https://github.com/flori/json) The default JSON gem with C-extensions (ships with Ruby 1.9)
|
49
|
-
* [JSON Pure](https://github.com/flori/json) A Ruby variant of the JSON gem
|
50
|
-
* [NSJSONSerialization](https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html) Wrapper for Apple's NSJSONSerialization in the Cocoa Framework (MacRuby only)
|
51
|
-
* [gson.rb](https://github.com/avsej/gson.rb) A Ruby wrapper for google-gson library (JRuby only)
|
52
|
-
* [OkJson][okjson] A simple, vendorable JSON parser
|
53
|
-
|
54
|
-
## Supported Ruby Versions
|
55
|
-
This library aims to support and is [tested against][travis] the following Ruby
|
56
|
-
implementations:
|
57
|
-
|
58
|
-
* Ruby 1.8.7
|
59
|
-
* Ruby 1.9.2
|
60
|
-
* Ruby 1.9.3
|
61
|
-
* Ruby 2.0.0
|
62
|
-
* [JRuby][]
|
63
|
-
* [Rubinius][]
|
64
|
-
* [MacRuby][] (not tested on Travis CI)
|
65
|
-
|
66
|
-
[jruby]: http://www.jruby.org/
|
67
|
-
[rubinius]: http://rubini.us/
|
68
|
-
[macruby]: http://www.macruby.org/
|
69
|
-
|
70
|
-
If something doesn't work on one of these interpreters, it's a bug.
|
71
|
-
|
72
|
-
This library may inadvertently work (or seem to work) on other Ruby
|
73
|
-
implementations, however support will only be provided for the versions listed
|
74
|
-
above.
|
75
|
-
|
76
|
-
If you would like this library to support another Ruby version, you may
|
77
|
-
volunteer to be a maintainer. Being a maintainer entails making sure all tests
|
78
|
-
run and pass on that implementation. When something breaks on your
|
79
|
-
implementation, you will be responsible for providing patches in a timely
|
80
|
-
fashion. If critical issues for a particular implementation exist at the time
|
81
|
-
of a major release, support for that Ruby version may be dropped.
|
82
|
-
|
83
|
-
## Versioning
|
84
|
-
|
85
|
-
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
|
86
|
-
of this scheme should be reported as bugs. Specifically, if a minor or patch
|
87
|
-
version is released that breaks backward compatibility, that version should be
|
88
|
-
immediately yanked and/or a new version should be immediately released that
|
89
|
-
restores compatibility. Breaking changes to the public API will only be
|
90
|
-
introduced with new major versions. As a result of this policy, you can (and
|
91
|
-
should) specify a dependency on this gem using the [Pessimistic Version
|
92
|
-
Constraint][pvc] with two digits of precision. For example:
|
93
|
-
|
94
|
-
```ruby
|
95
|
-
spec.add_dependency 'multi_json', '~> 1.0'
|
96
|
-
```
|
97
|
-
|
98
|
-
[semver]: http://semver.org/
|
99
|
-
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
|
100
|
-
|
101
|
-
## Copyright
|
102
|
-
Copyright (c) 2010-2013 Michael Bleigh, Josh Kalderimis, Erik Michaels-Ober,
|
103
|
-
and Pavel Pravosud. See [LICENSE][] for details.
|
104
|
-
|
105
|
-
[license]: LICENSE.md
|
@@ -1,137 +0,0 @@
|
|
1
|
-
module MultiJson
|
2
|
-
extend self
|
3
|
-
|
4
|
-
class LoadError < StandardError
|
5
|
-
attr_reader :data
|
6
|
-
def initialize(message='', backtrace=[], data='')
|
7
|
-
super(message)
|
8
|
-
self.set_backtrace(backtrace)
|
9
|
-
@data = data
|
10
|
-
end
|
11
|
-
end
|
12
|
-
DecodeError = LoadError # Legacy support
|
13
|
-
|
14
|
-
|
15
|
-
@default_options = {}
|
16
|
-
attr_accessor :default_options
|
17
|
-
|
18
|
-
REQUIREMENT_MAP = [
|
19
|
-
['oj', :oj],
|
20
|
-
['yajl', :yajl],
|
21
|
-
['json', :json_gem],
|
22
|
-
['gson', :gson],
|
23
|
-
['json/pure', :json_pure]
|
24
|
-
]
|
25
|
-
|
26
|
-
# The default adapter based on what you currently
|
27
|
-
# have loaded and installed. First checks to see
|
28
|
-
# if any adapters are already loaded, then checks
|
29
|
-
# to see which are installed if none are loaded.
|
30
|
-
def default_adapter
|
31
|
-
return :oj if defined?(::Oj)
|
32
|
-
return :yajl if defined?(::Yajl)
|
33
|
-
return :json_gem if defined?(::JSON)
|
34
|
-
return :gson if defined?(::Gson)
|
35
|
-
|
36
|
-
REQUIREMENT_MAP.each do |(library, adapter)|
|
37
|
-
begin
|
38
|
-
require library
|
39
|
-
return adapter
|
40
|
-
rescue ::LoadError
|
41
|
-
next
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
Kernel.warn '[WARNING] MultiJson is using the default adapter (ok_json). We recommend loading a different JSON library to improve performance.'
|
46
|
-
:ok_json
|
47
|
-
end
|
48
|
-
# :nodoc:
|
49
|
-
alias :default_engine :default_adapter
|
50
|
-
|
51
|
-
# Get the current adapter class.
|
52
|
-
def adapter
|
53
|
-
return @adapter if defined?(@adapter) && @adapter
|
54
|
-
|
55
|
-
self.use nil # load default adapter
|
56
|
-
|
57
|
-
@adapter
|
58
|
-
end
|
59
|
-
# :nodoc:
|
60
|
-
alias :engine :adapter
|
61
|
-
|
62
|
-
# Set the JSON parser utilizing a symbol, string, or class.
|
63
|
-
# Supported by default are:
|
64
|
-
#
|
65
|
-
# * <tt>:oj</tt>
|
66
|
-
# * <tt>:json_gem</tt>
|
67
|
-
# * <tt>:json_pure</tt>
|
68
|
-
# * <tt>:ok_json</tt>
|
69
|
-
# * <tt>:yajl</tt>
|
70
|
-
# * <tt>:nsjsonserialization</tt> (MacRuby only)
|
71
|
-
# * <tt>:gson</tt> (JRuby only)
|
72
|
-
def use(new_adapter)
|
73
|
-
@adapter = load_adapter(new_adapter)
|
74
|
-
end
|
75
|
-
alias :adapter= :use
|
76
|
-
# :nodoc:
|
77
|
-
alias :engine= :use
|
78
|
-
|
79
|
-
def load_adapter(new_adapter)
|
80
|
-
case new_adapter
|
81
|
-
when String, Symbol
|
82
|
-
require "multi_json/adapters/#{new_adapter}"
|
83
|
-
MultiJson::Adapters.const_get(:"#{new_adapter.to_s.split('_').map{|s| s.capitalize}.join('')}")
|
84
|
-
when NilClass, FalseClass
|
85
|
-
load_adapter default_adapter
|
86
|
-
when Class, Module
|
87
|
-
new_adapter
|
88
|
-
else
|
89
|
-
raise "Did not recognize your adapter specification. Please specify either a symbol or a class."
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
# Decode a JSON string into Ruby.
|
94
|
-
#
|
95
|
-
# <b>Options</b>
|
96
|
-
#
|
97
|
-
# <tt>:symbolize_keys</tt> :: If true, will use symbols instead of strings for the keys.
|
98
|
-
# <tt>:adapter</tt> :: If set, the selected engine will be used just for the call.
|
99
|
-
def load(string, options={})
|
100
|
-
adapter = current_adapter(options)
|
101
|
-
begin
|
102
|
-
adapter.load(string, options)
|
103
|
-
rescue adapter::ParseError => exception
|
104
|
-
raise LoadError.new(exception.message, exception.backtrace, string)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
# :nodoc:
|
108
|
-
alias :decode :load
|
109
|
-
|
110
|
-
def current_adapter(options)
|
111
|
-
if new_adapter = (options || {}).delete(:adapter)
|
112
|
-
load_adapter(new_adapter)
|
113
|
-
else
|
114
|
-
adapter
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
# Encodes a Ruby object as JSON.
|
119
|
-
def dump(object, options={})
|
120
|
-
options = default_options.merge(options)
|
121
|
-
adapter = current_adapter(options)
|
122
|
-
adapter.dump(object, options)
|
123
|
-
end
|
124
|
-
# :nodoc:
|
125
|
-
alias :encode :dump
|
126
|
-
|
127
|
-
# Executes passed block using specified adapter.
|
128
|
-
def with_adapter(new_adapter)
|
129
|
-
old_adapter, self.adapter = adapter, new_adapter
|
130
|
-
yield
|
131
|
-
ensure
|
132
|
-
self.adapter = old_adapter
|
133
|
-
end
|
134
|
-
# :nodoc:
|
135
|
-
alias :with_engine :with_adapter
|
136
|
-
|
137
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'gson' unless defined?(::Gson)
|
2
|
-
|
3
|
-
module MultiJson
|
4
|
-
module Adapters
|
5
|
-
# Use the gson.rb library to dump/load.
|
6
|
-
module Gson
|
7
|
-
extend self
|
8
|
-
|
9
|
-
ParseError = ::Gson::DecodeError
|
10
|
-
|
11
|
-
def load(string, options={}) #:nodoc:
|
12
|
-
::Gson::Decoder.new(options).decode(string)
|
13
|
-
end
|
14
|
-
|
15
|
-
def dump(object, options={}) #:nodoc:
|
16
|
-
::Gson::Encoder.new(options).encode(object)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module MultiJson
|
2
|
-
module Adapters
|
3
|
-
module JsonCommon
|
4
|
-
def load(string, options={})
|
5
|
-
string = string.read if string.respond_to?(:read)
|
6
|
-
::JSON.parse("[#{string}]", process_load_options!(options)).first
|
7
|
-
end
|
8
|
-
|
9
|
-
def dump(object, options={})
|
10
|
-
object.to_json(process_dump_options!(options))
|
11
|
-
end
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def process_load_options!(options={})
|
16
|
-
process_options!({:create_additions => false}, options) do |opts|
|
17
|
-
opts.merge!(:symbolize_names => true) if options.delete(:symbolize_keys)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def process_dump_options!(options={})
|
22
|
-
process_options!({}, options) do |opts|
|
23
|
-
opts.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def process_options!(default_options, options)
|
28
|
-
return default_options if options.empty?
|
29
|
-
yield default_options
|
30
|
-
default_options.merge!(options)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|