apache-config-generator 0.2.4 → 0.2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +57 -0
- data/Manifest +4 -0
- data/README.rdoc +9 -1
- data/Rakefile +9 -7
- data/apache-config-generator.gemspec +3 -3
- data/autotest/discover.rb +1 -0
- data/lib/apache/config.rb +4 -0
- data/lib/apache/rake/create.rb +34 -8
- data/skel/Gemfile +2 -0
- metadata +13 -8
    
        data/CHANGELOG
    CHANGED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/Gemfile.lock
    ADDED
    
    | @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            GEM
         | 
| 2 | 
            +
              specs:
         | 
| 3 | 
            +
                autotest (4.4.1)
         | 
| 4 | 
            +
                diff-lcs (1.1.2)
         | 
| 5 | 
            +
                echoe (4.3.1)
         | 
| 6 | 
            +
                  gemcutter
         | 
| 7 | 
            +
                  rubyforge
         | 
| 8 | 
            +
                gemcutter (0.6.1)
         | 
| 9 | 
            +
                json (1.4.6)
         | 
| 10 | 
            +
                json_pure (1.4.3)
         | 
| 11 | 
            +
                mocha (0.9.8)
         | 
| 12 | 
            +
                  rake
         | 
| 13 | 
            +
                rainbow (1.1)
         | 
| 14 | 
            +
                rake (0.8.7)
         | 
| 15 | 
            +
                rdiscount (1.6.5)
         | 
| 16 | 
            +
                rdoc (2.4.3)
         | 
| 17 | 
            +
                reek (1.2.8)
         | 
| 18 | 
            +
                  ruby2ruby (~> 1.2)
         | 
| 19 | 
            +
                  ruby_parser (~> 2.0)
         | 
| 20 | 
            +
                  sexp_processor (~> 3.0)
         | 
| 21 | 
            +
                rspec (2.0.1)
         | 
| 22 | 
            +
                  rspec-core (~> 2.0.1)
         | 
| 23 | 
            +
                  rspec-expectations (~> 2.0.1)
         | 
| 24 | 
            +
                  rspec-mocks (~> 2.0.1)
         | 
| 25 | 
            +
                rspec-core (2.0.1)
         | 
| 26 | 
            +
                rspec-expectations (2.0.1)
         | 
| 27 | 
            +
                  diff-lcs (>= 1.1.2)
         | 
| 28 | 
            +
                rspec-mocks (2.0.1)
         | 
| 29 | 
            +
                  rspec-core (~> 2.0.1)
         | 
| 30 | 
            +
                  rspec-expectations (~> 2.0.1)
         | 
| 31 | 
            +
                ruby2ruby (1.2.4)
         | 
| 32 | 
            +
                  ruby_parser (~> 2.0)
         | 
| 33 | 
            +
                  sexp_processor (~> 3.0)
         | 
| 34 | 
            +
                ruby_parser (2.0.4)
         | 
| 35 | 
            +
                  sexp_processor (~> 3.0)
         | 
| 36 | 
            +
                rubyforge (2.0.4)
         | 
| 37 | 
            +
                  json_pure (>= 1.1.7)
         | 
| 38 | 
            +
                sdoc (0.2.20)
         | 
| 39 | 
            +
                  json (>= 1.1.3)
         | 
| 40 | 
            +
                  rdoc (= 2.4.3)
         | 
| 41 | 
            +
                sdoc-helpers (0.1.4)
         | 
| 42 | 
            +
                  sdoc (~> 0.2)
         | 
| 43 | 
            +
                sexp_processor (3.0.4)
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            PLATFORMS
         | 
| 46 | 
            +
              ruby
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            DEPENDENCIES
         | 
| 49 | 
            +
              autotest
         | 
| 50 | 
            +
              echoe
         | 
| 51 | 
            +
              mocha
         | 
| 52 | 
            +
              rainbow
         | 
| 53 | 
            +
              rdiscount
         | 
| 54 | 
            +
              reek
         | 
| 55 | 
            +
              rspec
         | 
| 56 | 
            +
              sdoc
         | 
| 57 | 
            +
              sdoc-helpers
         | 
    
        data/Manifest
    CHANGED
    
    | @@ -1,6 +1,9 @@ | |
| 1 1 | 
             
            CHANGELOG
         | 
| 2 | 
            +
            Gemfile
         | 
| 3 | 
            +
            Gemfile.lock
         | 
| 2 4 | 
             
            README.rdoc
         | 
| 3 5 | 
             
            Rakefile
         | 
| 6 | 
            +
            autotest/discover.rb
         | 
| 4 7 | 
             
            bin/apache-configurator
         | 
| 5 8 | 
             
            config/config.reek
         | 
| 6 9 | 
             
            lib/apache.rb
         | 
| @@ -16,6 +19,7 @@ lib/apache/permissions.rb | |
| 16 19 | 
             
            lib/apache/rake/create.rb
         | 
| 17 20 | 
             
            lib/apache/rewrites.rb
         | 
| 18 21 | 
             
            lib/apache/ssl.rb
         | 
| 22 | 
            +
            skel/Gemfile
         | 
| 19 23 | 
             
            skel/Rakefile
         | 
| 20 24 | 
             
            skel/config.yml
         | 
| 21 25 | 
             
            Manifest
         | 
    
        data/README.rdoc
    CHANGED
    
    | @@ -9,7 +9,15 @@ Programmatically construct your Apache configuration using a powerful DSL built | |
| 9 9 | 
             
            == Usage
         | 
| 10 10 |  | 
| 11 11 | 
             
            Run <tt>apache-configurator <directory></tt> to create a new directory to hold your config files.
         | 
| 12 | 
            -
            A Rakefile and config.yml file will also be generated.
         | 
| 12 | 
            +
            A Rakefile, Gemfile, and config.yml file will also be generated.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            === Rakefile tasks
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            Apache Config Generator defines several tasks for managing Apache config files:
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            * apache:create[environment] creates your config files for the specified environment
         | 
| 19 | 
            +
            * apache:environments lists all possible environments that can be generated
         | 
| 20 | 
            +
            * apache:default[environment] sets a default environment to use with a parameter-less apache:create (or the default rake task)
         | 
| 13 21 |  | 
| 14 22 | 
             
            == Building a config file
         | 
| 15 23 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,13 +1,15 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'bundler'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Bundler.require(:default)
         | 
| 5 | 
            +
             | 
| 1 6 | 
             
            $LOAD_PATH << 'lib'
         | 
| 2 7 |  | 
| 3 | 
            -
            require 'rubygems'
         | 
| 4 8 | 
             
            require 'yaml'
         | 
| 5 9 |  | 
| 6 10 | 
             
            require 'apache'
         | 
| 7 | 
            -
            require ' | 
| 8 | 
            -
            require 'sdoc'
         | 
| 11 | 
            +
            require 'rspec/core/rake_task'
         | 
| 9 12 | 
             
            require 'sdoc_helpers/markdown'
         | 
| 10 | 
            -
            require 'echoe'
         | 
| 11 13 |  | 
| 12 14 | 
             
            namespace :apache do
         | 
| 13 15 | 
             
              desc "Generate the configs"
         | 
| @@ -28,11 +30,11 @@ end | |
| 28 30 |  | 
| 29 31 | 
             
            namespace :spec do
         | 
| 30 32 | 
             
              desc "Run RCov tests"
         | 
| 31 | 
            -
               | 
| 32 | 
            -
                t. | 
| 33 | 
            +
              RSpec::Core::RakeTask.new(:rcov) do |t|
         | 
| 34 | 
            +
                t.pattern = 'spec/*.rb'
         | 
| 33 35 | 
             
                t.rcov = true
         | 
| 34 36 | 
             
                t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
         | 
| 35 | 
            -
                t. | 
| 37 | 
            +
                t.rspec_opts = ['-b']
         | 
| 36 38 | 
             
              end
         | 
| 37 39 | 
             
            end
         | 
| 38 40 |  | 
| @@ -2,17 +2,17 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name = %q{apache-config-generator}
         | 
| 5 | 
            -
              s.version = "0.2. | 
| 5 | 
            +
              s.version = "0.2.5.1"
         | 
| 6 6 |  | 
| 7 7 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
         | 
| 8 8 | 
             
              s.authors = ["John Bintz"]
         | 
| 9 | 
            -
              s.date = %q{2010-10- | 
| 9 | 
            +
              s.date = %q{2010-10-26}
         | 
| 10 10 | 
             
              s.default_executable = %q{apache-configurator}
         | 
| 11 11 | 
             
              s.description = %q{A Ruby DSL for programmatically generating Apache configs}
         | 
| 12 12 | 
             
              s.email = %q{}
         | 
| 13 13 | 
             
              s.executables = ["apache-configurator"]
         | 
| 14 14 | 
             
              s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "bin/apache-configurator", "lib/apache.rb", "lib/apache/apachify.rb", "lib/apache/config.rb", "lib/apache/directory.rb", "lib/apache/logging.rb", "lib/apache/master.rb", "lib/apache/modules.rb", "lib/apache/mpm_prefork.rb", "lib/apache/performance.rb", "lib/apache/permissions.rb", "lib/apache/rake/create.rb", "lib/apache/rewrites.rb", "lib/apache/ssl.rb"]
         | 
| 15 | 
            -
              s.files = ["CHANGELOG", "README.rdoc", "Rakefile", "bin/apache-configurator", "config/config.reek", "lib/apache.rb", "lib/apache/apachify.rb", "lib/apache/config.rb", "lib/apache/directory.rb", "lib/apache/logging.rb", "lib/apache/master.rb", "lib/apache/modules.rb", "lib/apache/mpm_prefork.rb", "lib/apache/performance.rb", "lib/apache/permissions.rb", "lib/apache/rake/create.rb", "lib/apache/rewrites.rb", "lib/apache/ssl.rb", "skel/Rakefile", "skel/config.yml", "Manifest", "apache-config-generator.gemspec"]
         | 
| 15 | 
            +
              s.files = ["CHANGELOG", "Gemfile", "Gemfile.lock", "README.rdoc", "Rakefile", "autotest/discover.rb", "bin/apache-configurator", "config/config.reek", "lib/apache.rb", "lib/apache/apachify.rb", "lib/apache/config.rb", "lib/apache/directory.rb", "lib/apache/logging.rb", "lib/apache/master.rb", "lib/apache/modules.rb", "lib/apache/mpm_prefork.rb", "lib/apache/performance.rb", "lib/apache/permissions.rb", "lib/apache/rake/create.rb", "lib/apache/rewrites.rb", "lib/apache/ssl.rb", "skel/Gemfile", "skel/Rakefile", "skel/config.yml", "Manifest", "apache-config-generator.gemspec"]
         | 
| 16 16 | 
             
              s.homepage = %q{}
         | 
| 17 17 | 
             
              s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Apache-config-generator", "--main", "README.rdoc"]
         | 
| 18 18 | 
             
              s.require_paths = ["lib"]
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            Autotest.add_discovery { "rspec2" }
         | 
    
        data/lib/apache/config.rb
    CHANGED
    
    
    
        data/lib/apache/rake/create.rb
    CHANGED
    
    | @@ -1,8 +1,9 @@ | |
| 1 | 
            +
            Bundler.require(:default)
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            require 'fileutils'
         | 
| 2 4 | 
             
            require 'yaml'
         | 
| 3 5 | 
             
            require 'apache/config'
         | 
| 4 6 | 
             
            require 'apache/rake/create'
         | 
| 5 | 
            -
            require 'rainbow'
         | 
| 6 7 |  | 
| 7 8 | 
             
            CONFIG = Hash[YAML.load_file('config.yml').collect { |k,v| [ k.to_sym, v ] }]
         | 
| 8 9 |  | 
| @@ -14,17 +15,29 @@ def get_environments | |
| 14 15 | 
             
              }.flatten.uniq.sort.collect { |name| name[1..-1] }
         | 
| 15 16 | 
             
            end
         | 
| 16 17 |  | 
| 18 | 
            +
            def get_default_environment
         | 
| 19 | 
            +
              File.read('.environment').strip rescue nil
         | 
| 20 | 
            +
            end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            def need_environment
         | 
| 23 | 
            +
              puts "You need to specify an environment. Available environments:"
         | 
| 24 | 
            +
              puts
         | 
| 25 | 
            +
              puts get_environments.collect { |env| "rake apache:create[#{env}]" } * "\n"
         | 
| 26 | 
            +
              puts
         | 
| 27 | 
            +
              puts "Additionally, you can set a default environment for this server:"
         | 
| 28 | 
            +
              puts
         | 
| 29 | 
            +
              puts "rake apache:default[#{get_environments.first}]"
         | 
| 30 | 
            +
              exit 1
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            task :default => 'apache:create'
         | 
| 34 | 
            +
             | 
| 17 35 | 
             
            namespace :apache do
         | 
| 18 36 | 
             
              desc "Create all defined configs for the specified environment"
         | 
| 19 37 | 
             
              task :create, :environment do |t, args|
         | 
| 20 | 
            -
                if !args[:environment]
         | 
| 21 | 
            -
                  puts "You need to specify an environment. Available environments:"
         | 
| 22 | 
            -
                  puts
         | 
| 23 | 
            -
                  puts get_environments.collect { |env| "rake apache:create[#{env}]" } * "\n"
         | 
| 24 | 
            -
                  exit 1
         | 
| 25 | 
            -
                end
         | 
| 38 | 
            +
                need_environment if !args[:environment] && !get_default_environment
         | 
| 26 39 |  | 
| 27 | 
            -
                APACHE_ENV = (args[:environment] ||  | 
| 40 | 
            +
                APACHE_ENV = (args[:environment] || get_default_environment).to_sym
         | 
| 28 41 |  | 
| 29 42 | 
             
                CONFIG[:source_path] = File.expand_path(CONFIG[:source])
         | 
| 30 43 | 
             
                CONFIG[:dest_path] = File.expand_path(CONFIG[:destination])
         | 
| @@ -44,4 +57,17 @@ namespace :apache do | |
| 44 57 | 
             
              task :environments do
         | 
| 45 58 | 
             
                puts get_environments * "\n"
         | 
| 46 59 | 
             
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              desc "Set the default environment (currently #{get_default_environment || 'nil'})"
         | 
| 62 | 
            +
              task :default, :environment do |t, args|
         | 
| 63 | 
            +
                need_environment if !args[:environment]
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                if get_environments.include?(args[:environment])
         | 
| 66 | 
            +
                  File.open('.environment', 'w') { |fh| fh.puts args[:environment] }
         | 
| 67 | 
            +
                  puts "Calls to apache:create will now use #{args[:environment]} when you don't specify the environment."
         | 
| 68 | 
            +
                else
         | 
| 69 | 
            +
                  puts "You need to specify a valid default environment. Here are the possibilities:"
         | 
| 70 | 
            +
                  Rake::Task['apache:environments'].invoke
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
              end
         | 
| 47 73 | 
             
            end
         | 
    
        data/skel/Gemfile
    ADDED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: apache-config-generator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 73
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 2
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
               | 
| 9 | 
            +
              - 5
         | 
| 10 | 
            +
              - 1
         | 
| 11 | 
            +
              version: 0.2.5.1
         | 
| 11 12 | 
             
            platform: ruby
         | 
| 12 13 | 
             
            authors: 
         | 
| 13 14 | 
             
            - John Bintz
         | 
| @@ -15,13 +16,14 @@ autorequire: | |
| 15 16 | 
             
            bindir: bin
         | 
| 16 17 | 
             
            cert_chain: []
         | 
| 17 18 |  | 
| 18 | 
            -
            date: 2010-10- | 
| 19 | 
            +
            date: 2010-10-26 00:00:00 -04:00
         | 
| 19 20 | 
             
            default_executable: 
         | 
| 20 21 | 
             
            dependencies: 
         | 
| 21 22 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            -
              name: rainbow
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
               | 
| 24 | 
            +
              type: :runtime
         | 
| 25 | 
            +
              name: rainbow
         | 
| 26 | 
            +
              version_requirements: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 27 | 
             
                none: false
         | 
| 26 28 | 
             
                requirements: 
         | 
| 27 29 | 
             
                - - ">="
         | 
| @@ -30,8 +32,7 @@ dependencies: | |
| 30 32 | 
             
                    segments: 
         | 
| 31 33 | 
             
                    - 0
         | 
| 32 34 | 
             
                    version: "0"
         | 
| 33 | 
            -
               | 
| 34 | 
            -
              version_requirements: *id001
         | 
| 35 | 
            +
              requirement: *id001
         | 
| 35 36 | 
             
            description: A Ruby DSL for programmatically generating Apache configs
         | 
| 36 37 | 
             
            email: ""
         | 
| 37 38 | 
             
            executables: 
         | 
| @@ -57,8 +58,11 @@ extra_rdoc_files: | |
| 57 58 | 
             
            - lib/apache/ssl.rb
         | 
| 58 59 | 
             
            files: 
         | 
| 59 60 | 
             
            - CHANGELOG
         | 
| 61 | 
            +
            - Gemfile
         | 
| 62 | 
            +
            - Gemfile.lock
         | 
| 60 63 | 
             
            - README.rdoc
         | 
| 61 64 | 
             
            - Rakefile
         | 
| 65 | 
            +
            - autotest/discover.rb
         | 
| 62 66 | 
             
            - bin/apache-configurator
         | 
| 63 67 | 
             
            - config/config.reek
         | 
| 64 68 | 
             
            - lib/apache.rb
         | 
| @@ -74,6 +78,7 @@ files: | |
| 74 78 | 
             
            - lib/apache/rake/create.rb
         | 
| 75 79 | 
             
            - lib/apache/rewrites.rb
         | 
| 76 80 | 
             
            - lib/apache/ssl.rb
         | 
| 81 | 
            +
            - skel/Gemfile
         | 
| 77 82 | 
             
            - skel/Rakefile
         | 
| 78 83 | 
             
            - skel/config.yml
         | 
| 79 84 | 
             
            - Manifest
         |