grape-cli-mongodb 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/grape/cli/mongodb.rb +13 -12
- data/lib/grape/cli/mongodb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e44fb038c48daedabb81f591489bfa427b086cd
|
4
|
+
data.tar.gz: ced87d584fc63455747c45cc4fed501c8d1c79a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a9c87598bd5f827b1ceb4ab37ed02cfcfb46bbceb7d1cb61d3e2b87b1469834199f4b869ca090ca2e71a4033e2f2cfbb27fb6c23d4c7f4c2bec8f7d0b73e074
|
7
|
+
data.tar.gz: 79314a90a2ee5deb5a74577fc39ddf9f11256adc963c4a93d0ca437e2622b8d83346ce6268ed1ca52da29296d960a7cd5c537f08c0e1319dd35140d05cbbf68b
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Grape::Cli::Mongodb
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Quickly bootstrap a working Grape API with MongoDB (you must have MongoDB installed, and have it running on localhost with the default port)
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -14,7 +12,7 @@ gem 'grape-cli-mongodb'
|
|
14
12
|
|
15
13
|
And then execute:
|
16
14
|
|
17
|
-
$ bundle
|
15
|
+
$ bundle install
|
18
16
|
|
19
17
|
Or install it yourself as:
|
20
18
|
|
@@ -22,7 +20,10 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
Quickly start a boilerplate Grape API with a MongoDB backend using the following command:
|
24
|
+
|
25
|
+
$ grape -n YOUR_PROJECT_NAME
|
26
|
+
|
26
27
|
|
27
28
|
## Development
|
28
29
|
|
@@ -32,10 +33,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
33
|
|
33
34
|
## Contributing
|
34
35
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/aronlmin/grape-cli-mongodb.
|
36
37
|
|
37
38
|
|
38
39
|
## License
|
39
40
|
|
40
41
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/lib/grape/cli/mongodb.rb
CHANGED
@@ -46,9 +46,11 @@ module Grape
|
|
46
46
|
|
47
47
|
## Copy the boilerplate directory to the filepath
|
48
48
|
FileUtils.cp_r(boilerplate, filepath)
|
49
|
+
puts 'copied boilerplate directory to the working directory'
|
49
50
|
|
50
51
|
## rename the boilerplate directory to the project name
|
51
52
|
FileUtils.mv( "#{filepath}/boilerplate", "#{filepath}/#{project}" )
|
53
|
+
puts 'renamed the boilerplate directory to the new project name'
|
52
54
|
|
53
55
|
new_path = "#{filepath}/#{project}"
|
54
56
|
|
@@ -56,35 +58,34 @@ module Grape
|
|
56
58
|
print '.'
|
57
59
|
end
|
58
60
|
|
61
|
+
|
59
62
|
file_names = ['/init.rb', '/config.ru', '/config/entities.rb']
|
60
63
|
file_names.each do |file_name|
|
61
64
|
text = File.read( File.join(new_path, file_name) )
|
62
65
|
replace_module = text.gsub('BOILERPLATE', project.upcase.gsub('_', ''))
|
63
66
|
File.open(File.join(new_path, file_name), 'w') { |file| file.puts replace_module }
|
64
|
-
puts "
|
67
|
+
puts "overwrote boilerplate for file #{file_name}"
|
65
68
|
end
|
66
69
|
|
67
70
|
config_files = ['/config/mongoid.yml']
|
68
71
|
config_files.each do |file_name|
|
69
72
|
text = File.read( File.join(new_path, file_name) )
|
70
|
-
replace_db = text.gsub( 'boilerplate', project )
|
73
|
+
replace_db = text.gsub( 'boilerplate', project.downcase )
|
71
74
|
File.open( File.join(new_path, file_name), 'w' ) { |file| file.puts replace_db }
|
72
|
-
puts "
|
75
|
+
puts "overwrote boilerplate for file #{file_name}"
|
73
76
|
end
|
74
77
|
|
75
78
|
folders_to_make = ['entities', 'lib', 'log', 'bin', 'models', 'resources', 'tasks']
|
76
79
|
folders_to_make.each do |folder|
|
77
80
|
Dir.mkdir( File.join(new_path, folder) )
|
78
|
-
puts "created directory
|
81
|
+
puts "created directory #{folder}"
|
82
|
+
end
|
83
|
+
|
84
|
+
files_to_make = ['env.development']
|
85
|
+
files_to_make.each do |file|
|
86
|
+
File.new( File.join( new_path, file ), 'w' )
|
87
|
+
puts "created file #{file}"
|
79
88
|
end
|
80
|
-
## create emty folders
|
81
|
-
## entities
|
82
|
-
## lib
|
83
|
-
## log
|
84
|
-
## bin
|
85
|
-
## models
|
86
|
-
## resources
|
87
|
-
## tasks
|
88
89
|
|
89
90
|
end
|
90
91
|
|