ruby-app 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/bin/ruby-app +32 -5
- data/generator/database.yml +1 -1
- data/generator/migration.rb.tt +8 -0
- data/lib/ruby-app/environment.rb +7 -7
- data/lib/ruby-app/version.rb +1 -1
- metadata +23 -22
data/README.md
CHANGED
@@ -7,10 +7,10 @@ Supports bundler, environments, rails dirs tree.
|
|
7
7
|
$ gem install ruby-app
|
8
8
|
|
9
9
|
|
10
|
-
$ ruby-app
|
11
|
-
$ cd
|
10
|
+
$ ruby-app new app
|
11
|
+
$ cd app && bundle
|
12
12
|
|
13
|
-
Run like:
|
13
|
+
Run like (default env is development):
|
14
14
|
|
15
15
|
$ ./bin/example
|
16
16
|
$ APP_ENV=production ./bin/example
|
@@ -18,5 +18,5 @@ Run like:
|
|
18
18
|
|
19
19
|
Generate app with ActiveRecord support:
|
20
20
|
|
21
|
-
$ ruby-app
|
21
|
+
$ ruby-app new app --ar
|
22
22
|
|
data/bin/ruby-app
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
+
require 'thor'
|
4
5
|
require 'thor/group'
|
5
6
|
|
6
|
-
class
|
7
|
+
class New < Thor::Group
|
7
8
|
include Thor::Actions
|
8
|
-
|
9
|
+
|
9
10
|
# Define arguments and options
|
10
11
|
argument :name
|
11
12
|
class_option :ar, :default => false
|
@@ -30,8 +31,8 @@ private
|
|
30
31
|
|
31
32
|
def self.source_root
|
32
33
|
File.join(File.dirname(__FILE__), %w{.. generator })
|
33
|
-
end
|
34
|
-
|
34
|
+
end
|
35
|
+
|
35
36
|
def base_name
|
36
37
|
File.basename(name)
|
37
38
|
end
|
@@ -39,7 +40,33 @@ private
|
|
39
40
|
def ar
|
40
41
|
options[:ar]
|
41
42
|
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class Migration < Thor::Group
|
47
|
+
include Thor::Actions
|
48
|
+
argument :name
|
49
|
+
|
50
|
+
def copy_migration
|
51
|
+
require 'active_support'
|
52
|
+
require 'active_support/inflector' unless ''.respond_to?(:underscore)
|
42
53
|
|
54
|
+
template("migration.rb.tt", "./db/migrate/#{migration_name}_#{name.underscore}.rb")
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.source_root
|
58
|
+
File.join(File.dirname(__FILE__), %w{.. generator })
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def migration_name
|
63
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class RubyApp < Thor
|
68
|
+
register New, :new, "new", "create new project [NAME]"
|
69
|
+
register Migration, :migration, "migration", "generate migration [NAME] for app with AR"
|
43
70
|
end
|
44
71
|
|
45
|
-
|
72
|
+
RubyApp.start
|
data/generator/database.yml
CHANGED
data/lib/ruby-app/environment.rb
CHANGED
@@ -36,13 +36,6 @@ end
|
|
36
36
|
# default config from app
|
37
37
|
require File.join(App.root, %w{config config})
|
38
38
|
|
39
|
-
# load initializers from other gems
|
40
|
-
unless App.initializer_paths.empty?
|
41
|
-
App.initializer_paths.flatten.each do |path|
|
42
|
-
require File.expand_path(path)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
39
|
# configs from app for env
|
47
40
|
begin
|
48
41
|
require File.join(App.root, %W( config environments #{App.env}))
|
@@ -65,6 +58,13 @@ end
|
|
65
58
|
# load initializers app
|
66
59
|
Dir["#{App.root}/config/initializers/*.rb"].each{ |x| load(x) }
|
67
60
|
|
61
|
+
# load initializers from other gems
|
62
|
+
unless App.initializer_paths.empty?
|
63
|
+
App.initializer_paths.flatten.each do |path|
|
64
|
+
require File.expand_path(path)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
68
|
# first load models app
|
69
69
|
Dir["#{App.root}/app/models/*.rb"].each{ |x| require x }
|
70
70
|
|
data/lib/ruby-app/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Makarchev Konstantin
|
@@ -15,11 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-06-
|
18
|
+
date: 2012-06-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
prerelease: false
|
21
|
+
type: :runtime
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -29,11 +28,11 @@ dependencies:
|
|
29
28
|
segments:
|
30
29
|
- 0
|
31
30
|
version: "0"
|
32
|
-
type: :runtime
|
33
31
|
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rake
|
36
32
|
prerelease: false
|
33
|
+
name: activesupport
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
type: :runtime
|
37
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
37
|
none: false
|
39
38
|
requirements:
|
@@ -43,11 +42,11 @@ dependencies:
|
|
43
42
|
segments:
|
44
43
|
- 0
|
45
44
|
version: "0"
|
46
|
-
type: :runtime
|
47
45
|
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: thor
|
50
46
|
prerelease: false
|
47
|
+
name: rake
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
type: :runtime
|
51
50
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
51
|
none: false
|
53
52
|
requirements:
|
@@ -57,11 +56,11 @@ dependencies:
|
|
57
56
|
segments:
|
58
57
|
- 0
|
59
58
|
version: "0"
|
60
|
-
type: :runtime
|
61
59
|
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: bundler
|
64
60
|
prerelease: false
|
61
|
+
name: thor
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
type: :runtime
|
65
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
65
|
none: false
|
67
66
|
requirements:
|
@@ -71,11 +70,11 @@ dependencies:
|
|
71
70
|
segments:
|
72
71
|
- 0
|
73
72
|
version: "0"
|
74
|
-
type: :runtime
|
75
73
|
version_requirements: *id004
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: rspec
|
78
74
|
prerelease: false
|
75
|
+
name: bundler
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
type: :development
|
79
78
|
requirement: &id005 !ruby/object:Gem::Requirement
|
80
79
|
none: false
|
81
80
|
requirements:
|
@@ -85,11 +84,11 @@ dependencies:
|
|
85
84
|
segments:
|
86
85
|
- 0
|
87
86
|
version: "0"
|
88
|
-
type: :development
|
89
87
|
version_requirements: *id005
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: rake
|
92
88
|
prerelease: false
|
89
|
+
name: rspec
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
type: :development
|
93
92
|
requirement: &id006 !ruby/object:Gem::Requirement
|
94
93
|
none: false
|
95
94
|
requirements:
|
@@ -99,8 +98,9 @@ dependencies:
|
|
99
98
|
segments:
|
100
99
|
- 0
|
101
100
|
version: "0"
|
102
|
-
type: :development
|
103
101
|
version_requirements: *id006
|
102
|
+
prerelease: false
|
103
|
+
name: rake
|
104
104
|
description: Little ruby application template. For creates light ruby apps (daemons, EventMachine-apps, ...). Supports bundler, environments, rails dirs tree.
|
105
105
|
email: kostya27@gmail.com
|
106
106
|
executables:
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- Rakefile
|
118
118
|
- bin/ruby-app
|
119
119
|
- generator/database.yml
|
120
|
+
- generator/migration.rb.tt
|
120
121
|
- generator/project/.gitignore.tt
|
121
122
|
- generator/project/Gemfile.tt
|
122
123
|
- generator/project/Rakefile.tt
|