raboot 0.1.0
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 +7 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/raboot +5 -0
- data/lib/raboot.rb +9 -0
- data/lib/raboot/cli.rb +31 -0
- data/lib/raboot/utils.rb +43 -0
- data/lib/raboot/version.rb +11 -0
- data/raboot.gemspec +45 -0
- data/spec/raboot_spec.rb +11 -0
- data/spec/spec_helper.rb +2 -0
- metadata +118 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f03230c4757464a6ec824dd5e8675252f183eb35
|
|
4
|
+
data.tar.gz: f9a2f19771316662f21ca962697c734ef150e764
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b0acf20f3fc175a90f61f00326d3bd3a7edd94ac19c0a40fb58580bf2fc516a4e5cd35d9e122397f75b874cf4531b2643c02bee7b0e6080fa3fa3e4b38da3056
|
|
7
|
+
data.tar.gz: 546ef2b8b036ad1c7c32fc99999b457ffc9d099db10130fb17b8a62ca21d45d88fc1dff5b259ef55d781b8203d70e4a2a0e3592fc67bdaff8c55fc7ea6a7f123
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 tkmru
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Raboot
|
|
2
|
+
At the beginning of Ruby on Rails application development, developers need to set up gem etc. I feel so lazy. Raboot solves this problem. Raboot set up new rails app by copying from already existed rails app as a template. By default, it use ```~/raboot``` as a template.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ gem install raboot
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
$ raboot new <new_rails_app_name>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Development
|
|
19
|
+
|
|
20
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
21
|
+
|
|
22
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
|
|
26
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tkmru/raboot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "raboot"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/raboot
ADDED
data/lib/raboot.rb
ADDED
data/lib/raboot/cli.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
require 'thor'
|
|
5
|
+
|
|
6
|
+
module Raboot
|
|
7
|
+
class CLI < Thor
|
|
8
|
+
include Raboot::Version
|
|
9
|
+
include Raboot::Utils
|
|
10
|
+
include Thor::Actions
|
|
11
|
+
|
|
12
|
+
map '-v' => :version
|
|
13
|
+
map '--version' => :version
|
|
14
|
+
|
|
15
|
+
desc 'version', 'Display the current version of raboot'
|
|
16
|
+
def version
|
|
17
|
+
say Raboot::Version::STRING
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc 'new', 'Generate a new Rails app from template'
|
|
21
|
+
def new(name)
|
|
22
|
+
if validate_name?(name)
|
|
23
|
+
template_path = File.expand_path('~/raboot/*')
|
|
24
|
+
FileUtils.mkdir(name)
|
|
25
|
+
FileUtils.cp_r(Dir.glob(template_path), name)
|
|
26
|
+
rename_app(name)
|
|
27
|
+
say 'Successfully generated ' + name + ' app from template'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/raboot/utils.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
module Raboot
|
|
4
|
+
module Utils
|
|
5
|
+
def rename_app(new_name)
|
|
6
|
+
replace_text(
|
|
7
|
+
new_name + '/config/application.rb',
|
|
8
|
+
/module\s[a-zA-Z0-9]+/,
|
|
9
|
+
'module ' + new_name.capitalize
|
|
10
|
+
)
|
|
11
|
+
replace_text(
|
|
12
|
+
new_name + '/config/environments/production.rb',
|
|
13
|
+
/config.active_job.queue_name_prefix\s=\s"[a-zA-Z0-9]+_\#\{Rails\.env\}"/,
|
|
14
|
+
'config.active_job.queue_name_prefix = "'+ new_name + '_#{Rails.env}"'
|
|
15
|
+
)
|
|
16
|
+
replace_text(
|
|
17
|
+
new_name + '/config/initializers/session_store.rb',
|
|
18
|
+
/Rails.application.config.session_store\s:cookie_store,\skey:\s'_[a-zA-Z0-9]+_session'/,
|
|
19
|
+
"Rails.application.config.session_store :cookie_store, key: '_" + new_name + "_session'"
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def replace_text(path, old_pattern, new_pattern)
|
|
24
|
+
buffer = File.open(path, "r") { |f| f.read() }
|
|
25
|
+
buffer.gsub!(old_pattern, new_pattern)
|
|
26
|
+
File.open(path, "w") { |f| f.write(buffer) }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def validate_name?(new_name)
|
|
30
|
+
reserved_names = %w[application destroy plugin runner test]
|
|
31
|
+
|
|
32
|
+
if new_name.strip.empty?
|
|
33
|
+
raise Thor::Error, "[Error] Application name can't be blank."
|
|
34
|
+
elsif new_name =~ /^\d/
|
|
35
|
+
raise Thor::Error, '[Error] Please give a name which does not start with numbers.'
|
|
36
|
+
elsif reserved_names.include?(new_name.downcase)
|
|
37
|
+
raise Thor::Error, '[Error] Please give a name which does not match any of the reserved Rails keywords.'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
return true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/raboot.gemspec
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'raboot/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = "raboot"
|
|
9
|
+
spec.version = Raboot::Version::STRING
|
|
10
|
+
spec.authors = ["tkmru"]
|
|
11
|
+
spec.email = ["i.am.tkmru@gmail.com"]
|
|
12
|
+
|
|
13
|
+
spec.summary = %q{Raboot set up rails app using already existed app as a template}
|
|
14
|
+
spec.description = %q{Raboot is command line tool to easily set up new rails app by copying from already existed rails app as a template. By default, it use ~/raboot as a template.}
|
|
15
|
+
spec.homepage = "https://github.com/tkmru/raboot"
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
|
|
18
|
+
spec.files = [
|
|
19
|
+
".rspec",
|
|
20
|
+
".travis.yml",
|
|
21
|
+
"Gemfile",
|
|
22
|
+
"LICENSE.txt",
|
|
23
|
+
"README.md",
|
|
24
|
+
"Rakefile",
|
|
25
|
+
"bin/console",
|
|
26
|
+
"bin/setup",
|
|
27
|
+
"exe/raboot",
|
|
28
|
+
"raboot.gemspec",
|
|
29
|
+
"lib/raboot.rb",
|
|
30
|
+
"lib/raboot/cli.rb",
|
|
31
|
+
"lib/raboot/utils.rb",
|
|
32
|
+
"lib/raboot/version.rb",
|
|
33
|
+
"spec/raboot_spec.rb",
|
|
34
|
+
"spec/spec_helper.rb"
|
|
35
|
+
]
|
|
36
|
+
spec.bindir = "exe"
|
|
37
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
38
|
+
spec.require_paths = ["lib"]
|
|
39
|
+
|
|
40
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
42
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
43
|
+
|
|
44
|
+
spec.add_runtime_dependency "thor"
|
|
45
|
+
end
|
data/spec/raboot_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: raboot
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- tkmru
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: thor
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: Raboot is command line tool to easily set up new rails app by copying
|
|
70
|
+
from already existed rails app as a template. By default, it use ~/raboot as a template.
|
|
71
|
+
email:
|
|
72
|
+
- i.am.tkmru@gmail.com
|
|
73
|
+
executables:
|
|
74
|
+
- raboot
|
|
75
|
+
extensions: []
|
|
76
|
+
extra_rdoc_files: []
|
|
77
|
+
files:
|
|
78
|
+
- ".rspec"
|
|
79
|
+
- ".travis.yml"
|
|
80
|
+
- Gemfile
|
|
81
|
+
- LICENSE.txt
|
|
82
|
+
- README.md
|
|
83
|
+
- Rakefile
|
|
84
|
+
- bin/console
|
|
85
|
+
- bin/setup
|
|
86
|
+
- exe/raboot
|
|
87
|
+
- lib/raboot.rb
|
|
88
|
+
- lib/raboot/cli.rb
|
|
89
|
+
- lib/raboot/utils.rb
|
|
90
|
+
- lib/raboot/version.rb
|
|
91
|
+
- raboot.gemspec
|
|
92
|
+
- spec/raboot_spec.rb
|
|
93
|
+
- spec/spec_helper.rb
|
|
94
|
+
homepage: https://github.com/tkmru/raboot
|
|
95
|
+
licenses:
|
|
96
|
+
- MIT
|
|
97
|
+
metadata: {}
|
|
98
|
+
post_install_message:
|
|
99
|
+
rdoc_options: []
|
|
100
|
+
require_paths:
|
|
101
|
+
- lib
|
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
requirements: []
|
|
113
|
+
rubyforge_project:
|
|
114
|
+
rubygems_version: 2.6.3
|
|
115
|
+
signing_key:
|
|
116
|
+
specification_version: 4
|
|
117
|
+
summary: Raboot set up rails app using already existed app as a template
|
|
118
|
+
test_files: []
|