centuria 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0378dc5709d15076b4913f7f485b50a455f87860c332d948f16e3f0be7b8251e'
4
- data.tar.gz: 0a97b2f85010b024d9d358da7c7154c57319f6921a0ab9c5d1c461fd509e3ab8
3
+ metadata.gz: b0181ae250f9a25f0b9ef88444b8a39f975683652a61f467d741b8d30dd8ab30
4
+ data.tar.gz: 21b45f18f8560d3020cdc6bc47059b3c4b7c48a20ac412c08cc974eea2cb5fff
5
5
  SHA512:
6
- metadata.gz: 49bbc080a7516b6461b28d743b93bcd42abddcee6e27cb557ad064befd74e1862010ce8c482ef511af5fd44346c60c7cd8a87e58575ad3a961d8fec4bdb62437
7
- data.tar.gz: 0e0686defbd8e1fda3dc02c15f811362878c8cafdcd4801cbb68d80074fb00387d48fe53013f7bf07d8b0ae823a601ca82d028b305824be489c109c94502f305
6
+ metadata.gz: 71ae5a8122cfa9dd9c9f8f997a55abb92b0faad18c0e273ed71a6b10257d7bb769811f7a006eb4bc3e2f0a811007eed458e7ad2b2b55377fc3f26d9b4ec101cc
7
+ data.tar.gz: 4e79096aeeadcabcc015000f4f52d8f52a804a12f470b6456c56181887a6b8a45696ed1e0458f4f1ab99395e0737a4b87bd09caf3e495577883e3db421ceec6a
data/exe/cent CHANGED
@@ -6,11 +6,17 @@ module Cent
6
6
  class CLI < Thor
7
7
  package_name "Centuria"
8
8
 
9
- map %w[-v --version] => :__version
10
- desc "[-v, --version]", "you can confirm the version of Centuria"
9
+ default_command :default
10
+ class_option :version, aliases: '-v', type: :boolean, default: false
11
+ class_option :help, aliases: '-h', type: :boolean, default: false
11
12
 
12
- def __version
13
- puts "Centuria #{Centuria.gem_version}"
13
+ desc "", "default command"
14
+ def default
15
+ if options[:version]
16
+ say "Centuria #{Centuria.version}"
17
+ else
18
+ self.help
19
+ end
14
20
  end
15
21
 
16
22
  register(Create, "new", "new [NAME]", "you can generate text file for memo")
@@ -1,8 +1,8 @@
1
1
  $LOAD_PATH << File.expand_path("./centuria", __dir__)
2
2
 
3
3
  require "centuria/version"
4
- require "generator/commands"
5
- require "generator/gene_base"
4
+ require "commands/commands"
5
+ require "generators/gene_base"
6
6
 
7
7
  module Centuria
8
8
  class Error < StandardError; end
@@ -1,8 +1,7 @@
1
- require "generator/gene_base"
1
+ require "generators/gene_base"
2
2
 
3
3
  class Clear < Thor::Group
4
4
  include Thor::Actions
5
- include GeneratorBase::Template
6
5
 
7
6
  argument :name
8
7
 
@@ -0,0 +1,10 @@
1
+ module Centuria
2
+ module GeneratorCmd
3
+ gene_scripts = %w(clear tinker)
4
+ gene_scripts.each do |script|
5
+ require "commands/#{script}"
6
+ end
7
+
8
+ require "generators/create"
9
+ end
10
+ end
@@ -10,7 +10,7 @@ module Centuria
10
10
 
11
11
  MAJOR = 0
12
12
  MINOR = 2
13
- TINY = 3
13
+ TINY = 4
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY].compact.join(".")
16
16
  end
@@ -0,0 +1,47 @@
1
+ require "generators/gene_base"
2
+
3
+ class Create < Thor::Group
4
+ include Thor::Actions
5
+ include GeneratorBase::Template
6
+
7
+ argument :file_name
8
+
9
+ def self.source_root
10
+ File.dirname(__FILE__)
11
+ end
12
+
13
+ def create_template
14
+
15
+ if !use_symbol?(file_name)
16
+
17
+ files = %w(lib/app.rb Gemfile)
18
+ files.each do |file|
19
+ template "templates/#{file}", "#{file_name}/#{file}"
20
+ end
21
+
22
+ template "templates/ruby-version.tt", "#{file_name}/.ruby-version"
23
+ create_file "#{file_name}/README.md"
24
+
25
+ comment(file_name)
26
+ else
27
+ puts "your app name is include symbol cannot use this.\nplease one more."
28
+ end
29
+
30
+ end
31
+
32
+ private
33
+
34
+ def use_symbol?(file)
35
+ match_str = file.match(/\W/)
36
+ if !match_str.nil?
37
+ match_str[0].is_a?(String)
38
+ else
39
+ false
40
+ end
41
+ end
42
+
43
+ def comment(file)
44
+ say "[!]warning: please write yourself readme file"
45
+ say "template was successfully! please check your app: #{file}", :green
46
+ end
47
+ end
@@ -5,11 +5,11 @@ module GeneratorBase
5
5
  module Template
6
6
 
7
7
  def templater(file)
8
- template("../templates/#{file}.tt", "#{file_name}/#{file}")
8
+ template("templates/#{file}.tt", "#{file_name}/#{file}")
9
9
  end
10
10
 
11
11
  def make_dir(dir)
12
- directory("../templates/#{dir}", "#{file_name}/#{dir}")
12
+ directory("templates/#{dir}", "#{file_name}/#{dir}")
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+
6
+ ruby <%= "'#{RUBY_VERSION}'" -%>
7
+
8
+ # this application gem
9
+ gem 'centuria'
10
+
11
+ # command line gem for centuria
12
+ gem 'thor'
@@ -0,0 +1,2 @@
1
+ class Application
2
+ end
@@ -0,0 +1 @@
1
+ <%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: centuria
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kohei
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-10 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,14 +74,15 @@ files:
74
74
  - centuria.gemspec
75
75
  - exe/cent
76
76
  - lib/centuria.rb
77
+ - lib/centuria/commands/clear.rb
78
+ - lib/centuria/commands/commands.rb
79
+ - lib/centuria/commands/tinker.rb
77
80
  - lib/centuria/gem_version.rb
78
- - lib/centuria/generator/clear.rb
79
- - lib/centuria/generator/commands.rb
80
- - lib/centuria/generator/create.rb
81
- - lib/centuria/generator/gene_base.rb
82
- - lib/centuria/generator/tinker.rb
83
- - lib/centuria/templates/lib/app.txt.tt
84
- - lib/centuria/templates/lib/version.rb.tt
81
+ - lib/centuria/generators/create.rb
82
+ - lib/centuria/generators/gene_base.rb
83
+ - lib/centuria/generators/templates/Gemfile.tt
84
+ - lib/centuria/generators/templates/lib/app.rb.tt
85
+ - lib/centuria/generators/templates/ruby-version.tt
85
86
  - lib/centuria/version.rb
86
87
  homepage: https://github.com/Koh0412/centuria
87
88
  licenses:
@@ -1,10 +0,0 @@
1
- # require "generator/clear"
2
- # require "generator/create"
3
-
4
- gene_scripts = %w(clear create tinker)
5
- gene_scripts.each do |script|
6
- require "generator/#{script}"
7
- end
8
-
9
- module GeneratorCmd
10
- end
@@ -1,30 +0,0 @@
1
- require "generator/gene_base"
2
-
3
- class Create < Thor::Group
4
- include Thor::Actions
5
- include GeneratorBase::Template
6
-
7
- argument :file_name
8
-
9
- def self.source_root
10
- File.dirname(__FILE__)
11
- end
12
-
13
- def create_lib_file
14
- templater "lib/app.txt"
15
- end
16
-
17
- def create_version
18
- templater "lib/version.rb"
19
- end
20
-
21
- def create_readme
22
- create_file "#{file_name}/README.md"
23
- say "[!]warning: please write yourself readme file"
24
- end
25
-
26
- def comment
27
- say "template was successfully! please check your app: #{file_name}", :green
28
- end
29
-
30
- end
@@ -1 +0,0 @@
1
- --- this is <%=file_name%>.txt. this txtfile can write memo. ---
@@ -1,3 +0,0 @@
1
- module <%=file_name.capitalize%>
2
- VERSION = "0.1.0"
3
- end