ruby-app 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ Gemfile.lock
2
2
  *.gem
3
3
  _1
4
4
  _0
5
+ _2
data/README.md CHANGED
@@ -4,9 +4,8 @@ RubyApp
4
4
  Little ruby application template. For creates light ruby apps (daemons, EventMachine-apps, ...).
5
5
  Supports bundler, environments, rails dirs tree.
6
6
 
7
- ```ruby
8
- gem install ruby-app
9
- ```
7
+ $ gem install ruby-app
8
+
10
9
 
11
10
  $ ruby-app new_app
12
11
  $ cd new_app && bundle
data/bin/ruby-app CHANGED
@@ -10,7 +10,9 @@ class RubyAppGenerator < Thor::Group
10
10
  argument :name
11
11
 
12
12
  def copy_tree
13
- directory('./', "#{name}/")
13
+ directory('', "#{name}/")
14
+ empty_directory("#{name}/log")
15
+ empty_directory("#{name}/tmp")
14
16
  end
15
17
 
16
18
  def chmod_example_bin
data/generator/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
1
  *.log
2
2
  *.pid
3
- log/
3
+ log/*
4
4
  !log/.gitkeep
5
- tmp/
5
+ tmp/*
6
6
  !tmp/.gitkeep
data/generator/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source :rubygems
2
2
 
3
3
  gem 'ruby-app'
4
+ gem 'rake', :require => false
4
5
 
5
6
 
6
7
 
@@ -12,6 +13,7 @@ end
12
13
  group :development do
13
14
  end
14
15
 
15
- group :test do
16
- gem 'rspec'
16
+ group :test do
17
+
18
+ gem 'rspec', '~>2'
17
19
  end
@@ -1,9 +1,13 @@
1
1
  require 'rubygems'
2
+
3
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
2
4
  require 'bundler/setup'
3
5
 
4
6
  class Application
5
- def self.root
6
- File.join(File.dirname(__FILE__), %w(..))
7
+ class << self
8
+ def root
9
+ @root ||= File.join(File.dirname(__FILE__), %w(..))
10
+ end
7
11
  end
8
12
  end
9
13
 
@@ -1,6 +1,17 @@
1
- require 'rubygems'
2
- require "bundler/setup"
1
+ ENV["APP_ENV"] = 'test'
2
+ require File.expand_path("../../config/environment", __FILE__)
3
3
 
4
- ENV['APP_ENV'] = 'test'
4
+ # Requires supporting ruby files with custom matchers and macros, etc,
5
+ # in spec/support/ and its subdirectories.
6
+ Dir[File.join(App.root, %w{spec support ** *.rb})].each {|f| require f}
5
7
 
6
- require File.join(File.dirname(__FILE__), %w{.. config environment})
8
+ RSpec.configure do |config|
9
+ # ## Mock Framework
10
+ #
11
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
12
+ #
13
+ # config.mock_with :mocha
14
+ # config.mock_with :flexmock
15
+ # config.mock_with :rr
16
+
17
+ end
data/lib/ruby-app/boot.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  $KCODE='u' if RUBY_VERSION < '1.9'
2
2
 
3
+ local_root = File.dirname(__FILE__)
4
+
3
5
  # app from gem
4
- require File.join(File.dirname(__FILE__), 'application')
6
+ require File.join(local_root, 'application')
5
7
 
6
8
  $:.unshift(File.join(App.root, %w{ lib }))
@@ -18,7 +18,9 @@ class CommonConfig
18
18
 
19
19
  private
20
20
 
21
- def method_missing(name, *params)
21
+ def method_missing(name, *params, &block)
22
+ params = block.call if block
23
+
22
24
  if name.to_s =~ /_address$/i
23
25
  require 'ostruct'
24
26
  @configs[name] = OpenStruct.new(:host => params[0], :port => params[1].to_i)
@@ -4,7 +4,7 @@ begin
4
4
  desc "Run specs"
5
5
  RSpec::Core::RakeTask.new(:spec) do |t|
6
6
  t.rspec_opts = ['--options', "./spec/spec.opts"]
7
- t.pattern = "./spec/**/*_spec.rb"
7
+ # t.pattern = "./spec/**/*_spec.rb"
8
8
  end
9
9
  task :default => :spec
10
10
 
@@ -1,3 +1,3 @@
1
1
  module RubyApp
2
- VERSION = "0.1.2"
3
- end
2
+ VERSION = "0.1.3"
3
+ end
data/spec/app_spec.rb CHANGED
@@ -20,6 +20,10 @@ describe "RubyApp" do
20
20
  App.config.some2.should == 'bbb'
21
21
  end
22
22
 
23
+ it "constant - no warnings about redefine" do
24
+ App::BLA.should == 1
25
+ end
26
+
23
27
  it "force set env" do
24
28
  App.env.should == 'test3'
25
29
  App.config.apps.size.should == 4
@@ -1,6 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  class Application
4
+ BLA = 1
5
+
4
6
  class << self
5
7
 
6
8
  def name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-20 00:00:00.000000000 Z
12
+ date: 2012-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport