ramix 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ramix/builder.rb +6 -2
- data/lib/ramix/template.rb +5 -3
- data/lib/ramix/version.rb +1 -1
- data/ramix.gemspec +2 -2
- data/recipes/authentication.rb +1 -0
- data/recipes/china.rb +2 -1
- data/recipes/home.rb +0 -2
- data/recipes/nosql.rb +3 -2
- data/recipes/omniauth.rb +1 -13
- metadata +4 -4
data/lib/ramix/builder.rb
CHANGED
@@ -12,7 +12,7 @@ module Ramix
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def import(template, *args)
|
15
|
-
@import << proc { template.output(*args) }
|
15
|
+
@import << [template.order, proc { template.output(*args) }]
|
16
16
|
end
|
17
17
|
|
18
18
|
# Write some useful methods and the content of recipe in the file.
|
@@ -23,7 +23,7 @@ module Ramix
|
|
23
23
|
file.write preparation_methods
|
24
24
|
file.write rails_version
|
25
25
|
file.write callback_functions
|
26
|
-
|
26
|
+
ordered_templates.each{ |template| file.write template[1].call }
|
27
27
|
file.write before_callbacks
|
28
28
|
file.write callbacks
|
29
29
|
end
|
@@ -40,6 +40,10 @@ module Ramix
|
|
40
40
|
Tempfile.new('template').path
|
41
41
|
end
|
42
42
|
|
43
|
+
def ordered_templates
|
44
|
+
@import.sort_by{ |t| t[0] }
|
45
|
+
end
|
46
|
+
|
43
47
|
include Ramix::Helpers
|
44
48
|
|
45
49
|
end
|
data/lib/ramix/template.rb
CHANGED
@@ -23,6 +23,10 @@ module Ramix
|
|
23
23
|
@attribute['name'] || @name
|
24
24
|
end
|
25
25
|
|
26
|
+
def order
|
27
|
+
@attribute['order'] || 0
|
28
|
+
end
|
29
|
+
|
26
30
|
ATTRIBUTE.each do |attr|
|
27
31
|
class_eval <<-RUBY
|
28
32
|
def #{attr}
|
@@ -32,10 +36,8 @@ module Ramix
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def output(*args)
|
35
|
-
out_buffer = "# >====================== [#{name}] =======================<\n\n"
|
36
|
-
out_buffer << "instance_variable_set '@#{name}', #{args.dup.pop.inspect}\n\n" if args
|
37
39
|
<<-OUTPUT
|
38
|
-
#{
|
40
|
+
instance_variable_set '@#{name}', #{args.dup.pop.inspect}
|
39
41
|
#{@output}
|
40
42
|
OUTPUT
|
41
43
|
end
|
data/lib/ramix/version.rb
CHANGED
data/ramix.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ramix}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Thierry Zires}]
|
12
|
-
s.date = %q{2012-02-
|
12
|
+
s.date = %q{2012-02-17}
|
13
13
|
s.description = %q{Ramix is a command-line tool for initializing a new rails application.Just the same as rails but adding more additional options.}
|
14
14
|
s.email = %q{zshuaibin@gmail.com}
|
15
15
|
s.executables = [%q{ramix}]
|
data/recipes/authentication.rb
CHANGED
data/recipes/china.rb
CHANGED
@@ -7,4 +7,5 @@ default: false
|
|
7
7
|
group: 'source'
|
8
8
|
---
|
9
9
|
say_wizard "Replace gemfile source"
|
10
|
-
gsub_file 'Gemfile', "source 'http://rubygems.org'", "source 'http://ruby.taobao.org/'"
|
10
|
+
gsub_file 'Gemfile', "source 'http://rubygems.org'", "source 'http://ruby.taobao.org/'"
|
11
|
+
gsub_file 'Gemfile', "source 'https://rubygems.org'", "source 'http://ruby.taobao.org/'"
|
data/recipes/home.rb
CHANGED
@@ -20,8 +20,6 @@ after_bundler do
|
|
20
20
|
gsub_file 'config/routes.rb', /get \"#{@home}\/index\"/, %Q(root :to => "#{@home}#index")
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
23
|
#DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from <top (required)> at /mnt/projects/ruby-china/config/application.rb:13)
|
26
24
|
#:public is no longer used to avoid overloading Module#public, use :public_folder instead
|
27
25
|
# from /home/zires/.rvm/gems/ruby-1.9.3-preview1/gems/resque-1.19.0/lib/resque/server.rb:12:in `<class:Server>'
|
data/recipes/nosql.rb
CHANGED
@@ -6,6 +6,7 @@ dependence: ['-O']
|
|
6
6
|
type: 'string'
|
7
7
|
default: false
|
8
8
|
group: 'nosql'
|
9
|
+
order: 1
|
9
10
|
---
|
10
11
|
|
11
12
|
case @nosql
|
@@ -13,10 +14,10 @@ when 'mongoid'
|
|
13
14
|
say_wizard "Install mongoid gem"
|
14
15
|
case rails_version
|
15
16
|
when /3.0/ then gem 'mongoid', '2.2.5'
|
16
|
-
when /3.1/, /3.2/ then gem 'mongoid', '2.4
|
17
|
+
when /3.1/, /3.2/ then gem 'mongoid', '~> 2.4'
|
17
18
|
end
|
18
19
|
|
19
|
-
gem 'bson_ext', '1.5
|
20
|
+
gem 'bson_ext', '~> 1.5'
|
20
21
|
|
21
22
|
after_bundler do
|
22
23
|
say_wizard "Generate mongoid config file and remove database.yml"
|
data/recipes/omniauth.rb
CHANGED
@@ -5,6 +5,7 @@ desc: 'OmniAuth is a flexible authentication system utilizing Rack middleware.'
|
|
5
5
|
type: 'array'
|
6
6
|
group: 'authentication'
|
7
7
|
default: ['google', 'facebook', 'twitter']
|
8
|
+
order: 3
|
8
9
|
---
|
9
10
|
|
10
11
|
if @omniauth == ['china']
|
@@ -25,23 +26,10 @@ gem 'omniauth'
|
|
25
26
|
end
|
26
27
|
|
27
28
|
after_bundler do
|
28
|
-
#say_wizard "Generate authorization model"
|
29
|
-
#generate :model, "Authorization provider:string user_id:integer uid:string -f"
|
30
29
|
|
31
30
|
case @auth
|
32
31
|
# For devise
|
33
32
|
when 'devise'
|
34
|
-
if @nosql
|
35
|
-
# == Mongoid
|
36
|
-
begin
|
37
|
-
inject_into_class "app/models/user.rb", 'User', " embeds_many :authorizations\n"
|
38
|
-
#inject_into_class "app/models/authorization.rb", 'Authorization', " embedded_in :user, :inverse_of => :authorizations\n"
|
39
|
-
end if @nosql == 'mongoid'
|
40
|
-
else
|
41
|
-
# == ActiveRecord
|
42
|
-
inject_into_class "app/models/user.rb", 'User', " has_many :authorizations\n"
|
43
|
-
#inject_into_class "app/models/authorization.rb", 'Authorization', " belongs_to :user\n"
|
44
|
-
end
|
45
33
|
gsub_file 'app/models/user.rb', /:recoverable, :rememberable, :trackable, :validatable/, ':recoverable, :rememberable, :trackable, :validatable, :omniauthable'
|
46
34
|
|
47
35
|
insert_into_file 'config/initializers/devise.rb', :before => "# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'\n" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thierry Zires
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|