railyard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/bin/railyard +5 -0
- data/lib/railyard/gemfile.rb +35 -0
- data/lib/railyard/version.rb +3 -0
- data/lib/railyard.rb +86 -0
- data/railyard.gemspec +25 -0
- data/sandbox/Gemfile +3 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a423bd21bbfa46c3818a30badaed855b24931dc7
|
4
|
+
data.tar.gz: c10f9583da02af9868ae0f82533e0ea77985ed1a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4845505dcdc568c51d865b229f5cbfd524a7bd4759529d46e812a874ef803bf6aef13edf9d1ba7074dfae6d2cc508610a32bedc7e7b7c5a7479d48632c38b367
|
7
|
+
data.tar.gz: 2ed9d8f7520c6cdc3d9dc4e2cfb6aa7c34efcd34cf36ed4d7b624ef04fa4007d1ebc074524e4e864c002cf29f3d67517d7f65cb17ba73fa5f93cd71af22b335c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Brandon Weiss
|
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,36 @@
|
|
1
|
+
# Railyard
|
2
|
+
|
3
|
+
Generate Rails skeletons without having to globally install Rails and its bajillion dependencies.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "railyard"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install railyard
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
There are only two commands, `version` and `new`.
|
24
|
+
|
25
|
+
$ railyard version 4.1.1
|
26
|
+
$ railyard new APP_NAME
|
27
|
+
|
28
|
+
Right now Railyard doesn't manage Ruby versions for you—Railyard runs in whatever Ruby version you've installed it on and are calling it from. You may be able to generate a skeleton for a version of Rails in a version of Ruby that Rails wasn't designed to run on, but it's recommended that you switch your Ruby version to one that is compatible with the version of Rails you're trying to generate a skeleton of.
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it ( https://github.com/[my-github-username]/railyard/fork )
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/railyard
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Railyard
|
2
|
+
class Gemfile
|
3
|
+
|
4
|
+
def initialize(path)
|
5
|
+
@path = path
|
6
|
+
end
|
7
|
+
|
8
|
+
def update_version(number)
|
9
|
+
body = read
|
10
|
+
|
11
|
+
if match = body.match(/^gem \"rails\", \"(\d+(?:\.\d+(?:\.\d+)?)?)\"$/)
|
12
|
+
body.gsub!(match[1], number)
|
13
|
+
else
|
14
|
+
body.gsub!(/, \"[\d\.]+\"/, "")
|
15
|
+
end
|
16
|
+
|
17
|
+
write(body)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def remove_version(body)
|
23
|
+
body.gsub(/, \"[\d\.]+\"/, "")
|
24
|
+
end
|
25
|
+
|
26
|
+
def read
|
27
|
+
File.read(@path)
|
28
|
+
end
|
29
|
+
|
30
|
+
def write(body)
|
31
|
+
File.open(@path, "w") { |file| file.write(body) }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/lib/railyard.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
require "railyard/version"
|
2
|
+
require "railyard/gemfile"
|
3
|
+
|
4
|
+
require "pathname"
|
5
|
+
require "thor"
|
6
|
+
require "bundler"
|
7
|
+
|
8
|
+
module Railyard
|
9
|
+
|
10
|
+
class CLI < Thor
|
11
|
+
|
12
|
+
desc "version [NUMBER]", "Show or change the Rails version"
|
13
|
+
def version(number = nil)
|
14
|
+
sandbox("bundle exec rails --version") and return unless number
|
15
|
+
|
16
|
+
Gemfile.new(gemfile_path).update_version(number)
|
17
|
+
|
18
|
+
puts "Changing Rails version..."
|
19
|
+
return if installed?
|
20
|
+
|
21
|
+
success = install
|
22
|
+
puts "Rails version #{number} doesn't appear to exist." unless success
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "new [APP_PATH]", "Create a new Rails application"
|
26
|
+
def new(app_path = nil, *args)
|
27
|
+
if !installed?
|
28
|
+
puts "Installing Rails..."
|
29
|
+
install
|
30
|
+
end
|
31
|
+
|
32
|
+
if app_path && app_path !~ /^--?/
|
33
|
+
args.unshift expand_path(app_path)
|
34
|
+
args << "--skip-bundle" unless args.include?("--skip-bundle")
|
35
|
+
else
|
36
|
+
args << "--help"
|
37
|
+
end
|
38
|
+
|
39
|
+
rails_new(args)
|
40
|
+
end
|
41
|
+
|
42
|
+
def help
|
43
|
+
puts "railyard #{Railyard::VERSION}"
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
no_commands do
|
48
|
+
|
49
|
+
def rails_new(args)
|
50
|
+
sandbox("bundle exec rails new #{args.join(' ')}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def installed?
|
54
|
+
sandbox("bundle check > /dev/null")
|
55
|
+
end
|
56
|
+
|
57
|
+
def install
|
58
|
+
sandbox("bundle install --path vendor > /dev/null")
|
59
|
+
end
|
60
|
+
|
61
|
+
def sandbox(command)
|
62
|
+
Bundler.with_clean_env do
|
63
|
+
system("cd #{sandbox_path}; #{command}")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def sandbox_path
|
68
|
+
Pathname.new(File.expand_path("../../sandbox", __FILE__))
|
69
|
+
end
|
70
|
+
|
71
|
+
def gemfile_path
|
72
|
+
sandbox_path.join("Gemfile")
|
73
|
+
end
|
74
|
+
|
75
|
+
def expand_path(path)
|
76
|
+
path[0] == "/" ? path : working_directory.join(path)
|
77
|
+
end
|
78
|
+
|
79
|
+
def working_directory
|
80
|
+
Pathname.new(Dir.pwd)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
data/railyard.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "railyard/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "railyard"
|
8
|
+
spec.version = Railyard::VERSION
|
9
|
+
spec.authors = ["Brandon Weiss"]
|
10
|
+
spec.email = ["brandon@anti-pattern.com"]
|
11
|
+
spec.summary = %q{Non-polluting Rails skeleton generator}
|
12
|
+
spec.description = %q{Generate Rails skeletons without having to globally install Rails and its bajillion dependencies.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "rake", "~> 10.3.2"
|
22
|
+
|
23
|
+
spec.add_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
25
|
+
end
|
data/sandbox/Gemfile
ADDED
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: railyard
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Weiss
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 10.3.2
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 10.3.2
|
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.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
description: Generate Rails skeletons without having to globally install Rails and
|
56
|
+
its bajillion dependencies.
|
57
|
+
email:
|
58
|
+
- brandon@anti-pattern.com
|
59
|
+
executables:
|
60
|
+
- railyard
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/railyard
|
70
|
+
- lib/railyard.rb
|
71
|
+
- lib/railyard/gemfile.rb
|
72
|
+
- lib/railyard/version.rb
|
73
|
+
- railyard.gemspec
|
74
|
+
- sandbox/Gemfile
|
75
|
+
homepage: ''
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.4.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Non-polluting Rails skeleton generator
|
99
|
+
test_files: []
|