rama 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bff61477878c8d2ea45af9e676a829351ae9998cf840e9a05eb00249842be8f0
4
+ data.tar.gz: 712a18956a30221b220215de2efa37209f686993831bcce207a26175b9ffa156
5
+ SHA512:
6
+ metadata.gz: 13520810e0c31adebd9ed00d077bcf14f78d0d70f2c07b8d7e65a981ceccb0bba49dee969fd328288b927ea5681d6550474b5a15555369d0f35898418c122e17
7
+ data.tar.gz: 99ef3bf3aab7e7568a0db2f518d09d7dcecb3a1a8a45f59e250a33f69998df68adac10f7e1b300b3d76f5b727767b2464826fb569d670091e69b14d2758dd9c1
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
10
+ Gemfile.lock
11
+ /.vscode
@@ -0,0 +1,48 @@
1
+ # Common configuration.
2
+
3
+ AllCops:
4
+ RubyInterpreters:
5
+ - ruby
6
+ - macruby
7
+ - rake
8
+ - jruby
9
+ - rbx
10
+
11
+ Layout/EmptyLinesAroundAttributeAccessor:
12
+ Enabled: true
13
+
14
+ Layout/SpaceAroundMethodCallOperator:
15
+ Enabled: true
16
+
17
+ Lint/DeprecatedOpenSSLConstant:
18
+ Enabled: true
19
+
20
+ Lint/MixedRegexpCaptureTypes:
21
+ Enabled: true
22
+
23
+ Lint/RaiseException:
24
+ Enabled: true
25
+
26
+ Lint/StructNewOverride:
27
+ Enabled: true
28
+
29
+ Style/ExponentialNotation:
30
+ Enabled: true
31
+
32
+ Style/HashEachMethods:
33
+ Enabled: true
34
+
35
+ Style/HashTransformKeys:
36
+ Enabled: true
37
+
38
+ Style/HashTransformValues:
39
+ Enabled: true
40
+
41
+ Style/RedundantRegexpCharacterClass:
42
+ Enabled: true
43
+
44
+ Style/RedundantRegexpEscape:
45
+ Enabled: true
46
+
47
+ Style/SlicingWithRange:
48
+ Enabled: true
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in rama.gemspec
6
+ gemspec
7
+
8
+ gem 'minitest'
9
+ gem 'rake', '~> 12.0'
10
+ gem 'rubocop'
11
+ gem 'rubocop-performance'
12
+ gem 'simplecov', '0.17.1'
@@ -0,0 +1,36 @@
1
+ # Rama
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rama`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rama'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rama
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rama.
36
+
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ task default: :spec
7
+
8
+ Rake::TestTask.new do |t|
9
+ t.libs.push('lib')
10
+ t.verbose = true
11
+ t.test_files = FileList['test/*_test.rb']
12
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rama"
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__)
@@ -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,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'rama'
5
+
6
+ Rama::Command.new(ARGV).execute
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rama/version'
4
+ require 'rama/project'
5
+ require 'rama/command'
6
+
7
+ module Rama
8
+ class Error < StandardError; end
9
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rama/project'
4
+
5
+ module Rama
6
+ class Command
7
+ attr_reader :args
8
+
9
+ def initialize(args)
10
+ @args = args
11
+ end
12
+
13
+ def execute
14
+ do_execute
15
+ rescue StandardError
16
+ abort('Please use --help option for a listing of valid options')
17
+ end
18
+
19
+ private
20
+
21
+ def do_execute
22
+ if init?
23
+ create_project
24
+ elsif show_help?
25
+ help
26
+ else
27
+ raise StandardError
28
+ end
29
+ end
30
+
31
+ def init?
32
+ args.count > 1 && args[0] == 'init'
33
+ end
34
+
35
+ def create_project
36
+ _, name, *options = args
37
+
38
+ Rama::Project.new(name, options).create
39
+ end
40
+
41
+ def show_help?
42
+ args.empty? || help?
43
+ end
44
+
45
+ def help?
46
+ args.count == 1 && ['-h', '--help'].include?(args[0])
47
+ end
48
+
49
+ def help
50
+ puts 'Usage: rama init PROJECT_NAME [options]'
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rama
4
+ class Project
5
+ def initialize(name, options = [])
6
+ @name = name
7
+ @options = options
8
+ @directory = "#{Dir.getwd}/#{name}"
9
+ end
10
+
11
+ def create
12
+ puts "Creating project #{@name}"
13
+ create_basic_files
14
+ end
15
+
16
+ private
17
+
18
+ def create_basic_files
19
+ create_project_directory
20
+ create_lib_directory
21
+ create_sources_directory
22
+ create_gemfile_file
23
+ create_gitignore_file
24
+ create_module_file
25
+ end
26
+
27
+ def create_project_directory
28
+ FileUtils.mkdir_p(@directory)
29
+ end
30
+
31
+ def create_lib_directory
32
+ FileUtils.mkdir_p("#{@directory}/lib")
33
+ end
34
+
35
+ def create_sources_directory
36
+ FileUtils.mkdir_p("#{@directory}/lib/#{@name}")
37
+ end
38
+
39
+ def create_gemfile_file
40
+ File.write("#{@directory}/Gemfile", gemfile_content)
41
+ end
42
+
43
+ def gemfile_content
44
+ "# frozen_string_literal: true\n\n" \
45
+ "source 'https://rubygems.org'\n"
46
+ end
47
+
48
+ def create_gitignore_file
49
+ resource_path = File.expand_path('../../resource', __dir__)
50
+ FileUtils.cp("#{resource_path}/_.gitignore", "#{@directory}/.gitignore")
51
+ end
52
+
53
+ def create_module_file
54
+ File.write("#{@directory}/lib/#{@name}.rb", module_file_content)
55
+ end
56
+
57
+ def module_file_content
58
+ "# frozen_string_literal: true\n\n" \
59
+ "module #{module_name}\n" \
60
+ "end\n"
61
+ end
62
+
63
+ def module_name
64
+ @name.downcase.split('_').map!(&:capitalize).join
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rama
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require_relative 'lib/rama/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'rama'
10
+ spec.version = Rama::VERSION
11
+ spec.authors = ['ramonsantos']
12
+ spec.email = ['ramonsantos.pe@gmail.com']
13
+
14
+ spec.summary = 'Ruby project generator.'
15
+ spec.description = 'Ruby project generator.'
16
+ spec.homepage = 'https://github.com/ramonsantos/rama'
17
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
18
+
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = 'https://github.com/ramonsantos/rama'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/ramonsantos/rama'
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_development_dependency 'rake'
33
+ spec.add_development_dependency 'rubocop'
34
+ spec.add_development_dependency 'rubocop-performance'
35
+ spec.add_development_dependency 'simplecov'
36
+ end
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rama
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ramonsantos
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-24 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: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-performance
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Ruby project generator.
70
+ email:
71
+ - ramonsantos.pe@gmail.com
72
+ executables:
73
+ - rama
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rubocop.yml"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - exe/rama
85
+ - lib/rama.rb
86
+ - lib/rama/command.rb
87
+ - lib/rama/project.rb
88
+ - lib/rama/version.rb
89
+ - rama.gemspec
90
+ - resource/_.gitignore
91
+ homepage: https://github.com/ramonsantos/rama
92
+ licenses: []
93
+ metadata:
94
+ homepage_uri: https://github.com/ramonsantos/rama
95
+ source_code_uri: https://github.com/ramonsantos/rama
96
+ changelog_uri: https://github.com/ramonsantos/rama
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 2.5.0
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubygems_version: 3.1.2
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Ruby project generator.
116
+ test_files: []