Sha256: 106ef091c2d6a8506cc2ef02b2f4aee69403fc45c559a27c90abc4a47cbe12b6
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
require 'fileutils' module Pushify module Install def self.install! File.exist?(File.join(Dir.pwd, "Gemfile")) ? self.install_3! : self.install_2! end def self.install_2! return false if File.open('config/environments/development.rb', 'r').read.match(/\s*config\.gem\s+['"]pushify['"]/) File.open('config/environments/development.rb', 'a') do |f| f.write("\n\nconfig.gem 'pushify'\n") end true end def self.install_3! return false if File.open('Gemfile', 'r').read.match(/\s*gem\s+['"]pushify['"]/) File.open('Gemfile', 'a') do |f| f.write("\n\ngroup :development do\n gem 'pushify'\nend\n") end split_on = "Demo3::Application.configure do" parts = File.read('config/environments/development.rb').split(split_on) File.open('config/environments/development.rb', "w") do |f| f.puts parts.join(split_on + "\n\n config.middleware.use Pushify::Rack") end true end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pushify-1.2.2 | lib/pushify/install.rb |
pushify-1.2.1 | lib/pushify/install.rb |
pushify-1.2.0 | lib/pushify/install.rb |
pushify-1.1.0 | lib/pushify/install.rb |