monorepo 0.0.4 → 0.1.0

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: 9239dc8817c27229af45ae91e94b0bb4e32be221bf8b408f671cf0d3b627d52a
4
- data.tar.gz: 100d30035993ccc68bf2abf0277b7c92921655ad54c635f9503ca550fbaca4a0
3
+ metadata.gz: c8be4c1125c08a2a79204f3e7d6d637dcab36b7d6626025dbbfb21d060988589
4
+ data.tar.gz: 3e9d63ce2d472e17584a87eeb0f1f95328baf173b262907c97398cde539eb53b
5
5
  SHA512:
6
- metadata.gz: 5972fc816c23b98d6391c1d27567d18413f02e92cc7c313f1c628a4b875f17b8fc846397cb3127c0d2d5ba514fa125eeae52caf37d36ac4d4e3576a5a3590738
7
- data.tar.gz: e0a9d002dccbadb42375e33dba3c6a256e17ef795eb818c10036478dedd0c3f70d0595b596bbbd8ddb1c8fc7390f0a62c1ce78c75d7e36081b04ede9bbb2a323
6
+ metadata.gz: b0b619f9bff6658e99757ab677864eda6189e48f0990d8f4adc4e77f366a3f2354263934251ff18ac17254495d137669fdfc39ad8dc8ed5fab1ec7f4160ef071
7
+ data.tar.gz: 7726ab89bd95e6cdc2ef2f6fda03b62a9ae6b3ae27026b8790f72ede20d2883f0fd44b8c6ae4ecc35d073e5b72723c26da139fea1b4010e2674aa18922dd3f9f
data/.rubocop.yml CHANGED
@@ -4,10 +4,10 @@ Style/Documentation:
4
4
  Style/TrailingCommaInLiteral:
5
5
  EnforcedStyleForMultiline: consistent_comma
6
6
 
7
- Metrix/BlockLength:
7
+ Metrics/BlockLength:
8
8
  Enabled: false
9
9
 
10
- Metrix/MethodLength:
10
+ Metrics/MethodLength:
11
11
  Enabled: false
12
12
 
13
13
  Metrics/AbcSize:
@@ -15,3 +15,9 @@ Metrics/AbcSize:
15
15
 
16
16
  Metrics/PerceivedComplexity:
17
17
  Enabled: false
18
+
19
+ Metrics/CyclomaticComplexity:
20
+ Enabled: false
21
+
22
+ AllCops:
23
+ TargetRubyVersion: 2.2
data/.travis.yml CHANGED
@@ -8,6 +8,8 @@ before_install:
8
8
  - gem update --system
9
9
  - gem install bundler -v 1.16.1
10
10
  rvm:
11
+ - 2.2.8
12
+ - 2.3.5
11
13
  - 2.4.2
12
14
 
13
15
  script:
@@ -0,0 +1,8 @@
1
+ class MonorepoCLI
2
+ desc 'bootstrap', 'bootstrap each repo'
3
+ method_option :config_filename, aliases: '-c'
4
+
5
+ def bootstrap(*args)
6
+ exec ['bundle', *args].join(' ')
7
+ end
8
+ end
data/lib/commands/exec.rb CHANGED
@@ -3,27 +3,30 @@ class MonorepoCLI
3
3
  method_option :config_filename, aliases: '-c'
4
4
  method_option :bundler, aliases: '-b'
5
5
 
6
- def exec(command_str)
6
+ def exec(*args)
7
+ command_str = args.join ' '
7
8
  config_filename = options[:config_filename] || ''
8
- conf = MonorepoCLI.load_config(config_filename)
9
+ config = MonorepoCLI.load_config(config_filename)
9
10
 
10
- unless conf
11
- puts 'no configuration'
11
+ unless config
12
+ STDERR.print "\e[31m[error]\e[0m no configuration file found.\n"
13
+ STDERR.print 'run `monorepo init`'
12
14
  exit! 1
13
15
  end
14
16
 
15
- gems = conf['gems']
17
+ gems = config['gems']
16
18
  subdirs = Dir.glob(gems).select { |o| File.directory?(o) }
17
19
 
18
20
  if subdirs.empty?
19
- puts 'no gems'
21
+ STDERR.print "\e[31m[error]\e[0m gem folder `#{gems}` not found.\n"
22
+ STDERR.print 'run `monorepo init`'
20
23
  exit! 2
21
24
  end
22
25
 
23
26
  current = Dir.pwd
24
27
  bundler =
25
28
  options[:bundler] ||
26
- %w[YES Y TRUE].include?(conf['bundler'].upcase)
29
+ %w[YES Y TRUE].include?(config['bundler'].upcase)
27
30
 
28
31
  local_command_str = bundler ? "bundle exec #{command_str}" : command_str
29
32
 
data/lib/commands/ls.rb CHANGED
@@ -1,7 +1,29 @@
1
1
  class MonorepoCLI
2
- desc 'ls', 'exec rake task at all the monorepo repo'
2
+ desc 'ls', 'list all repo'
3
+ method_option :config_filename, aliases: '-c'
3
4
 
4
5
  def ls
5
- exec('ls')
6
+ config_filename = options[:config_filename] || ''
7
+ config = MonorepoCLI.load_config(config_filename)
8
+
9
+ unless config
10
+ STDERR.print "\e[31m[error]\e[0m no configuration file found.\n"
11
+ STDERR.print 'run `monorepo init`'
12
+ exit! 1
13
+ end
14
+ gems = config['gems']
15
+ subdirs =
16
+ Dir
17
+ .glob(gems)
18
+ .select { |o| File.directory? o }
19
+ .map { |dir| File.basename dir }
20
+
21
+ if subdirs.empty?
22
+ STDERR.print "\e[31m[error]\e[0m gem folder `#{gems}` not found.\n"
23
+ STDERR.print 'run `monorepo init`'
24
+ exit! 2
25
+ end
26
+
27
+ puts subdirs.join("\n")
6
28
  end
7
29
  end
data/lib/commands/rake.rb CHANGED
@@ -3,8 +3,7 @@ class MonorepoCLI
3
3
  method_option :config_filename, aliases: '-c'
4
4
  method_option :bundler, aliases: '-b'
5
5
 
6
- def rake(command_str = '')
7
- rake_command_str = command_str == '' ? 'rake' : "rake #{command_str}"
8
- exec(rake_command_str)
6
+ def rake(*args)
7
+ exec(['rake', *args])
9
8
  end
10
9
  end
data/lib/monorepo.rb CHANGED
@@ -12,6 +12,11 @@ class MonorepoCLI < Thor
12
12
  'monorepofile.yaml',
13
13
  ].freeze
14
14
 
15
+ DEFAULT_CONFIG = {
16
+ 'gems' => 'gems/*',
17
+ 'bundler' => 'no',
18
+ }.freeze
19
+
15
20
  def self.load_config(filename = '')
16
21
  config_filenames =
17
22
  if filename == ''
@@ -22,7 +27,7 @@ class MonorepoCLI < Thor
22
27
 
23
28
  config_filenames.each do |config_filename|
24
29
  if File.exist?(config_filename)
25
- config = YAML.load_file(config_filename)
30
+ config = DEFAULT_CONFIG.merge YAML.load_file(config_filename)
26
31
  return config
27
32
  end
28
33
  end
@@ -31,5 +36,7 @@ class MonorepoCLI < Thor
31
36
  end
32
37
 
33
38
  require_relative './commands/init'
39
+ require_relative './commands/bootstrap'
34
40
  require_relative './commands/exec'
35
41
  require_relative './commands/rake'
42
+ require_relative './commands/ls'
data/lib/version.rb CHANGED
@@ -1 +1 @@
1
- MONOREPO_VERSION = '0.0.4'.freeze
1
+ MONOREPO_VERSION = '0.1.0'.freeze
data/monorepo.gemspec CHANGED
@@ -21,9 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_runtime_dependency 'thor'
24
+ spec.required_ruby_version = '>= 2.2.0'
25
+
26
+ spec.add_runtime_dependency 'thor', '~> 0.20'
25
27
  spec.add_development_dependency 'bundler', '~> 1.16'
26
28
  spec.add_development_dependency 'rake', '~> 10.0'
27
29
  spec.add_development_dependency 'rspec', '~> 3.0'
28
- spec.add_development_dependency 'rubocop'
30
+ spec.add_development_dependency 'rubocop', '~> 0.52'
29
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monorepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kamataryo
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.20'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.20'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.52'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.52'
83
83
  description: GEM based monorepo management tool
84
84
  email:
85
85
  - mugil.cephalus+github.com@gmail.com
@@ -102,6 +102,7 @@ files:
102
102
  - bin/console
103
103
  - bin/setup
104
104
  - exe/monorepo
105
+ - lib/commands/bootstrap.rb
105
106
  - lib/commands/exec.rb
106
107
  - lib/commands/init.rb
107
108
  - lib/commands/ls.rb
@@ -121,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
122
  requirements:
122
123
  - - ">="
123
124
  - !ruby/object:Gem::Version
124
- version: '0'
125
+ version: 2.2.0
125
126
  required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  requirements:
127
128
  - - ">="