cgem 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5704b88b32f1b8a634b3f4a1a6fc9900e9416025c323320b1bcf8d8434b55a62
4
- data.tar.gz: 62f11ab69b798a755a1afdd8797e6af207c5fafa0c5351099778ef2df787151a
3
+ metadata.gz: 850470bea85e4b1bbe70977391fde6e4547ea5336f8bf129bf2789b99aea944d
4
+ data.tar.gz: e82140bd1953c8de604f9d42a089e2f6f8a80d8884f1cfd255c2ccd7a69ac729
5
5
  SHA512:
6
- metadata.gz: 7f15fcaa325e6b5275990aeeb35788199f26a25e1912f040836ef049f67a8111baabec080bd9046bf46bf2afd68c6a9b88839e438262f1f57c13ceb9822bc1eb
7
- data.tar.gz: edafba100e74a3f9e7ba0f51290a18a35559780fc4c02a4cd0b308aafb7df12926ace5f2d1d2f4a4067f0d6ecec799a21b15507ae159f088d71f1f8296c28f88
6
+ metadata.gz: 28d57c001ef6e9574cde04b4e67d63a5e203835aac3ce2e30d17dd13c61c4392e939229c6b3ebc0a2852ad62b4bebf2557de232a7738e6ced27e3acbb08a7abb
7
+ data.tar.gz: e32fdaa43671195c71c2876834529c1ccaf1d2ad8fa215ca7f17be8216c232458e62698d730cc72cc599534e1543e16e287e9ddaf66b45f4efe7d10c065207a9
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --format documentation
2
2
  --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.9] - 2024-06-07
4
+
5
+ - Initial release
data/README.md CHANGED
@@ -1,12 +1,6 @@
1
1
  # Cgem
2
2
 
3
- Inspired by cnpm, solve gem source switch in China scope!
4
-
5
- ## Installation
6
-
7
- Install it yourself as:
8
-
9
- $ gem install cgem
3
+ Inspired by cnpm, solve gem source switch in China!
10
4
 
11
5
  ## Usage
12
6
 
@@ -21,18 +15,22 @@ cgem status # default
21
15
  cgem current # get current gem source
22
16
  ```
23
17
 
24
- ## Development
18
+ ## Installation
25
19
 
26
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
20
+ Install the gem and add to the application's Gemfile by executing:
27
21
 
28
- 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).
22
+ $ bundle add cgem
29
23
 
30
- ## Contributing
24
+ If bundler is not being used to manage dependencies, install the gem by executing:
31
25
 
32
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cgem. 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.
26
+ $ gem install cgem
33
27
 
28
+ ## Development
34
29
 
35
- ## License
30
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
+
32
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
33
 
37
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
34
+ ## Contributing
38
35
 
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cao7113/cgem.
data/Rakefile CHANGED
@@ -1,6 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ # task default: %i[spec rubocop]
13
+ task default: %i[spec]
data/Taskfile.yml ADDED
@@ -0,0 +1,11 @@
1
+ # https://taskfile.dev
2
+ version: "3"
3
+ tasks:
4
+ mk-higem: bundle gem cgem --exe --no-coc --no-mit --test=rspec --ci=github --linter=rubocop
5
+ ## in higem dir:
6
+ # bin/setup
7
+ # bundle list
8
+ # rake -AT
9
+ # rake spec # run spec
10
+ # bin/console # go into console
11
+ # rake install:local
data/exe/cgem CHANGED
@@ -6,7 +6,7 @@ require 'cgem'
6
6
  class CgemCLI < Thor
7
7
  default_command :status
8
8
 
9
- desc 'list', 'list current gem sources'
9
+ desc 'list', 'list gem sources'
10
10
  def list
11
11
  puts Cgem.gem_sources
12
12
  end
@@ -17,13 +17,13 @@ class CgemCLI < Thor
17
17
  def use(source_key)
18
18
  source_key = source_key.to_s.strip
19
19
  source = Cgem.gem_sources[source_key]
20
- abort "Not fource source for #{source_key}" if source.nil?
20
+ abort "Not found source for #{source_key}" if source.nil?
21
21
  Cgem.set_gemrc_sources(source)
22
22
  Cgem::BundleMirror.new.set(source)
23
23
  puts "==set #{source} as default gem source"
24
24
  end
25
25
 
26
- desc 'status', 'get current gem status'
26
+ desc 'status', 'get current gem source status'
27
27
  def status
28
28
  puts Cgem.gemrc_sources
29
29
  puts Cgem::BundleMirror.new.get
@@ -49,6 +49,16 @@ class CgemCLI < Thor
49
49
  abort "Please use source key in #{Cgem.gem_sources.keys}" if source.start_with?('http')
50
50
  use(source)
51
51
  end
52
+
53
+ desc 'path', 'show current cgem sources path'
54
+ def path
55
+ puts Cgem.sources_path
56
+ end
57
+
58
+ desc 'paths', 'show all supported cgem sources path in order'
59
+ def paths
60
+ pp Cgem.sources_paths
61
+ end
52
62
  end
53
63
 
54
64
  CgemCLI.start
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cgem
2
4
  class BundleMirror
3
5
  attr_accessor :target, :mirror
data/lib/cgem/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cgem
2
- VERSION = "0.1.7"
4
+ VERSION = "0.1.9"
3
5
  end
data/lib/cgem.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require "cgem/version"
3
5
  require "cgem/bundle_mirror"
@@ -9,16 +11,20 @@ module Cgem
9
11
  end
10
12
 
11
13
  def gem_sources
12
- configured_info['gem_sources'] rescue {}
14
+ configured_info['gem_sources']
15
+ #rescue {}
13
16
  end
14
17
 
15
18
  def configured_info
16
- YAML.load(File.read(sources_path))
19
+ YAML.load(File.read(sources_path), aliases: true)
17
20
  end
18
21
 
19
22
  def sources_path
20
- paths = [ env_sources_path, dot_sources_path, default_sources_path]
21
- paths.compact.find { |p| File.exists?(p) }
23
+ sources_paths.find { |p| File.exist?(p) }
24
+ end
25
+
26
+ def sources_paths
27
+ [env_sources_path, dot_sources_path, default_sources_path].compact
22
28
  end
23
29
 
24
30
  def env_sources_path
@@ -45,7 +51,7 @@ module Cgem
45
51
 
46
52
  def set_gemrc_sources(source)
47
53
  settings = {}
48
- if File.exists?(dot_gemrc)
54
+ if File.exist?(dot_gemrc)
49
55
  settings = YAML.load(File.read(dot_gemrc))
50
56
  end
51
57
  settings[:sources] = ["#{source.chomp('/')}/"]
@@ -53,7 +59,7 @@ module Cgem
53
59
  end
54
60
 
55
61
  def gemrc_sources
56
- return unless File.exists?(dot_gemrc)
62
+ return unless File.exist?(dot_gemrc)
57
63
  settings = YAML.load(File.read(dot_gemrc))
58
64
  settings[:sources]
59
65
  end
data/lib/default.yml CHANGED
@@ -2,7 +2,6 @@
2
2
  gem_sources:
3
3
  rubygems: &default https://rubygems.org
4
4
  default: *default
5
- #https://gems.ruby-china.org
6
5
  rubychina: &rchina https://gems.ruby-china.com
7
6
  rchina: *rchina
8
7
  taobao: https://ruby.taobao.org
data/sig/cgem.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Cgem
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata CHANGED
@@ -1,100 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
- - Ruijian Cao
8
- autorequire:
7
+ - Ryn Cao
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-19 00:00:00.000000000 Z
11
+ date: 2024-06-07 00:00:00.000000000 Z
12
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: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: thor
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - ">="
17
+ - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
19
+ version: '1.3'
38
20
  - - ">="
39
21
  - !ruby/object:Gem::Version
40
- version: '0'
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
22
+ version: 1.3.1
23
+ type: :runtime
49
24
  prerelease: false
50
25
  version_requirements: !ruby/object:Gem::Requirement
51
26
  requirements:
52
27
  - - "~>"
53
28
  - !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
- - - "~>"
29
+ version: '1.3'
30
+ - - ">="
67
31
  - !ruby/object:Gem::Version
68
- version: '3.0'
69
- description: Change gem sources easily!
32
+ version: 1.3.1
33
+ description: Switch gem sources easily!
70
34
  email:
71
- - cao7113@hotmail.com
35
+ - cao7113@gmail.com
72
36
  executables:
73
37
  - cgem
74
38
  extensions: []
75
39
  extra_rdoc_files: []
76
40
  files:
77
- - ".gitignore"
78
41
  - ".rspec"
79
- - ".travis.yml"
80
- - CODE_OF_CONDUCT.md
81
- - Gemfile
82
- - LICENSE.txt
42
+ - ".rubocop.yml"
43
+ - CHANGELOG.md
83
44
  - README.md
84
45
  - Rakefile
85
- - bin/console
86
- - bin/setup
87
- - cgem.gemspec
46
+ - Taskfile.yml
88
47
  - exe/cgem
89
48
  - lib/cgem.rb
90
49
  - lib/cgem/bundle_mirror.rb
91
50
  - lib/cgem/version.rb
92
51
  - lib/default.yml
52
+ - sig/cgem.rbs
93
53
  homepage: https://github.com/cao7113/cgem
94
- licenses:
95
- - MIT
96
- metadata: {}
97
- post_install_message:
54
+ licenses: []
55
+ metadata:
56
+ allowed_push_host: https://rubygems.org
57
+ homepage_uri: https://github.com/cao7113/cgem
58
+ source_code_uri: https://github.com/cao7113/cgem
59
+ changelog_uri: https://github.com/cao7113/cgem
60
+ post_install_message:
98
61
  rdoc_options: []
99
62
  require_paths:
100
63
  - lib
@@ -102,16 +65,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
65
  requirements:
103
66
  - - ">="
104
67
  - !ruby/object:Gem::Version
105
- version: '0'
68
+ version: 3.0.0
106
69
  required_rubygems_version: !ruby/object:Gem::Requirement
107
70
  requirements:
108
71
  - - ">="
109
72
  - !ruby/object:Gem::Version
110
73
  version: '0'
111
74
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.7.6
114
- signing_key:
75
+ rubygems_version: 3.5.9
76
+ signing_key:
115
77
  specification_version: 4
116
- summary: Change gem sources easily!
78
+ summary: Switch gem sources easily!
117
79
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- !exe
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.3
5
- before_install: gem install bundler -v 1.12.5
data/CODE_OF_CONDUCT.md DELETED
@@ -1,49 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at cao7113@hotmail.com. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Ruijian Cao
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/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "cgem"
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
data/bin/setup DELETED
@@ -1,8 +0,0 @@
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/cgem.gemspec DELETED
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cgem/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cgem"
8
- spec.version = Cgem::VERSION
9
- spec.authors = ["Ruijian Cao"]
10
- spec.email = ["cao7113@hotmail.com"]
11
-
12
- spec.summary = %q{Change gem sources easily!}
13
- spec.description = spec.summary
14
- spec.homepage = "https://github.com/cao7113/cgem"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_dependency "bundler"
23
- spec.add_dependency "thor"
24
-
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec", "~> 3.0"
27
- end