xing-framework 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/bin/xing-rvm-setup-env +8 -0
- data/default_configuration/base_app/.bibliotech/config.yaml +12 -0
- data/default_configuration/base_app/.codeclimate.yml +36 -0
- data/default_configuration/base_app/.csslintrc +2 -0
- data/default_configuration/base_app/.eslintignore +1 -0
- data/default_configuration/base_app/.eslintrc +213 -0
- data/default_configuration/base_app/.git/tags +183 -0
- data/default_configuration/base_app/.pivotal-brancher/config.yaml +1 -0
- data/default_configuration/base_app/.rubocop.yml +1168 -0
- data/default_configuration/base_app/.ruby-version +1 -0
- data/default_configuration/base_app/API_DOC/.keep +0 -0
- data/default_configuration/base_app/Gemfile.lock +4 -4
- data/default_configuration/base_app/Rakefile +3 -1
- data/default_configuration/base_app/backend/.pivotal-brancher/config.yaml +2 -0
- data/default_configuration/base_app/backend/.ruby-gemset.example +1 -0
- data/default_configuration/base_app/backend/.ruby-version +1 -0
- data/default_configuration/base_app/backend/.ruby-version.06.05.2015-10:38:25 +1 -0
- data/default_configuration/base_app/backend/.ruby-version.example +1 -0
- data/default_configuration/base_app/backend/app/mappers/.gitkeep +0 -0
- data/default_configuration/base_app/backend/app/serializers/.gitkeep +0 -0
- data/default_configuration/base_app/backend/app/workers/.gitkeep +0 -0
- data/default_configuration/base_app/backend/db/migrate/.gitkeep +0 -0
- data/default_configuration/base_app/backend/lib/tasks/.gitkeep +0 -0
- data/default_configuration/base_app/backend/spec/controllers/.gitkeep +0 -0
- data/default_configuration/base_app/backend/spec/mappers/.gitkeep +0 -0
- data/default_configuration/base_app/backend/spec/routing/.gitkeep +0 -0
- data/default_configuration/base_app/backend/spec/serializers/.gitkeep +0 -0
- data/default_configuration/base_app/config/deploy.rb +24 -7
- data/default_configuration/base_app/frontend/.jshintrc +15 -0
- data/default_configuration/base_app/frontend/.pivotal-brancher/config.yaml +1 -0
- data/default_configuration/base_app/frontend/.ruby-version +1 -0
- data/default_configuration/base_app/frontend/.travis.yml +12 -0
- data/default_configuration/base_app/frontend/src/common/resources/.gitkeep +0 -0
- data/default_configuration/templates/backend/config/database.yml +22 -0
- data/default_configuration/templates/backend/config/database.yml.ci +9 -0
- data/default_configuration/templates/backend/config/database.yml.example +22 -0
- data/default_configuration/templates/backend/config/secrets.yml +57 -0
- data/default_configuration/templates/backend/config/secrets.yml.ci +21 -0
- data/default_configuration/templates/backend/config/secrets.yml.example +57 -0
- data/default_configuration/templates/backend/gitattributes +1 -0
- data/default_configuration/templates/backend/gitignore +46 -0
- data/default_configuration/templates/frontend/.gitattributes +1 -0
- data/default_configuration/templates/frontend/.gitignore +12 -0
- data/default_configuration/templates/frontend/gitattributes +1 -0
- data/default_configuration/templates/frontend/gitignore +12 -0
- data/default_configuration/templates/gitignore +12 -0
- data/lib/xing/cli/generators/new_project.rb +98 -20
- data/lib/xing/cli.rb +3 -1
- data/spec/cli/generators/new_project_spec.rb +38 -0
- data/spec/cli_spec.rb +28 -0
- metadata +62 -3
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2
|
File without changes
|
@@ -79,14 +79,14 @@ GEM
|
|
79
79
|
tilt (> 0)
|
80
80
|
valise (~> 1.1)
|
81
81
|
mime-types (2.6.1)
|
82
|
-
|
82
|
+
mini_portile2 (2.0.0)
|
83
83
|
minitest (5.7.0)
|
84
84
|
multi_json (1.11.0)
|
85
85
|
net-scp (1.2.1)
|
86
86
|
net-ssh (>= 2.6.5)
|
87
87
|
net-ssh (2.9.2)
|
88
|
-
nokogiri (1.6.
|
89
|
-
|
88
|
+
nokogiri (1.6.7.1)
|
89
|
+
mini_portile2 (~> 2.0.0.rc2)
|
90
90
|
rack (1.6.4)
|
91
91
|
rack-test (0.6.3)
|
92
92
|
rack (>= 1.0)
|
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
tzinfo (1.2.2)
|
136
136
|
thread_safe (~> 0.1)
|
137
137
|
valise (1.2.0)
|
138
|
-
xing-root (0.0.
|
138
|
+
xing-root (0.0.9)
|
139
139
|
caliph (~> 0.3)
|
140
140
|
edict (< 1.0)
|
141
141
|
mattock (~> 0.10)
|
@@ -8,8 +8,10 @@ Xing::Tasks::Build.new
|
|
8
8
|
Xing::Tasks::Develop.new
|
9
9
|
Xing::Tasks::Frontend.new
|
10
10
|
Xing::Tasks::Spec.new
|
11
|
+
Xing::Tasks::Initialize.new
|
11
12
|
|
12
|
-
|
13
|
+
desc "setup database"
|
14
|
+
task :initialize => ['initialize:all']
|
13
15
|
desc "The whole shebang"
|
14
16
|
task :build => [:check_dependencies, 'build:all']
|
15
17
|
|
@@ -0,0 +1 @@
|
|
1
|
+
cms2
|
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2
|
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2p95
|
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# config valid only for Capistrano 3.1
|
2
2
|
lock '3.4'
|
3
3
|
|
4
|
-
set :repo_url, 'git@
|
4
|
+
set :repo_url, 'git@github.com:example/example.git'
|
5
5
|
set :pty, true
|
6
6
|
|
7
7
|
# Default value for :format is :pretty
|
@@ -43,6 +43,7 @@ set :required_writeable_files, %w{
|
|
43
43
|
# set :keep_releases, 5
|
44
44
|
|
45
45
|
set :backend_path, proc{ File::join(release_path, "backend") }
|
46
|
+
set :frontend_path, proc{ File::join(release_path, "frontend") }
|
46
47
|
set :backend_shared, proc{ File::join(shared_path, "backend") }
|
47
48
|
set :webserver_group, "apache"
|
48
49
|
set :webserver_user, "apache"
|
@@ -58,7 +59,7 @@ namespace :deploy do
|
|
58
59
|
on roles(:app), :in => :parallel do
|
59
60
|
within release_path do
|
60
61
|
with :rails_env => fetch(:stage) do
|
61
|
-
rake "build"
|
62
|
+
execute "bundle", "exec", "rake", "build"
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
@@ -67,17 +68,33 @@ namespace :deploy do
|
|
67
68
|
|
68
69
|
task :bundle_config do
|
69
70
|
on roles(:app), :in => :parallel do
|
70
|
-
|
71
|
-
|
71
|
+
[fetch(:backend_path), fetch(:frontend_path), fetch(:release_path)].each do |path|
|
72
|
+
|
73
|
+
execute "mkdir -p #{path}/.bundle"
|
74
|
+
bundle_config = StringIO.new(<<-EOC)
|
72
75
|
---
|
73
76
|
BUNDLE_FROZEN: '1'
|
74
77
|
BUNDLE_PATH: "#{File::join(shared_path, "backend/vendor/bundle")}"
|
75
78
|
BUNDLE_DISABLE_SHARED_GEMS: '1'
|
76
|
-
|
77
|
-
|
79
|
+
EOC
|
80
|
+
upload! bundle_config, "#{path}/.bundle/config"
|
81
|
+
end
|
78
82
|
end
|
79
83
|
end
|
80
|
-
|
84
|
+
|
85
|
+
task :bundle_root do
|
86
|
+
on roles(:app), :in => :parallel do
|
87
|
+
within release_path do
|
88
|
+
as(:root) do
|
89
|
+
execute "bundle", "install"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
before :bundle_root, :bundle_config
|
96
|
+
|
97
|
+
before :build, :bundle_root
|
81
98
|
|
82
99
|
task :perms do
|
83
100
|
on roles(:app), :in => :parallel do
|
@@ -0,0 +1 @@
|
|
1
|
+
project: 1154118
|
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
development: &development
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
database: {{app_name}}_dev
|
5
|
+
# username: postgres
|
6
|
+
pool: 5
|
7
|
+
host: 127.0.0.1
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
<<: *development
|
14
|
+
database: {{app_name}}_test
|
15
|
+
|
16
|
+
production:
|
17
|
+
adapter: postgresql
|
18
|
+
encoding: unicode
|
19
|
+
database: {{app_name}}_dev
|
20
|
+
# username: postgres
|
21
|
+
pool: 5
|
22
|
+
host: 127.0.0.1
|
@@ -0,0 +1,22 @@
|
|
1
|
+
development: &development
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
database: {{app_name}}_dev
|
5
|
+
# username: postgres
|
6
|
+
pool: 5
|
7
|
+
host: 127.0.0.1
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
<<: *development
|
14
|
+
database: {{app_name}}_test
|
15
|
+
|
16
|
+
production:
|
17
|
+
adapter: postgresql
|
18
|
+
encoding: unicode
|
19
|
+
database: {{app_name}}_dev
|
20
|
+
# username: postgres
|
21
|
+
pool: 5
|
22
|
+
host: 127.0.0.1
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: {{dev_secret_key_base}}
|
15
|
+
smtp:
|
16
|
+
address: smtp.CHANGEME.com
|
17
|
+
port: 587
|
18
|
+
domain: {{app_name}}.com
|
19
|
+
user_name: admin@{{app_name}}.com
|
20
|
+
password: xxxxxxxx
|
21
|
+
email:
|
22
|
+
from: admin@{{app_name}}.com
|
23
|
+
reply_to: admin@{{app_name}}.com
|
24
|
+
# Destination for emails in dev environment
|
25
|
+
# this should be left blank in production
|
26
|
+
test: test@{{app_name}}.com
|
27
|
+
from_domain: 'localhost:3000'
|
28
|
+
snapshot_server:
|
29
|
+
url: https://www.notaserver.com
|
30
|
+
user: user
|
31
|
+
password: password
|
32
|
+
sitemap_base_url: http://localhost:3000/
|
33
|
+
asset_host: http://localhost:3000/
|
34
|
+
|
35
|
+
test:
|
36
|
+
secret_key_base: {{test_secret_key_base}}
|
37
|
+
smtp:
|
38
|
+
address: smtp.{{app_name}}.com
|
39
|
+
port: 587
|
40
|
+
domain: {{app_name}}.com
|
41
|
+
user_name: admin@{{app_name}}.com
|
42
|
+
password: xxxxxxxx
|
43
|
+
email:
|
44
|
+
from: admin@{{app_name}}.com
|
45
|
+
reply_to: admin@{{app_name}}.com
|
46
|
+
from_domain: 'example.com'
|
47
|
+
snapshot_server:
|
48
|
+
url: https://www.notaserver.com
|
49
|
+
user: user
|
50
|
+
password: password
|
51
|
+
sitemap_base_url: http://localhost:3000/
|
52
|
+
asset_host: http://localhost:3000/
|
53
|
+
|
54
|
+
# Do not keep production secrets in the repository,
|
55
|
+
# instead read values from the environment.
|
56
|
+
production:
|
57
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
test:
|
2
|
+
secret_key_base: {{test_secret_key_base}}
|
3
|
+
smtp:
|
4
|
+
address: smtp.CHANGEME.com
|
5
|
+
port: 587
|
6
|
+
domain: {{app_name}}.com
|
7
|
+
user_name: admin@{{app_name}}.com
|
8
|
+
password: xxxxxxxx
|
9
|
+
email:
|
10
|
+
from: admin@{{app_name}}.com
|
11
|
+
reply_to: admin@{{app_name}}.com
|
12
|
+
from_domain: 'example.com'
|
13
|
+
snapshot_server:
|
14
|
+
url: https://www.notaserver.com
|
15
|
+
user: user
|
16
|
+
password: password
|
17
|
+
sitemap_base_url: http://localhost:3000/
|
18
|
+
asset_host: http://localhost:3000/
|
19
|
+
|
20
|
+
development:
|
21
|
+
<<: *test
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: {{dev_secret_key_base}}
|
15
|
+
smtp:
|
16
|
+
address: smtp.CHANGEME.com
|
17
|
+
port: 587
|
18
|
+
domain: {{app_name}}.com
|
19
|
+
user_name: admin@{{app_name}}.com
|
20
|
+
password: xxxxxxxx
|
21
|
+
email:
|
22
|
+
from: admin@{{app_name}}.com
|
23
|
+
reply_to: admin@{{app_name}}.com
|
24
|
+
# Destination for emails in dev environment
|
25
|
+
# this should be left blank in production
|
26
|
+
test: test@{{app_name}}.com
|
27
|
+
from_domain: 'localhost:3000'
|
28
|
+
snapshot_server:
|
29
|
+
url: https://www.notaserver.com
|
30
|
+
user: user
|
31
|
+
password: password
|
32
|
+
sitemap_base_url: http://localhost:3000/
|
33
|
+
asset_host: http://localhost:3000/
|
34
|
+
|
35
|
+
test:
|
36
|
+
secret_key_base: {{test_secret_key_base}}
|
37
|
+
smtp:
|
38
|
+
address: smtp.{{app_name}}.com
|
39
|
+
port: 587
|
40
|
+
domain: {{app_name}}.com
|
41
|
+
user_name: admin@{{app_name}}.com
|
42
|
+
password: xxxxxxxx
|
43
|
+
email:
|
44
|
+
from: admin@{{app_name}}.com
|
45
|
+
reply_to: admin@{{app_name}}.com
|
46
|
+
from_domain: 'example.com'
|
47
|
+
snapshot_server:
|
48
|
+
url: https://www.notaserver.com
|
49
|
+
user: user
|
50
|
+
password: password
|
51
|
+
sitemap_base_url: http://localhost:3000/
|
52
|
+
asset_host: http://localhost:3000/
|
53
|
+
|
54
|
+
# Do not keep production secrets in the repository,
|
55
|
+
# instead read values from the environment.
|
56
|
+
production:
|
57
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock -merge
|
@@ -0,0 +1,46 @@
|
|
1
|
+
log/*
|
2
|
+
screenlog.*
|
3
|
+
tmp/
|
4
|
+
.dotest/
|
5
|
+
config/initializers/secret_token.rb
|
6
|
+
db/schema.sql
|
7
|
+
db/schema.rb
|
8
|
+
db/*.sqlite3*
|
9
|
+
db_backups/*
|
10
|
+
database.yml
|
11
|
+
public/stylesheets/*.css
|
12
|
+
!public/stylesheets/reset.css
|
13
|
+
public/javascripts/all.js
|
14
|
+
public/assets/source_maps/*
|
15
|
+
public/system
|
16
|
+
uuid.state
|
17
|
+
nbproject*
|
18
|
+
index/*
|
19
|
+
identifier
|
20
|
+
secret
|
21
|
+
last_run
|
22
|
+
.project
|
23
|
+
.#*
|
24
|
+
\#*
|
25
|
+
*~
|
26
|
+
vendor/**/**/doc/*
|
27
|
+
vendor/plugins/footnotes/*
|
28
|
+
rsa_key*
|
29
|
+
*.pem
|
30
|
+
*.key
|
31
|
+
system/datas/*
|
32
|
+
sqldumps/*
|
33
|
+
capybara*.html
|
34
|
+
.rspec
|
35
|
+
.simplecov
|
36
|
+
public/sitemap.xml
|
37
|
+
*.sublime-project
|
38
|
+
*.sublime-workspace
|
39
|
+
coverage/
|
40
|
+
errors.err
|
41
|
+
.cadre/
|
42
|
+
spec/support/cadre.rb
|
43
|
+
secrets.yml
|
44
|
+
public/frontend_snapshots
|
45
|
+
spec/fixtures/sitemap_scratch
|
46
|
+
dump.rdb
|
@@ -0,0 +1 @@
|
|
1
|
+
vendor/**/* diff=rawtext
|
@@ -0,0 +1 @@
|
|
1
|
+
vendor/**/* diff=rawtext
|
@@ -1,12 +1,15 @@
|
|
1
1
|
require 'caliph'
|
2
2
|
require 'bundler'
|
3
|
+
require 'architecture/dsl'
|
3
4
|
|
4
5
|
module Xing::CLI::Generators
|
5
6
|
class NewProject
|
6
7
|
include Caliph::CommandLineDSL
|
8
|
+
include Architecture
|
7
9
|
|
8
10
|
attr_accessor :target_name
|
9
11
|
attr_accessor :ruby_version
|
12
|
+
attr_accessor :with_gemset
|
10
13
|
|
11
14
|
def shell
|
12
15
|
@shell ||= Caliph.new
|
@@ -27,40 +30,115 @@ module Xing::CLI::Generators
|
|
27
30
|
write_ruby_version "frontend"
|
28
31
|
write_ruby_version "backend"
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
if with_gemset
|
34
|
+
write_ruby_gemset
|
35
|
+
write_ruby_gemset "frontend"
|
36
|
+
write_ruby_gemset "backend"
|
37
|
+
end
|
38
|
+
|
39
|
+
write_database_yml
|
40
|
+
write_secrets_yml
|
34
41
|
|
35
|
-
|
36
|
-
cmd("bundle", "install") &
|
37
|
-
cmd("npm", "install")).must_succeed!
|
42
|
+
write_git_control_files
|
38
43
|
|
39
|
-
|
40
|
-
|
41
|
-
|
44
|
+
Bundler.with_clean_env do
|
45
|
+
if with_gemset
|
46
|
+
bundler = shell.run(setup_env_command &
|
47
|
+
cmd("cd", target_name) &
|
48
|
+
cmd("gem", "install", "bundler"))
|
42
49
|
end
|
50
|
+
|
51
|
+
shell.run(
|
52
|
+
setup_env_command &
|
53
|
+
cmd("cd", target_name) &
|
54
|
+
cmd("bundle", "install")).must_succeed!
|
55
|
+
|
56
|
+
shell.run(
|
57
|
+
setup_env_command &
|
58
|
+
cmd("cd", File.join(target_name, "frontend")) &
|
59
|
+
cmd("bundle", "install") &
|
60
|
+
cmd("npm", "install")).must_succeed!
|
61
|
+
|
62
|
+
shell.run(
|
63
|
+
setup_env_command &
|
64
|
+
cmd("cd", File.join(target_name, "backend")) &
|
65
|
+
cmd("bundle", "install") &
|
66
|
+
cmd("rake", "xing:install:migrations")).must_succeed!
|
43
67
|
end
|
68
|
+
|
44
69
|
end
|
45
70
|
|
46
|
-
def
|
71
|
+
def write_database_yml
|
47
72
|
dbyml_path = File.join(target_name, "backend", "config", "database.yml")
|
48
|
-
if File.exist?(dbyml_path)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
73
|
+
if !File.exist?(dbyml_path)
|
74
|
+
with_templates do |arc|
|
75
|
+
arc.copy file: "backend/config/database.yml", context: { app_name: target_name }
|
76
|
+
arc.copy file: "backend/config/database.yml.example", context: { app_name: target_name }
|
77
|
+
arc.copy file: "backend/config/database.yml.ci", context: { app_name: target_name }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def write_git_control_files
|
83
|
+
with_templates do |arc|
|
84
|
+
arc.copy file: "gitignore", as: ".gitignore"
|
85
|
+
arc.copy file: "backend/gitignore", as:"backend/.gitignore"
|
86
|
+
arc.copy file: "frontend/gitignore", as: "frontend/.gitignore"
|
87
|
+
arc.copy file: "gitattributes", as: ".gitattributes"
|
88
|
+
arc.copy file: "backend/gitattributes", as: "backend/.gitattributes"
|
89
|
+
arc.copy file: "frontend/gitattributes", as: "frontend/.gitattributes"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def write_secrets_yml
|
94
|
+
secyml_path = File.join(target_name, "backend", "config", "secrets.yml")
|
95
|
+
if !File.exist?(secyml_path)
|
96
|
+
context = {
|
97
|
+
dev_secret_key_base: SecureRandom.hex(64),
|
98
|
+
test_secret_key_base: SecureRandom.hex(64),
|
99
|
+
app_name: target_name
|
100
|
+
}
|
101
|
+
with_templates do |arc|
|
102
|
+
arc.copy file: "backend/config/secrets.yml", context: context
|
103
|
+
arc.copy file: "backend/config/secrets.yml.example", context: context
|
104
|
+
arc.copy file: "backend/config/secrets.yml.ci", context: context
|
56
105
|
end
|
57
106
|
end
|
58
107
|
end
|
59
108
|
|
109
|
+
def with_templates
|
110
|
+
architecture source: File.expand_path('../../../../../default_configuration/templates/', __FILE__) , destination: target_name do |arc|
|
111
|
+
yield(arc)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def write_file_to(name, subdir)
|
116
|
+
File.open(File.join(*([target_name] + subdir + [name])), "w") do |rv|
|
117
|
+
yield(rv)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
60
121
|
def write_ruby_version(*subdir)
|
61
|
-
|
122
|
+
write_file_to(".ruby-version", subdir) do |rv|
|
62
123
|
rv.write(ruby_version)
|
63
124
|
end
|
64
125
|
end
|
126
|
+
|
127
|
+
def write_ruby_gemset(*subdir)
|
128
|
+
write_file_to(".ruby-gemset", subdir) do |rv|
|
129
|
+
rv.write(target_name)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def setup_env_command
|
134
|
+
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
|
135
|
+
args = [".", File.expand_path('../../../../../bin/xing-rvm-setup-env', __FILE__), ruby_version]
|
136
|
+
args[3] = target_name if with_gemset
|
137
|
+
cmd(*args)
|
138
|
+
else
|
139
|
+
# put other rb environemnt scripts here
|
140
|
+
cmd(":")
|
141
|
+
end
|
142
|
+
end
|
65
143
|
end
|
66
144
|
end
|
data/lib/xing/cli.rb
CHANGED
@@ -37,17 +37,19 @@ Global Options:
|
|
37
37
|
opts = Trollop::options do
|
38
38
|
opt :cms, "Include content management architecture. (coming soon)"
|
39
39
|
opt :ruby_version, "Set the ruby version used for the new project (e.g. 2.2)", :type => :string
|
40
|
+
opt :with_gemset, "Define a gemset for use with RVM"
|
40
41
|
stop_on ['name']
|
41
42
|
end
|
42
43
|
name = ARGV.shift
|
43
44
|
Trollop::die "Please specify a project name with 'xing new <name>'" unless name
|
44
45
|
Trollop::die "The CMS option is not yet implemented." if opts[:cms]
|
45
46
|
if opts[:ruby_version].nil?
|
46
|
-
opts[:ruby_version] =
|
47
|
+
opts[:ruby_version] = RUBY_VERSION
|
47
48
|
end
|
48
49
|
generator = Xing::CLI::Generators::NewProject.new
|
49
50
|
generator.target_name = name
|
50
51
|
generator.ruby_version = opts[:ruby_version]
|
52
|
+
generator.with_gemset = opts[:with_gemset]
|
51
53
|
generator.generate
|
52
54
|
else
|
53
55
|
Trollop::die "Unknown command. Supported commands are [" + SUPPORTED_VERBS.join(" ") + "]"
|