ruby_dir 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90042f8de1294df912abc4eb680273868844730051943f67bf23b16f262d0fde
4
+ data.tar.gz: 7b773fa4d7bedd41dbdae37ef57780686a981074b698a33e129497e019a30f38
5
+ SHA512:
6
+ metadata.gz: 3e7d850ae667baf186ae74a334648d47b8c1886653393810cc052cf0b1fa47bec3b643873c46fc240914a01995965b9f96cf22b839c12676b1e1f7ad219d52c8
7
+ data.tar.gz: e6eee7c7acb53c2d3b5c1dd782f167c13c235e3b957acf61e7d544d9efd2a919b39ff555f5adfad702779b46aa0d17c52445a448cacb77bfd239bce591ab9e24
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ruby_dir.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby_dir (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.4.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 2.0)
16
+ rake (~> 10.0)
17
+ ruby_dir!
18
+
19
+ BUNDLED WITH
20
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 matt-mcalister
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,58 @@
1
+ # RubyDir
2
+
3
+ This gem allows you to generate an extremely barebones ruby repository.
4
+ The repository includes the basics needed for a ruby sandbox.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ruby_dir'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install ruby_dir
21
+
22
+ ## Usage
23
+
24
+ Once installed, run `ruby_dir NAME`, where `NAME` is the name of the repo you
25
+ would like to generate.
26
+
27
+ Here are the files that are generated when you run `ruby_dir blackjack`:
28
+
29
+ ```
30
+ blackjack/
31
+ ├── app/
32
+ │ ├── models/
33
+ │ └── run.rb # this file contains an empty App class
34
+ ├── config/
35
+ │ └── environment.rb # this file handles bundling your gems and local files
36
+ ├── spec/
37
+ │ ├── blackjack_spec.rb # this file contains one test as a template
38
+ │ └── spec_helper.rb
39
+ ├── tools/
40
+ │ └── console.rb # this file contains starter code for a basic console
41
+ ├── .rspec
42
+ └── Gemfile # included gems are rspec, require_all, and pry
43
+ ```
44
+
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
+
50
+ 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).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/matt-mcalister/ruby_dir.
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ruby_dir"
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/ruby_dir ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require "ruby_dir"
3
+ require "pry"
4
+
5
+ rd = RubyDir::Instruct.new(ARGV[0])
6
+ rd.create_directory
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
@@ -0,0 +1,3 @@
1
+ module RubyDir
2
+ VERSION = "0.1.0"
3
+ end
data/lib/ruby_dir.rb ADDED
@@ -0,0 +1,41 @@
1
+ require "ruby_dir/version"
2
+
3
+ module RubyDir
4
+ class Error < StandardError; end
5
+ class Instruct
6
+ attr_reader :name
7
+
8
+ def initialize(name)
9
+ @name = name
10
+ end
11
+
12
+ def create_directory
13
+ `mkdir #{name}`
14
+ puts "created #{name}/"
15
+ `cd #{name} && mkdir app`
16
+ puts "created #{name}/app"
17
+ `cd #{name}/app && mkdir models`
18
+ puts "created #{name}/app/models"
19
+ `touch #{name}/app/run.rb`
20
+ `echo "class App\n\n def self.run\n # Your code here...\n end\n\nend" >> #{name}/app/run.rb`
21
+ puts "created #{name}/app/run.rb"
22
+ `cd #{name} && bundle init`
23
+ puts "created #{name}/Gemfile"
24
+ `cd #{name} && echo '\ngem "rspec"\ngem "require_all"\ngem "pry"' >> Gemfile`
25
+ puts "added pry and rspec to Gemfile"
26
+ `cd #{name} && mkdir config && touch config/environment.rb`
27
+ `cd #{name} && echo "require 'bundler/setup'\nBundler.require\nrequire_rel '../app'" >> config/environment.rb`
28
+ puts "created #{name}/config/environment.rb"
29
+ `cd #{name} && rspec --init`
30
+ `cd #{name} && echo 'require_relative "../config/environment.rb"' | cat - spec/spec_helper.rb > temp && mv temp spec/spec_helper.rb`
31
+ puts "created #{name}/spec/spec_helper.rb"
32
+ `cd #{name} && touch spec/#{name}_spec.rb`
33
+ `echo "describe "App.run" do\n it 'executes successfully without errors' do\n expect{App.run}.to_not raise_error\n end\nend" >> #{name}/spec/#{name}_spec.rb`
34
+ puts "created #{name}/spec/#{name}_spec.rb"
35
+ `cd #{name} && mkdir tools && touch tools/console.rb`
36
+ `echo "require_relative '../config/environment.rb'\n\ndef reload\n load 'config/environment.rb'\nend\n\n# Insert code here to run before hitting the binding.pry\n# This is a convenient place to define variables and/or set up new object instances,\n# so they will be available to test and play around with in your console\n\nbinding.pry\nputs 'goodbye'" >> #{name}/tools/console.rb`
37
+ puts "created #{name}/tools/console.rb"
38
+ `cd #{name} && bundle`
39
+ end
40
+ end
41
+ end
data/ruby_dir.gemspec ADDED
@@ -0,0 +1,38 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ruby_dir/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruby_dir"
8
+ spec.version = RubyDir::VERSION
9
+ spec.authors = ["matt-mcalister"]
10
+ spec.email = ["matt.mcalister93@gmail.com"]
11
+
12
+ spec.summary = %q{This is a script for generating a basic ruby directory.}
13
+ spec.description = %q{This is a script for generating a basic ruby directory with bundler, rake and rspec integrations.}
14
+ spec.homepage = "https://github.com/matt-mcalister/ruby-dir"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ else
24
+ raise "RubyGems 2.0 or newer is required to protect against " \
25
+ "public gem pushes."
26
+ end
27
+
28
+ # Specify which files should be added to the gem when it is released.
29
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
32
+ end
33
+ spec.executables = ["ruby_dir"]
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_development_dependency "bundler", "~> 2.0"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_dir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - matt-mcalister
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-05 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: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
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
+ description: This is a script for generating a basic ruby directory with bundler,
42
+ rake and rspec integrations.
43
+ email:
44
+ - matt.mcalister93@gmail.com
45
+ executables:
46
+ - ruby_dir
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - bin/console
57
+ - bin/ruby_dir
58
+ - bin/setup
59
+ - lib/ruby_dir.rb
60
+ - lib/ruby_dir/version.rb
61
+ - ruby_dir.gemspec
62
+ homepage: https://github.com/matt-mcalister/ruby-dir
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ allowed_push_host: https://rubygems.org/
67
+ homepage_uri: https://github.com/matt-mcalister/ruby-dir
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.7.6
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: This is a script for generating a basic ruby directory.
88
+ test_files: []