rails-init 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8dafd6a533dea01130d393c91efc39f69f8f152
4
+ data.tar.gz: 1cfd27c57493498779dd2e2e958c3101484d3fea
5
+ SHA512:
6
+ metadata.gz: cdeafa40088de42b1f2d811ffb68255dce4fe3ef72264c50ed5521e96fbaab29c59c59bae1d3008335b5be900c88d0270038aecc60c55f47dcf64ea22ca2fdd5
7
+ data.tar.gz: 050a502d72ed119ecf3943afa6159b7088c24bee9df3959e3166e15ca49e83ea90e36237bfe73737b43fe0cc0f3ce1e193a2dbb40cf7aa8ed7c1bd79786a52b3
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ # Specify your gem's dependencies in rails-init.gemspec
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 tasukujp
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,24 @@
1
+ # RailsInit
2
+
3
+ CLI tool for creating rails application, without installing gem in system ruby.
4
+
5
+ ## Installation
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install rails-init
10
+
11
+ ## Usage
12
+
13
+ # Create a rails application. create is optional.
14
+ $ rails-init [create] [OPTIONS]
15
+ Project directory (/home/example):
16
+ Rails version (latest 5.0.2):
17
+
18
+ ## Contributing
19
+
20
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails-init. 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.
21
+
22
+ ## License
23
+
24
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'rails_init'
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/rails-init ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ require 'rails_init'
4
+
5
+ RailsInit::CLI.start(ARGV)
data/lib/rails_init.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+ require 'rails_init/version'
3
+ require 'rails_init/cli'
@@ -0,0 +1,71 @@
1
+
2
+ require 'rails_init'
3
+ require 'pathname'
4
+ require 'thor'
5
+
6
+ module RailsInit
7
+ class CLI < Thor
8
+
9
+ desc 'create [OPTIONS]', 'Create a rails application'
10
+ option :path, type: :string, default: './vendor/bundle'
11
+ option :jobs, type: :numeric, default: 4
12
+ option :force, type: :boolean, default: true
13
+ option :bundle_opts, type: :array, default: []
14
+ option :rails_opts, type: :array, default: []
15
+ def create
16
+ working_dir
17
+ gemfile_init
18
+ exec_cmd bundle_cmd
19
+ exec_cmd rails_cmd
20
+ end
21
+ default_task :create
22
+
23
+ desc 'version', 'Prints the rails-init version information'
24
+ def version
25
+ puts RailsInit::VERSION
26
+ end
27
+ map %w(-v --version) => :version
28
+
29
+ private
30
+
31
+ def working_dir
32
+ print "Project directory (#{Dir.pwd}): "
33
+ project_dir = STDIN.gets
34
+ unless project_dir.strip!.empty?
35
+ project_dir = Pathname.new(project_dir).expand_path
36
+ Dir.mkdir project_dir unless Dir.exist? project_dir
37
+ Dir.chdir project_dir
38
+ end
39
+ end
40
+
41
+ def gemfile_init
42
+ latest = /rails\s\(([0-9.]+)\)/.match(`gem search --remote "^rails$"`)[1]
43
+ print "Rails version (latest #{latest}): "
44
+ version = STDIN.gets
45
+ File.open 'Gemfile', 'w' do |f|
46
+ f.puts "source 'https://rubygems.org'"
47
+ f.print "gem 'rails'"
48
+ f.print ", '#{version}'" unless version.strip!.empty?
49
+ end
50
+ end
51
+
52
+ def bundle_cmd
53
+ opts = []
54
+ opts << "--path=#{options[:path]}"
55
+ opts << "--jobs=#{options[:jobs]}"
56
+ "bundle install #{opts.join("\s")} #{options[:bundle_opts].join("\s")}"
57
+ end
58
+
59
+ def rails_cmd
60
+ opts = []
61
+ opts << '--force' if options[:force]
62
+ "bundle exec rails new . #{opts.join("\s")} #{options[:rails_opts].join("\s")}"
63
+ end
64
+
65
+ def exec_cmd(command)
66
+ pid = spawn(command)
67
+ Process::wait(pid)
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ module RailsInit
3
+ VERSION = '0.1.0'
4
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'rails_init/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'rails-init'
9
+ spec.version = RailsInit::VERSION
10
+ spec.authors = ['tasukujp']
11
+ spec.email = ['tasuku.dev@gmail.com']
12
+
13
+ spec.summary = %q{Create a rails application without installing gem in system ruby.}
14
+ spec.description = %q{Create a rails application without installing gem in system ruby.}
15
+ spec.homepage = 'https://github.com/tasukujp/rails-init'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_runtime_dependency 'thor', '~> 0.19'
24
+ spec.add_runtime_dependency 'bundler', '~> 1.14'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
27
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-init
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tasukujp
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Create a rails application without installing gem in system ruby.
70
+ email:
71
+ - tasuku.dev@gmail.com
72
+ executables:
73
+ - rails-init
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/rails-init
87
+ - lib/rails_init.rb
88
+ - lib/rails_init/cli.rb
89
+ - lib/rails_init/version.rb
90
+ - rails-init.gemspec
91
+ homepage: https://github.com/tasukujp/rails-init
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.6.8
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Create a rails application without installing gem in system ruby.
115
+ test_files: []