From efcf0e5927055d2b86804c84b00c614b38191964 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 8 Oct 2012 10:45:27 +0200 Subject: enabling rake gem in engines, using LeapWeb::Version all over the place --- certs/Rakefile | 10 ++++++++-- certs/leap_web_certs.gemspec | 7 +++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'certs') diff --git a/certs/Rakefile b/certs/Rakefile index dd38158..54ed86d 100644 --- a/certs/Rakefile +++ b/certs/Rakefile @@ -1,4 +1,8 @@ #!/usr/bin/env rake + +require 'rake/packagetask' +require 'rubygems/package_task' + begin require 'bundler/setup' rescue LoadError @@ -20,8 +24,10 @@ RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end - - +spec = eval(File.read('leap_web_certs.gemspec')) +Gem::PackageTask.new(spec) do |p| + p.gem_spec = spec +end Bundler::GemHelper.install_tasks diff --git a/certs/leap_web_certs.gemspec b/certs/leap_web_certs.gemspec index 28ef392..db5d04f 100644 --- a/certs/leap_web_certs.gemspec +++ b/certs/leap_web_certs.gemspec @@ -1,12 +1,11 @@ $:.push File.expand_path("../lib", __FILE__) -# Maintain your gem's version: -require "leap_web_certs/version" +require File.expand_path('../../lib/leap_web/version.rb', __FILE__) # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "leap_web_certs" - s.version = LeapWebCerts::VERSION + s.version = LeapWeb::VERSION s.authors = ["Azul"] s.email = ["azul@leap.se"] s.homepage = "http://www.leap.se" @@ -17,7 +16,7 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.add_dependency "rails", "~> 3.2.8" - s.add_dependency "leap_web_core", "~> 0.0.1" + s.add_dependency "leap_web_core", LeapWeb::VERSION s.add_development_dependency "mocha" -- cgit v1.2.3 From 51bc4cf65133982e9cf197bcf07aed3efce3d6dc Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 8 Oct 2012 11:27:19 +0200 Subject: cleaned up the gemspecs a bit - now all build --- certs/leap_web_certs.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'certs') diff --git a/certs/leap_web_certs.gemspec b/certs/leap_web_certs.gemspec index db5d04f..14708df 100644 --- a/certs/leap_web_certs.gemspec +++ b/certs/leap_web_certs.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.summary = "Cert distribution for the leap platform" s.description = "This plugin for the leap platform distributes certs for the EIP client. It fetches the certs from a pool in CouchDB that is filled by leap-ca." - s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "Readme.md"] + s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "Readme.md"] s.test_files = Dir["test/**/*"] s.add_dependency "rails", "~> 3.2.8" -- cgit v1.2.3 From f5aea5347601c3500bb3670971d44995c35c3c7b Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 8 Oct 2012 19:50:00 +0200 Subject: use couchrest session store in core, updated dummy path --- certs/test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'certs') diff --git a/certs/test/test_helper.rb b/certs/test/test_helper.rb index b268c51..08d4d41 100644 --- a/certs/test/test_helper.rb +++ b/certs/test/test_helper.rb @@ -1,5 +1,5 @@ ENV["RAILS_ENV"] = "test" -require File.expand_path('../dummy/config/environment', __FILE__) +require File.expand_path('../../../test/dummy/config/environment', __FILE__) require 'rails/test_help' require 'mocha' -- cgit v1.2.3 From 00b7b36516d1d07300870029ad5190f06122a493 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 10 Oct 2012 19:56:35 +0200 Subject: first steps at reducing core --- certs/Gemfile | 12 +++--------- certs/leap_web_certs.gemspec | 3 --- certs/lib/leap_web_certs.rb | 1 + certs/lib/leap_web_certs/engine.rb | 3 --- certs/lib/leap_web_certs/version.rb | 3 --- 5 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 certs/lib/leap_web_certs/version.rb (limited to 'certs') diff --git a/certs/Gemfile b/certs/Gemfile index 9028024..ab2aa7a 100644 --- a/certs/Gemfile +++ b/certs/Gemfile @@ -1,17 +1,11 @@ source "http://rubygems.org" -# Declare your gem's dependencies in leap_web_certs.gemspec. +eval(File.read(File.dirname(__FILE__) + '/../common_dependencies.rb')) + +# Declare your gem's dependencies in leap_web_users.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec -# jquery-rails is used by the dummy application -gem "jquery-rails" - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - # To use debugger # gem 'ruby-debug' diff --git a/certs/leap_web_certs.gemspec b/certs/leap_web_certs.gemspec index 14708df..15a45be 100644 --- a/certs/leap_web_certs.gemspec +++ b/certs/leap_web_certs.gemspec @@ -15,9 +15,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "Readme.md"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 3.2.8" s.add_dependency "leap_web_core", LeapWeb::VERSION - - s.add_development_dependency "mocha" end diff --git a/certs/lib/leap_web_certs.rb b/certs/lib/leap_web_certs.rb index beb683d..129d1a9 100644 --- a/certs/lib/leap_web_certs.rb +++ b/certs/lib/leap_web_certs.rb @@ -1,3 +1,4 @@ +require "leap_web_core" require "leap_web_certs/engine" module LeapWebCerts diff --git a/certs/lib/leap_web_certs/engine.rb b/certs/lib/leap_web_certs/engine.rb index 7dbc572..33a446e 100644 --- a/certs/lib/leap_web_certs/engine.rb +++ b/certs/lib/leap_web_certs/engine.rb @@ -1,6 +1,3 @@ -# thou shall require all your dependencies in an engine. -require "leap_web_core" - module LeapWebCerts class Engine < ::Rails::Engine diff --git a/certs/lib/leap_web_certs/version.rb b/certs/lib/leap_web_certs/version.rb deleted file mode 100644 index 800ca0b..0000000 --- a/certs/lib/leap_web_certs/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module LeapWebCerts - VERSION = "0.0.4" -end -- cgit v1.2.3 From add8d015c87a00626b739080bd75c7e7aeb9c1df Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 11 Oct 2012 10:22:34 +0200 Subject: moved core dependency into */Gemfile with :path In order to get the rails generators and the like to work properly in engines we need to require all the dependencies in the engine.rb file. Since I want to keep that list of engines in a centralized place we still need core and we need to require it from the other engines. We don't want to require the core gem to be installed so I added it with :path option to the Gemfile. --- certs/Gemfile | 3 +++ certs/lib/leap_web_certs.rb | 1 - certs/lib/leap_web_certs/engine.rb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'certs') diff --git a/certs/Gemfile b/certs/Gemfile index ab2aa7a..951d1b7 100644 --- a/certs/Gemfile +++ b/certs/Gemfile @@ -2,6 +2,9 @@ source "http://rubygems.org" eval(File.read(File.dirname(__FILE__) + '/../common_dependencies.rb')) +# We require leap_web_core from here so we can use the path option. +gem "leap_web_core", :path => '../core' + # Declare your gem's dependencies in leap_web_users.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. diff --git a/certs/lib/leap_web_certs.rb b/certs/lib/leap_web_certs.rb index 129d1a9..beb683d 100644 --- a/certs/lib/leap_web_certs.rb +++ b/certs/lib/leap_web_certs.rb @@ -1,4 +1,3 @@ -require "leap_web_core" require "leap_web_certs/engine" module LeapWebCerts diff --git a/certs/lib/leap_web_certs/engine.rb b/certs/lib/leap_web_certs/engine.rb index 33a446e..3c8948a 100644 --- a/certs/lib/leap_web_certs/engine.rb +++ b/certs/lib/leap_web_certs/engine.rb @@ -1,3 +1,5 @@ +require "leap_web_core" + module LeapWebCerts class Engine < ::Rails::Engine -- cgit v1.2.3 From bde15d4ec416c1c6c99c7ea8bad9d8ed5aca128d Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 11 Oct 2012 11:45:16 +0200 Subject: fixed cert tests - adding test data and not testing the inline cert download filename --- certs/test/functional/certs_controller_test.rb | 1 - certs/test/unit/cert_test.rb | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'certs') diff --git a/certs/test/functional/certs_controller_test.rb b/certs/test/functional/certs_controller_test.rb index 04669f5..295515b 100644 --- a/certs/test/functional/certs_controller_test.rb +++ b/certs/test/functional/certs_controller_test.rb @@ -10,6 +10,5 @@ class CertsControllerTest < ActionController::TestCase get :show assert_response :success assert_equal cert.zipped, @response.body - assert_attachement_filename "cert_stub.zip" end end diff --git a/certs/test/unit/cert_test.rb b/certs/test/unit/cert_test.rb index 21ef169..9362da2 100644 --- a/certs/test/unit/cert_test.rb +++ b/certs/test/unit/cert_test.rb @@ -17,8 +17,9 @@ class CertTest < ActiveSupport::TestCase end test "cert.zipped returns the actual data" do - @sample.save # This is required! + @sample.save # This is required ! assert lines = @sample.zipped.split("\n") + assert_equal 56, lines.count assert_equal "-----BEGIN RSA PRIVATE KEY-----", lines.first.chomp assert_equal "-----END CERTIFICATE-----", lines.last.chomp end -- cgit v1.2.3