split rails part into separate gem

see #1
This commit is contained in:
Benjamin Neff 2015-07-03 02:57:47 +02:00
parent 7370a32c65
commit 9925cbb99a
10 changed files with 77 additions and 14 deletions

View file

@ -3,7 +3,12 @@ source "https://rubygems.org"
# Declare your gem's dependencies in diaspora_federation.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
gemspec name: "diaspora_federation"
Dir["diaspora_federation-*.gemspec"].each do |gemspec|
plugin = gemspec.scan(/diaspora_federation-(.*)\.gemspec/).flatten.first
gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin)
end
# 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
@ -59,5 +64,5 @@ end
group :development, :production do
# Logging (only for dummy-app, not for the gem)
gem "logging-rails", "0.5.0", require: "logging/rails"
gem "logging-rails", "0.5.0"
end

View file

@ -2,8 +2,10 @@ PATH
remote: .
specs:
diaspora_federation (0.0.2)
nokogiri (~> 1.6.6.2)
rails (~> 4.2.2)
nokogiri (~> 1.6, >= 1.6.6)
diaspora_federation-rails (0.0.2)
diaspora_federation (= 0.0.2)
rails (~> 4.2)
GEM
remote: https://rubygems.org/
@ -226,6 +228,7 @@ PLATFORMS
DEPENDENCIES
codeclimate-test-reporter
diaspora_federation!
diaspora_federation-rails!
factory_girl_rails (~> 4.5.0)
fixture_builder (~> 0.4.1)
fuubar (= 2.0.0)

View file

@ -18,7 +18,7 @@ load "rails/tasks/engine.rake"
load "rails/tasks/statistics.rake"
Bundler::GemHelper.install_tasks
Bundler::GemHelper.install_tasks name: "diaspora_federation"
Rails.application.load_tasks

View file

@ -0,0 +1,25 @@
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "diaspora_federation/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "diaspora_federation-rails"
s.version = DiasporaFederation::VERSION
s.authors = ["Benjamin Neff"]
s.email = ["benjamin@coding4.coffee"]
s.homepage = "https://github.com/SuperTux88/diaspora_federation"
s.summary = "diaspora* federation rails engine"
s.description = "A rails engine that adds the diaspora* federation protocol to a rails app"
s.license = "AGPL 3.0 - http://www.gnu.org/licenses/agpl-3.0.html"
s.files = Dir["app/**/*", "config/routes.rb", "lib/diaspora_federation/{engine,rails}.rb",
"LICENSE", "README.md"]
s.required_ruby_version = "~> 2.0"
s.add_dependency "rails", "~> 4.2"
s.add_dependency "diaspora_federation", DiasporaFederation::VERSION
end

View file

@ -10,12 +10,15 @@ Gem::Specification.new do |s|
s.authors = ["Benjamin Neff"]
s.email = ["benjamin@coding4.coffee"]
s.homepage = "https://github.com/SuperTux88/diaspora_federation"
s.summary = "diaspora* federation rails engine"
s.description = "A rails engine that adds the diaspora* federation protocol to a rails app"
s.summary = "diaspora* federation library"
s.description = "This gem provides the functionality for de-/serialization and " \
"de-/encryption of Entities in the protocols used for communication " \
"among the various installations of Diaspora*"
s.license = "AGPL 3.0 - http://www.gnu.org/licenses/agpl-3.0.html"
s.files = Dir["{app,lib}/**/*", "config/routes.rb", "LICENSE", "Rakefile", "README.md"]
s.files = Dir["lib/**/*", "LICENSE", "README.md"] - Dir["lib/diaspora_federation/{engine,rails}.rb"]
s.add_dependency "rails", "~> 4.2.2"
s.add_dependency "nokogiri", "~> 1.6.6.2"
s.required_ruby_version = "~> 2.0"
s.add_dependency "nokogiri", "~> 1.6", ">= 1.6.6"
end

View file

@ -1,10 +1,9 @@
require "diaspora_federation/engine"
require "diaspora_federation/logging"
require "diaspora_federation/web_finger"
##
# diaspora* federation rails engine
# diaspora* federation library
module DiasporaFederation
extend Logging

View file

@ -17,7 +17,8 @@ module DiasporaFederation
# fallback logger
@logger = Logger.new(STDOUT)
@logger.level = Logger.const_get(Rails.configuration.log_level.to_s.upcase)
loglevel = defined?(::Rails) ? ::Rails.configuration.log_level.to_s.upcase : "INFO"
@logger.level = Logger.const_get(loglevel)
@logger
end
end

View file

@ -0,0 +1,10 @@
require "diaspora_federation/engine"
require "diaspora_federation"
module DiasporaFederation
##
# diaspora* federation rails engine
module Rails
end
end

17
lib/tasks/build.rake Normal file
View file

@ -0,0 +1,17 @@
desc "Build gem into the pkg directory"
task build: :test do
FileUtils.rm_rf("pkg")
Dir["*.gemspec"].each do |gemspec|
system "gem build #{gemspec}"
end
FileUtils.mkdir_p("pkg")
FileUtils.mv(Dir["*.gem"], "pkg")
end
desc "Tags version, pushes to remote, and pushes gem"
task release: :build do
sh "git tag v#{DiasporaFederation::VERSION}"
sh "git push origin master"
sh "git push origin v#{DiasporaFederation::VERSION}"
sh "ls pkg/*.gem | xargs -n 1 gem push"
end

View file

@ -3,7 +3,7 @@ require_relative "boot"
require "rails/all"
Bundler.require(*Rails.groups)
require "diaspora_federation"
require "diaspora_federation/rails"
module Dummy
class Application < Rails::Application