diff --git a/actioncable-5.2.3.gem b/actioncable-5.2.3.gem new file mode 100644 index 0000000..a85488c Binary files /dev/null and b/actioncable-5.2.3.gem differ diff --git a/recompile_js.rb b/recompile_js.rb new file mode 100644 index 0000000..aef6b27 --- /dev/null +++ b/recompile_js.rb @@ -0,0 +1,37 @@ + +require 'pathname' +require 'sprockets' +require 'coffee-script' +require 'action_cable' + +dir = File.dirname(__FILE__) + +root_path = Pathname.new(dir) +destination_path = root_path.join("lib/assets/compiled") + +puts 'Compiling Action Cable assets...' + +precompile_list = %w(action_cable.js) + +environment = Sprockets::Environment.new + +environment.gzip = false +Pathname.glob(root_path.join("app/assets/*/")) do |subdir| + environment.append_path subdir +end + +compile_path = root_path.join("tmp/sprockets") +compile_path.rmtree if compile_path.exist? +compile_path.mkpath + +manifest = Sprockets::Manifest.new(environment.index, compile_path) +manifest.compile(precompile_list) + +destination_path.rmtree if destination_path.exist? + +manifest.assets.each do |path, fingerprint_path| + destination_path.join(path).dirname.mkpath + FileUtils.cp(compile_path.join(fingerprint_path), destination_path.join(path)) +end + +puts 'Done' diff --git a/rubygem-actioncable.spec b/rubygem-actioncable.spec new file mode 100644 index 0000000..1986d82 --- /dev/null +++ b/rubygem-actioncable.spec @@ -0,0 +1,78 @@ +%global gem_name actioncable +%global recompile_js 1 +Name: rubygem-%{gem_name} +Version: 5.2.3 +Release: 1 +Summary: WebSocket framework for Rails +License: MIT +URL: http://rubyonrails.org +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +Source1: https://github.com/rails/rails/archive/v%{version}.tar.gz +# Recompile with script extracted from +# https://github.com/rails/rails/blob/71d406697266fc2525706361b86aeb85183fe4c7/actioncable/Rakefile +Source2: recompile_js.rb +BuildRequires: ruby(release) rubygems-devel > 1.3.1 ruby >= 2.2.2 +BuildRequires: rubygem(actionpack) = %{version} rubygem(mocha) rubygem(nio4r) rubygem(puma) +BuildRequires: %{_bindir}/redis-server rubygem(redis) rubygem(websocket-driver) +%if 0%{?recompile_js} > 0 +BuildRequires: rubygem(coffee-script) rubygem(sprockets) nodejs +%endif +BuildArch: noarch +%description +Structure many real-time application concerns into channels over a single +WebSocket connection. + +%package doc +Summary: Documentation for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch +%description doc +Documentation for %{name}. + +%prep +gem unpack %{SOURCE0} +%setup -q -D -T -n %{gem_name}-%{version} -a 1 +ln -s rails-%{version}/%{gem_name}/app app +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec + +%build +%if 0%{?recompile_js} > 0 +cp -a %{SOURCE2} . +rm -rf lib/assets/compiled +RUBYOPT=-Ilib ruby recompile_js.rb +%endif +gem build %{gem_name}.gemspec +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +%check +pushd .%{gem_instdir} +tar xzvf %{SOURCE1} +ln -s rails-%{version}/%{gem_name}/test test +mv test/client_test.rb{,.disable} +mv test/subscription_adapter/postgresql_test.rb{,.disable} +REDIS_DIR=$(mktemp -d) +redis-server --dir $REDIS_DIR --pidfile $REDIS_DIR/redis.pid --daemonize yes +ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' +kill -INT $(cat $REDIS_DIR/redis.pid) +popd + +%files +%dir %{gem_instdir} +%license %{gem_instdir}/MIT-LICENSE +%{gem_libdir} +%exclude %{gem_cache} +%{gem_spec} + +%files doc +%doc %{gem_docdir} +%doc %{gem_instdir}/CHANGELOG.md +%doc %{gem_instdir}/README.md + +%changelog +* Thu Aug 20 2020 shenleizhao - 5.2.3-1 +- package init diff --git a/rubygem-actioncable.yaml b/rubygem-actioncable.yaml new file mode 100644 index 0000000..f15fba1 --- /dev/null +++ b/rubygem-actioncable.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: rails/rails +tag_prefix: "v" +separator: "." diff --git a/v5.2.3.tar.gz b/v5.2.3.tar.gz new file mode 100644 index 0000000..1d7dd90 Binary files /dev/null and b/v5.2.3.tar.gz differ