ruby-app 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  Gemfile.lock
2
2
  *.gem
3
3
  _1
4
+ _0
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  RubyApp
2
2
  =======
3
3
 
4
- Little ruby application template. For light ruby apps (daemons, EventMachine-apps, ...)
4
+ Little ruby application template. For creates light ruby apps (daemons, EventMachine-apps, ...).
5
+ Supports bundler, environments, rails dirs tree.
5
6
 
6
7
  ```ruby
7
8
  gem install ruby-app
data/bin/ruby-app CHANGED
@@ -10,12 +10,7 @@ class RubyAppGenerator < Thor::Group
10
10
  argument :name
11
11
 
12
12
  def copy_tree
13
- Dir["#{source_root}/**/.git*"].each{|f| cp_file f }
14
- Dir["#{source_root}/**/*"].each{|f| cp_file f }
15
- end
16
-
17
- def template_app
18
- template("#{source_root}/lib/application.rb", "#{name}/lib/application.rb", true)
13
+ directory('./', "#{name}/")
19
14
  end
20
15
 
21
16
  def chmod_example_bin
@@ -23,22 +18,15 @@ class RubyAppGenerator < Thor::Group
23
18
  end
24
19
 
25
20
  private
26
- def cp_file(filename)
27
- if File.exists?(filename) && !File.directory?(filename)
28
- return if File.basename(filename) == 'application.rb'
29
- to = "#{name}#{filename.sub(source_root, '')}"
30
- copy_file(filename, to)
31
- end
32
- end
33
21
 
34
- def source_root
35
- File.join(File.dirname(__FILE__), %w{.. generator})
36
- end
37
-
38
22
  def self.source_root
39
23
  File.join(File.dirname(__FILE__), %w{.. generator})
40
24
  end
41
25
 
26
+ def base_name
27
+ File.basename(name)
28
+ end
29
+
42
30
  end
43
31
 
44
32
  RubyAppGenerator.start
data/generator/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
1
+ require File.join(File.dirname(__FILE__), %w{config boot})
3
2
 
4
- load "ruby-app/tasks.rb"
3
+ load "ruby-app/tasks.rake"
data/generator/bin/dummy CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  require File.join(File.dirname(__FILE__), %w{.. config environment})
4
4
 
5
- App.logger.info "root - #{App.root}"
6
- App.logger.info "env - #{App.env}"
7
- App.logger.info "name - #{App.name}"
5
+ App.logger.info "root: '#{App.root}'"
6
+ App.logger.info "env: '#{App.env}'"
7
+ App.logger.info "name: '#{App.name}'"
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ class Application
5
+ def self.root
6
+ File.join(File.dirname(__FILE__), %w(..))
7
+ end
8
+ end
9
+
10
+ require 'ruby-app/boot'
@@ -1,13 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require 'rubygems'
3
- require 'bundler/setup'
2
+ require File.join(File.dirname(__FILE__), 'boot')
4
3
 
5
- # ENV['APP_ENV'] = 'production' # uncomment if want forced env
6
-
7
- class Application
8
- def self.root
9
- File.join(File.dirname(__FILE__), %w(..))
10
- end
11
- end
4
+ # ENV['APP_ENV'] = 'production' # uncomment if need forced env
12
5
 
13
6
  require 'ruby-app/environment'
@@ -4,7 +4,7 @@ class Application
4
4
  class << self
5
5
 
6
6
  def name
7
- "<%= name %>"
7
+ "<%= base_name %>"
8
8
  end
9
9
  end
10
10
 
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "spec1" do
4
4
 
5
5
  it "app name should be" do
6
- App.name.should be_an_instance_of(String)
6
+ App.name.should == "<%= base_name %>"
7
7
  end
8
8
 
9
9
  end
@@ -29,4 +29,4 @@ class Application
29
29
  end
30
30
  end
31
31
 
32
- A = App = Application
32
+ A = App = Application unless defined?(App)
@@ -0,0 +1,6 @@
1
+ $KCODE='u' if RUBY_VERSION < '1.9'
2
+
3
+ # app from gem
4
+ require File.join(File.dirname(__FILE__), 'application')
5
+
6
+ $:.unshift(File.join(App.root, %w{ lib }))
@@ -1,13 +1,11 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- $KCODE='u' if RUBY_VERSION < '1.9'
4
-
5
3
  #require 'yaml'
6
4
 
7
5
  local_root = File.dirname(__FILE__)
8
6
 
9
7
  # app from gem
10
- require File.join(local_root, 'application')
8
+ require File.join(local_root, 'boot')
11
9
 
12
10
  # config from gem
13
11
  require File.join(local_root, 'common_config')
@@ -31,7 +29,9 @@ require 'active_support/core_ext/object/blank'
31
29
  # load application app
32
30
  require File.join(App.root, %w{lib application})
33
31
 
34
- App.logger.info "Loading #{App.name}[#{App.env}] ..."
32
+ unless defined?(Rake)
33
+ App.logger.info "Loading #{App.name}[#{App.env}] ..."
34
+ end
35
35
 
36
36
  # default config from app
37
37
  require File.join(App.root, %w{config config})
@@ -44,7 +44,7 @@ rescue LoadError
44
44
  end
45
45
 
46
46
  # unshift lib app
47
- $:.unshift(File.join(App.root, 'lib'))
47
+ # $:.unshift(File.join(App.root, 'lib'))
48
48
 
49
49
  ActiveSupport::Dependencies::autoload_paths << File.join(App.root, 'lib')
50
50
 
@@ -1,14 +1,16 @@
1
1
 
2
- # load gem rakes
2
+ task :environment do
3
+ require File.join(App.root, %w{config environment})
4
+ end
3
5
 
6
+ # load gem rakes
4
7
  Dir["#{File.dirname(__FILE__)}/tasks/*.{rb,rake}"].each do |f|
5
8
  load f
6
9
  end
7
10
 
8
-
9
11
  # load app rakes
10
12
  if defined?(App)
11
13
  Dir["#{App.root}/lib/rake_tasks/*.{rb,rake}"].each do |f|
12
14
  load f
13
15
  end
14
- end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyApp
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/ruby-app.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
 
8
8
  s.authors = ["Makarchev Konstantin"]
9
9
 
10
- s.description = %q{Little ruby application template. For light ruby apps (daemons, EM-apps, ...)}
10
+ s.description = %q{Little ruby application template. For creates light ruby apps (daemons, EventMachine-apps, ...). Supports bundler, environments, rails dirs tree.}
11
11
  s.summary = %q{Ruby application template}
12
12
 
13
13
  s.email = %q{kostya27@gmail.com}
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ class Application
5
+ def self.root
6
+ File.join(File.dirname(__FILE__), %w(..))
7
+ end
8
+ end
9
+
10
+ require 'ruby-app/boot'
@@ -1,14 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), %w{ boot })
3
3
 
4
4
  ENV['APP_ENV'] = 'test3'
5
5
 
6
- class Application
7
- def self.root
8
- File.join(File.dirname(__FILE__), %w(..))
9
- end
10
- end
11
-
12
6
  $:.unshift(File.join(File.dirname(__FILE__), %w{.. .. .. lib}))
13
7
  require 'ruby-app/environment'
14
8
 
metadata CHANGED
@@ -1,115 +1,120 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-app
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Makarchev Konstantin
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-06-19 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-06-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rake
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
38
25
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
46
38
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: thor
50
39
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
52
41
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: thor
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
60
54
  type: :runtime
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: bundler
64
55
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
66
65
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 3
71
- segments:
72
- - 0
73
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
74
70
  type: :runtime
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: rspec
78
71
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
80
73
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
88
86
  type: :development
89
- version_requirements: *id005
90
- - !ruby/object:Gem::Dependency
91
- name: rake
92
87
  prerelease: false
93
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
94
89
  none: false
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- hash: 3
99
- segments:
100
- - 0
101
- version: "0"
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
102
  type: :development
103
- version_requirements: *id006
104
- description: Little ruby application template. For light ruby apps (daemons, EM-apps, ...)
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Little ruby application template. For creates light ruby apps (daemons,
111
+ EventMachine-apps, ...). Supports bundler, environments, rails dirs tree.
105
112
  email: kostya27@gmail.com
106
- executables:
113
+ executables:
107
114
  - ruby-app
108
115
  extensions: []
109
-
110
116
  extra_rdoc_files: []
111
-
112
- files:
117
+ files:
113
118
  - .gitignore
114
119
  - Gemfile
115
120
  - LICENSE
@@ -121,22 +126,24 @@ files:
121
126
  - generator/Rakefile
122
127
  - generator/app/models/.gitkeep
123
128
  - generator/bin/dummy
129
+ - generator/config/boot.rb
124
130
  - generator/config/config.rb
125
131
  - generator/config/environment.rb
126
132
  - generator/config/environments/development.rb
127
133
  - generator/config/environments/production.rb
128
134
  - generator/config/environments/test.rb
129
135
  - generator/config/initializers/.gitkeep
130
- - generator/lib/application.rb
136
+ - generator/lib/application.rb.tt
131
137
  - generator/lib/rake_tasks/.gitkeep
132
- - generator/spec/spec1_spec.rb
138
+ - generator/spec/spec1_spec.rb.tt
133
139
  - generator/spec/spec_helper.rb
134
140
  - lib/ruby-app/application.rb
141
+ - lib/ruby-app/boot.rb
135
142
  - lib/ruby-app/common_config.rb
136
143
  - lib/ruby-app/default_config.rb
137
144
  - lib/ruby-app/environment.rb
138
145
  - lib/ruby-app/local_logger.rb
139
- - lib/ruby-app/tasks.rb
146
+ - lib/ruby-app/tasks.rake
140
147
  - lib/ruby-app/tasks/rspec.rake
141
148
  - lib/ruby-app/version.rb
142
149
  - ruby-app.gemspec
@@ -147,6 +154,7 @@ files:
147
154
  - spec/test_app/app/models/2.rb
148
155
  - spec/test_app/app/models/3.rb
149
156
  - spec/test_app/bin/.gitkeep
157
+ - spec/test_app/config/boot.rb
150
158
  - spec/test_app/config/config.rb
151
159
  - spec/test_app/config/environment.rb
152
160
  - spec/test_app/config/environments/development.rb
@@ -160,36 +168,26 @@ files:
160
168
  - spec/test_app/lib/application.rb
161
169
  homepage: http://github.com/kostya/ruby-app
162
170
  licenses: []
163
-
164
171
  post_install_message:
165
172
  rdoc_options: []
166
-
167
- require_paths:
173
+ require_paths:
168
174
  - lib
169
- required_ruby_version: !ruby/object:Gem::Requirement
175
+ required_ruby_version: !ruby/object:Gem::Requirement
170
176
  none: false
171
- requirements:
172
- - - ">="
173
- - !ruby/object:Gem::Version
174
- hash: 3
175
- segments:
176
- - 0
177
- version: "0"
178
- required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
182
  none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- hash: 3
184
- segments:
185
- - 0
186
- version: "0"
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
187
  requirements: []
188
-
189
188
  rubyforge_project:
190
189
  rubygems_version: 1.8.24
191
190
  signing_key:
192
191
  specification_version: 3
193
192
  summary: Ruby application template
194
193
  test_files: []
195
-