locomotive_cmd 0.0.1
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.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +2 -0
- data/bin/locomotive +3 -0
- data/lib/locomotive_cmd/checker.rb +80 -0
- data/lib/locomotive_cmd/config/locomotive.yml +38 -0
- data/lib/locomotive_cmd/config.rb +13 -0
- data/lib/locomotive_cmd/installer.rb +282 -0
- data/lib/locomotive_cmd/mongo_checker.rb +19 -0
- data/lib/locomotive_cmd/templates/Gemfile +2 -0
- data/lib/locomotive_cmd/templates/README +26 -0
- data/lib/locomotive_cmd/templates/mongoid.yml +21 -0
- data/lib/locomotive_cmd/version.rb +5 -0
- data/lib/locomotive_cmd.rb +23 -0
- data/locomotive_cmd.gemspec +18 -0
- metadata +82 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Yannick Schutz
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# cmd
|
2
|
+
|
3
|
+
The command line binary tool
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install locomotive_cmd
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
In your terminal:
|
12
|
+
|
13
|
+
$ locomotive [command] [path] [options]
|
14
|
+
|
15
|
+
### Commands
|
16
|
+
* install : create a new app with locomotive
|
17
|
+
* check : check dependencies for locomotive
|
18
|
+
|
19
|
+
### path
|
20
|
+
The path to your rails application
|
21
|
+
|
22
|
+
### options
|
23
|
+
Only for installation!
|
24
|
+
|
25
|
+
* --verbose: verbose mode
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
34
|
+
|
35
|
+
|
36
|
+
## Main Developer
|
37
|
+
|
38
|
+
Yannick Schultz is the super nice and talented guy who developed the first version of that gem. You can find him on [Github](https://github.com/ys) and [Twitter](http://twitter.com/yann_ck).
|
39
|
+
|
40
|
+
## Contact
|
41
|
+
|
42
|
+
If you have any questions, please contact [did](mailto:did@locomotivecms.com) from [LocomotiveCMS](http://www.locomotivecms.com).
|
data/Rakefile
ADDED
data/bin/locomotive
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative 'config'
|
3
|
+
require_relative 'mongo_checker'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
if File.exists? File.join('.', 'script', 'rails')
|
7
|
+
Locomotive::Cmd::MongoChecker.start
|
8
|
+
Locomotive::Cmd::Config.set_env
|
9
|
+
require './config/environment'
|
10
|
+
require 'locomotive/engine'
|
11
|
+
end
|
12
|
+
|
13
|
+
class Locomotive::Cmd::Checker < Thor::Group
|
14
|
+
include Thor::Actions
|
15
|
+
|
16
|
+
desc 'Check software dependencies for Locomotive'
|
17
|
+
|
18
|
+
def verify_rails_path
|
19
|
+
unless File.exists? File.join('.', 'script', 'rails')
|
20
|
+
say "Current folder is not a Rails application", :red
|
21
|
+
exit -1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def verify_ruby
|
26
|
+
ruby_version = `ruby -v`
|
27
|
+
if ruby_version.include? '1.9'
|
28
|
+
say 'ruby version: ✔', :green
|
29
|
+
else
|
30
|
+
say "ruby version: ✗ (needed 1.9 at least got #{ruby_version}", :red
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def verify_rails
|
35
|
+
rails_version = `rails -v`
|
36
|
+
if rails_version.include? '3.2'
|
37
|
+
say 'rails version: ✔', :green
|
38
|
+
else
|
39
|
+
say "rails version: ✗ (needed 3.2 at least got #{rails_version}", :red
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def check_locomotive_version
|
44
|
+
if const_exists?('Locomotive')
|
45
|
+
locomotive_version = Locomotive::VERSION
|
46
|
+
default_version = Locomotive::Cmd::Config['versions']['default']
|
47
|
+
if locomotive_version == default_version
|
48
|
+
say 'Locomotive is up to date: ✔', :green
|
49
|
+
else
|
50
|
+
say "Locomotive is not up to date: ✗ (current version: #{default_version})", :red
|
51
|
+
end
|
52
|
+
else
|
53
|
+
say 'Locomotive installation: ✗ (please add "gem \'locomotive_cms\'" to your Gemfile)', :red
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def check_smtp
|
58
|
+
smtp_settings = ActionMailer::Base.smtp_settings
|
59
|
+
if smtp_settings[:address] == "smtp.sendgrid.net" && smtp_settings[:user_name] == 'didier' && smtp_settings[:password] == 'I<3locomotive'
|
60
|
+
say 'Smtp configuration: ✔', :green
|
61
|
+
elsif smtp_settings[:address] == "smtp.sendgrid.net" && (smtp_settings[:user_name] != 'didier' || smtp_settings[:password] != 'I<3locomotive')
|
62
|
+
say "Please configure your smtp server in ./config/environments/production.rb", :yellow
|
63
|
+
say "Smtp configuration: ✗", :red
|
64
|
+
elsif smtp_settings[:address] != 'localhost' && smtp_settings[:user_name].present? && smtp_settings[:password].present?
|
65
|
+
say 'Smtp configuration: ✔', :green
|
66
|
+
else
|
67
|
+
say "Please configure your smtp server in ./config/environments/production.rb", :yellow
|
68
|
+
say "Smtp configuration: ✗", :red
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def const_exists?(class_name)
|
75
|
+
klass = Module.const_get(class_name)
|
76
|
+
return true
|
77
|
+
rescue NameError
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
versions:
|
2
|
+
default: '2.0.0.rc9'
|
3
|
+
2.0.0.rc9:
|
4
|
+
gems:
|
5
|
+
rails:
|
6
|
+
version: '3.2.7'
|
7
|
+
unicorn:
|
8
|
+
group: 'development'
|
9
|
+
locomotive_cms:
|
10
|
+
version: '~> 2.0.0.rc9'
|
11
|
+
require: 'locomotive/engine'
|
12
|
+
compass-rails:
|
13
|
+
version: '~> 1.0.2'
|
14
|
+
group: 'assets'
|
15
|
+
sass-rails:
|
16
|
+
version: '~> 3.2.4'
|
17
|
+
group: 'assets'
|
18
|
+
coffee-rails:
|
19
|
+
version: '~> 3.2.2'
|
20
|
+
group: 'assets'
|
21
|
+
uglifier:
|
22
|
+
version: '~> 1.2.4'
|
23
|
+
group: 'assets'
|
24
|
+
therubyracer:
|
25
|
+
version: '>= 0.8.2'
|
26
|
+
heroku:
|
27
|
+
locomotive-heroku:
|
28
|
+
version: '~> 0.0.2'
|
29
|
+
require: 'locomotive/heroku'
|
30
|
+
thin:
|
31
|
+
group: 'production'
|
32
|
+
env:
|
33
|
+
rails_env: 'production'
|
34
|
+
mongodb_url: "mongodb://localhost/test"
|
35
|
+
mongohq_url: "mongodb://localhost/test"
|
36
|
+
sendgrid_username: 'didier'
|
37
|
+
sendgrid_password: 'I<3locomotive'
|
38
|
+
sendgrid_domain: 'locomotivecms.com'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
class Locomotive::Cmd::Config
|
3
|
+
def self.[](value)
|
4
|
+
@@config ||= YAML.load_file(File.expand_path("../config/locomotive.yml", __FILE__))
|
5
|
+
@@config[value]
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.set_env
|
9
|
+
self['env'].each do |key, value|
|
10
|
+
ENV[key.upcase] = value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,282 @@
|
|
1
|
+
require_relative 'config'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
class Locomotive::Cmd::Installer < Thor::Group
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
desc 'Creates a new rails project with locomotive cms'
|
8
|
+
|
9
|
+
argument :app_path, type: :string, desc: 'rails app_name', default: '.'
|
10
|
+
|
11
|
+
class_option :version, type: :string, default: Locomotive::Cmd::Config['versions']['default'] ,
|
12
|
+
desc: 'Skip running migrations and loading seed and sample data'
|
13
|
+
|
14
|
+
class_option :verbose, type: :boolean, default: false , desc: 'Verbose'
|
15
|
+
|
16
|
+
Locomotive::Cmd::Installer.source_root(File.expand_path("../templates/", __FILE__))
|
17
|
+
|
18
|
+
def verify_rails
|
19
|
+
if existing_project?
|
20
|
+
say "#{@app_path} exists already"
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_options_hash
|
26
|
+
@opts = OpenStruct.new
|
27
|
+
@opts.version = options[:version]
|
28
|
+
@opts.verbose = options[:verbose]
|
29
|
+
@opts.app_name = options[:app_name]
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_rails_app
|
33
|
+
say :create, @app_path if @opts.verbose
|
34
|
+
rails_cmd = "rails new #{@app_path} --skip-active-record --skip-test-unit --skip-javascript --skip-bundle"
|
35
|
+
run_silently rails_cmd
|
36
|
+
say 'Create Rails app: Done', :green
|
37
|
+
end
|
38
|
+
|
39
|
+
def replace_gemfile
|
40
|
+
inside @app_path do
|
41
|
+
remove_file 'Gemfile', verbose: @opts.verbose
|
42
|
+
end
|
43
|
+
gemfile = 'Gemfile'
|
44
|
+
template 'Gemfile', "#{@app_path}/Gemfile", verbose: @opts.verbose
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def set_gems
|
49
|
+
set_gems_from_config_group 'gems'
|
50
|
+
bundle_install
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialize_locomotive
|
54
|
+
say_status :locomotive, :initialize if @opts.verbose
|
55
|
+
inside @app_path do
|
56
|
+
run_silently "rails generate locomotive:install"
|
57
|
+
end
|
58
|
+
say 'Adding Locomotive: Done', :green
|
59
|
+
end
|
60
|
+
|
61
|
+
#####################
|
62
|
+
#### HEROKU PART ####
|
63
|
+
#####################
|
64
|
+
|
65
|
+
def ask_user_if_heroku_and_the_rest
|
66
|
+
@opts.heroku = yes?("Deploy to heroku?", :yellow)
|
67
|
+
if @opts.heroku
|
68
|
+
get_options_from_user_for_heroku
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def heroku
|
73
|
+
if @opts.heroku
|
74
|
+
insert_ruby_version_in_gemfile
|
75
|
+
install_bundler_pre
|
76
|
+
set_gems_for_heroku
|
77
|
+
bundle_install
|
78
|
+
configure_locomotive_for_heroku
|
79
|
+
edit_locomotive_config_file
|
80
|
+
precompiling_assets
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
#######################
|
85
|
+
### MULTI SITE PART ###
|
86
|
+
#######################
|
87
|
+
|
88
|
+
def multi_site
|
89
|
+
@opts.multi_site = yes?('Will you use the multi-site feature?', :yellow)
|
90
|
+
if @opts.multi_site
|
91
|
+
@opts.domain_name = ask('What is your base domain name for the multi sites?', :yellow)
|
92
|
+
set_domain_name_in_locomotive
|
93
|
+
add_domains_to_heroku_if_needed
|
94
|
+
say "Don't forget for local dev to edit /ect/hosts or use Pow according to : http://doc.locomotivecms.com/guides/multisites", :green
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
######################
|
99
|
+
### PUSH TO HEROKU ###
|
100
|
+
######################
|
101
|
+
|
102
|
+
def send_to_heroku
|
103
|
+
if @opts.heroku
|
104
|
+
launch_it
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def show_readme
|
109
|
+
puts File.read(find_in_source_paths('README')) unless @opts.verbose
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
###################
|
115
|
+
### HEROKU PART ###
|
116
|
+
###################
|
117
|
+
|
118
|
+
def get_options_from_user_for_heroku
|
119
|
+
@opts.heroku_app_name = ask("What will be the heroku app name?", :yellow)
|
120
|
+
say "Locomotive uses Amazon S3, please enter your credentials", :green
|
121
|
+
@opts.s3_key_id = ask("Amazon S3 key ID: ", :yellow)
|
122
|
+
@opts.s3_secret_key = ask("Amazon S3 secret key: ", :yellow)
|
123
|
+
@opts.s3_bucket = ask("Amazon S3 bucket name: ", :yellow)
|
124
|
+
@opts.heroku_api_key = ask("Heroku API key: ", :yellow)
|
125
|
+
end
|
126
|
+
|
127
|
+
def insert_ruby_version_in_gemfile
|
128
|
+
inside @app_path do
|
129
|
+
insert_into_file "Gemfile", after:"source 'https://rubygems.org'\n", verbose: @opts.verbose do
|
130
|
+
"ruby '1.9.3'\n"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def install_bundler_pre
|
136
|
+
run_silently 'gem install bundler --pre'
|
137
|
+
end
|
138
|
+
|
139
|
+
def set_gems_for_heroku
|
140
|
+
set_gems_from_config_group 'heroku'
|
141
|
+
end
|
142
|
+
|
143
|
+
def configure_locomotive_for_heroku
|
144
|
+
init_heroku_app
|
145
|
+
set_mongohq_for_heroku_app
|
146
|
+
set_sendgrid_for_heroku_app
|
147
|
+
create_s3_config
|
148
|
+
end
|
149
|
+
|
150
|
+
def init_heroku_app
|
151
|
+
inside @app_path do
|
152
|
+
run_silently 'gem install heroku'
|
153
|
+
run_silently 'git init .'
|
154
|
+
run_silently "heroku create #{@opts.heroku_app_name}"
|
155
|
+
run_silently "heroku config:add BUNDLE_WITHOUT=development:test"
|
156
|
+
say "Creating Heroku app: done", :green
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def set_mongohq_for_heroku_app
|
161
|
+
inside @app_path do
|
162
|
+
run_silently "heroku addons:add mongohq:free"
|
163
|
+
remove_file 'config/mongoid.yml', verbose: @opts.verbose
|
164
|
+
end
|
165
|
+
template 'mongoid.yml', "#{@app_path}/config/mongoid.yml", verbose: @opts.verbose
|
166
|
+
say "Adding MongoHQ to Heroku: done", :green
|
167
|
+
end
|
168
|
+
|
169
|
+
def set_sendgrid_for_heroku_app
|
170
|
+
inside @app_path do
|
171
|
+
run_silently 'heroku addons:add sendgrid:starter'
|
172
|
+
append_smtp_to_production_environment_file
|
173
|
+
say "Adding Sendgrid to Heroku: done", :green
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def append_smtp_to_production_environment_file
|
178
|
+
insert_into_file "config/environments/production.rb", before:"\nend", verbose: @opts.verbose do
|
179
|
+
" config.action_mailer.delivery_method = :smtp\n" +
|
180
|
+
" config.action_mailer.smtp_settings = {\n" +
|
181
|
+
" :address => 'smtp.sendgrid.net',\n" +
|
182
|
+
" :port => 25,\n" +
|
183
|
+
" :authentication => :plain,\n" +
|
184
|
+
" :user_name => ENV['SENDGRID_USERNAME'],\n" +
|
185
|
+
" :password => ENV['SENDGRID_PASSWORD'],\n" +
|
186
|
+
" :domain => ENV['SENDGRID_DOMAIN']\n" +
|
187
|
+
" }\n"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def create_s3_config
|
192
|
+
inside @app_path do
|
193
|
+
run_silently "heroku config:add S3_KEY_ID=#{@opts.s3_key_id}"
|
194
|
+
run_silently "heroku config:add S3_SECRET_KEY=#{@opts.s3_secret_key}"
|
195
|
+
run_silently "heroku config:add S3_BUCKET=#{@opts.s3_bucket}"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def edit_locomotive_config_file
|
200
|
+
inside @app_path do
|
201
|
+
insert_into_file "config/initializers/locomotive.rb", before:"\nend", verbose: @opts.verbose do
|
202
|
+
" config.hosting = {\n" +
|
203
|
+
" :target => :heroku,\n" +
|
204
|
+
" :api_key => '#{@opts.heroku_api_key}',\n" +
|
205
|
+
" :app_name => '#{@opts.heroku_app_name}',\n" +
|
206
|
+
" }\n"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def precompiling_assets
|
212
|
+
inside @app_path do
|
213
|
+
insert_into_file "config/application.rb", after:" class Application < Rails::Application\n", verbose: @opts.verbose do
|
214
|
+
" config.assets.initialize_on_precompile = false\n"
|
215
|
+
end
|
216
|
+
run_silently "bundle exec rake assets:precompile"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def launch_it
|
221
|
+
inside @app_path do
|
222
|
+
run_silently "git add ."
|
223
|
+
run_silently "git commit -am 'launch it'"
|
224
|
+
run_silently "git push heroku master"
|
225
|
+
run "heroku open"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
#######################
|
230
|
+
### MULTI SITE PART ###
|
231
|
+
#######################
|
232
|
+
|
233
|
+
def set_domain_name_in_locomotive
|
234
|
+
inside @app_path do
|
235
|
+
gsub_file 'config/initializers/locomotive.rb', 'config.multi_sites = false', verbose: @opts.verbose do
|
236
|
+
"config.multi_sites do |multi_sites|\n" +
|
237
|
+
" multi_sites.domain = '#{@opts.domain_name}'\n" +
|
238
|
+
"end\n"
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def add_domains_to_heroku_if_needed
|
244
|
+
if @opts.heroku
|
245
|
+
say "Don't forget to configure your DNS registrar to point *.#{@opts.domain_name} at #{@opts.heroku_app_name}.heroku[app].com", :green
|
246
|
+
inside(@app_path){ run_silently "heroku domains:add *.#{@opts.domain_name}" }
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
### COMMON PART ###
|
251
|
+
def bundle_install
|
252
|
+
inside @app_path do
|
253
|
+
run_silently 'bundle install'
|
254
|
+
end
|
255
|
+
say 'Installing Gems: Done', :green
|
256
|
+
end
|
257
|
+
|
258
|
+
def set_gems_from_config_group(group_name)
|
259
|
+
inside @app_path do
|
260
|
+
Locomotive::Cmd::Config['versions'][@opts.version][group_name].each do |key, values|
|
261
|
+
gem key, values
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
def gem(name, gem_options={})
|
267
|
+
say_status :gemfile, name if @opts.verbose
|
268
|
+
parts = ["'#{name}'"]
|
269
|
+
parts << ["'#{gem_options.delete('version')}'"] if gem_options['version']
|
270
|
+
gem_options.each { |key, value| parts << "#{key}: '#{value}'" }
|
271
|
+
append_file 'Gemfile', "gem #{parts.join(', ')}\n", verbose: @opts.verbose
|
272
|
+
end
|
273
|
+
|
274
|
+
def existing_project?
|
275
|
+
File.exists?(File.join(@app_path))
|
276
|
+
end
|
277
|
+
|
278
|
+
def run_silently(cmd)
|
279
|
+
run cmd, capture: !@opts.verbose, verbose: @opts.verbose
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class Locomotive::Cmd::MongoChecker < Thor::Group
|
3
|
+
def exists?
|
4
|
+
mongo_path = `which mongo`
|
5
|
+
if mongo_path.include? 'mongo'
|
6
|
+
say 'Mongo installation: ✔', :green
|
7
|
+
else
|
8
|
+
say 'Mongo installation: ✗ (mongo command not found)', :red
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def running?
|
13
|
+
mongo = `ps cax | grep mongod`
|
14
|
+
unless mongo.include? 'mongod'
|
15
|
+
say 'MongoDB is not running, please turn it on!', :red
|
16
|
+
exit -1
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
The Locomotive Engine has been correctly installed in your Rails application.
|
4
|
+
|
5
|
+
1. Edit the main config files:
|
6
|
+
|
7
|
+
- config/initializers/locomotive.rb
|
8
|
+
- config/initializers/carrierwave.rb
|
9
|
+
- config/initializers/dragonfly.rb
|
10
|
+
- config/mongoid.yml
|
11
|
+
- config/devise.yml
|
12
|
+
- config/routes.rb
|
13
|
+
|
14
|
+
2. Launch the server
|
15
|
+
|
16
|
+
> bundle exec unicorn_rails
|
17
|
+
|
18
|
+
3. Open your browser
|
19
|
+
|
20
|
+
> open localhost:8080
|
21
|
+
|
22
|
+
4. Follow the installation wizard steps
|
23
|
+
|
24
|
+
5. Enjoy !
|
25
|
+
|
26
|
+
===============================================================================
|
@@ -0,0 +1,21 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
host: localhost
|
3
|
+
port: 27017
|
4
|
+
# slaves:
|
5
|
+
# - host: slave1.local
|
6
|
+
# port: 27018
|
7
|
+
# - host: slave2.local
|
8
|
+
# port: 27019
|
9
|
+
|
10
|
+
development:
|
11
|
+
<<: *defaults
|
12
|
+
database: locomotive_dev
|
13
|
+
|
14
|
+
test:
|
15
|
+
<<: *defaults
|
16
|
+
database: locomotive_test
|
17
|
+
|
18
|
+
# set these environment variables on your prod server
|
19
|
+
production:
|
20
|
+
uri: <%%= ENV['MONGOHQ_URL'] %>
|
21
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'locomotive_cmd/version'
|
2
|
+
require 'thor'
|
3
|
+
require 'thor/group'
|
4
|
+
|
5
|
+
module Locomotive::Cmd
|
6
|
+
class Command
|
7
|
+
case ARGV.first
|
8
|
+
when 'version'
|
9
|
+
puts Locomotive::Cmd::VERSION
|
10
|
+
when 'install'
|
11
|
+
ARGV.shift
|
12
|
+
require 'locomotive_cmd/installer'
|
13
|
+
Locomotive::Cmd::Installer.start
|
14
|
+
when 'check'
|
15
|
+
ARGV.shift
|
16
|
+
require 'locomotive_cmd/checker'
|
17
|
+
Locomotive::Cmd::Checker.start
|
18
|
+
else
|
19
|
+
#todo: ASK FOR HELP
|
20
|
+
puts 'usage: locomotive_cmd [version|checker|install] args'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/locomotive_cmd/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ['Yannick Schutz', 'Didier Lafforgue']
|
6
|
+
gem.email = ['yannick.schutz@gmail.com', 'did@locomotivecms.com']
|
7
|
+
gem.description = %q{The LocomotiveCMS binary tool}
|
8
|
+
gem.summary = %q{The command line binary is aimed to help people to install and for troubleshooting}
|
9
|
+
gem.homepage = 'http://www.locomotivecms.com'
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = 'locomotive_cmd'
|
15
|
+
gem.require_paths = ['lib']
|
16
|
+
gem.version = Locomotive::Cmd::VERSION
|
17
|
+
gem.add_dependency 'thor'
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: locomotive_cmd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yannick Schutz
|
9
|
+
- Didier Lafforgue
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-08-06 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
description: The LocomotiveCMS binary tool
|
32
|
+
email:
|
33
|
+
- yannick.schutz@gmail.com
|
34
|
+
- did@locomotivecms.com
|
35
|
+
executables:
|
36
|
+
- locomotive
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- .gitignore
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- bin/locomotive
|
46
|
+
- lib/locomotive_cmd.rb
|
47
|
+
- lib/locomotive_cmd/checker.rb
|
48
|
+
- lib/locomotive_cmd/config.rb
|
49
|
+
- lib/locomotive_cmd/config/locomotive.yml
|
50
|
+
- lib/locomotive_cmd/installer.rb
|
51
|
+
- lib/locomotive_cmd/mongo_checker.rb
|
52
|
+
- lib/locomotive_cmd/templates/Gemfile
|
53
|
+
- lib/locomotive_cmd/templates/README
|
54
|
+
- lib/locomotive_cmd/templates/mongoid.yml
|
55
|
+
- lib/locomotive_cmd/version.rb
|
56
|
+
- locomotive_cmd.gemspec
|
57
|
+
homepage: http://www.locomotivecms.com
|
58
|
+
licenses: []
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.8.24
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: The command line binary is aimed to help people to install and for troubleshooting
|
81
|
+
test_files: []
|
82
|
+
has_rdoc:
|