monorepo 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 25656bad331e837e8b890fc8ebf10f0ca8f1c9d4dda5437158506221ee2d8d60
4
+ data.tar.gz: d314c335edf9b6503c61ec8ca66299f743810d76993be0a385efd07b90019cda
5
+ SHA512:
6
+ metadata.gz: 9375f9570d8ffba6a0fe134e7404971d0d8c100ac92b67cf0ac8fe9c13aff16337c08e21e59df429ed4e42cc3e70e5ea0682e4d216cd05402d3f9aa04639a89e
7
+ data.tar.gz: 59b1c2a60d49e0af61352691352d3ae05ce224d21bfe5715858d7e62c499e1a3e445fbbf299306276d20dba9b19e3fdabdc1c6c43c877b700d3976299d006a77
@@ -0,0 +1,20 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+ [*]
8
+ indent_style = space
9
+ indent_size = 2
10
+ end_of_line = lf
11
+ charset = utf-8
12
+ trim_trailing_whitespace = true
13
+ insert_final_newline = true
14
+
15
+ [*.md]
16
+ trim_trailing_whitespace = false
17
+
18
+ [GNUmakefile, makefile, Makefile]
19
+ indent_style = tab
20
+ indent_size = 2
@@ -0,0 +1,15 @@
1
+ /vendor
2
+ Gemfile.lock
3
+ .rubocop_todo.yml
4
+
5
+ /.bundle/
6
+ /.yardoc
7
+ /_yardoc/
8
+ /coverage/
9
+ /doc/
10
+ /pkg/
11
+ /spec/reports/
12
+ /tmp/
13
+
14
+ # rspec failure tracking
15
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,17 @@
1
+ Style/Documentation:
2
+ Enabled: false
3
+
4
+ Style/TrailingCommaInLiteral:
5
+ EnforcedStyleForMultiline: consistent_comma
6
+
7
+ Metrix/BlockLength:
8
+ Enabled: false
9
+
10
+ Metrix/MethodLength:
11
+ Enabled: false
12
+
13
+ Metrics/AbcSize:
14
+ Enabled: false
15
+
16
+ Metrics/PerceivedComplexity:
17
+ Enabled: false
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+
3
+ sudo: false
4
+
5
+ cache: bundler
6
+
7
+ before_install:
8
+ - gem update --system
9
+ - gem install bundler -v 1.16.1
10
+ rvm:
11
+ - 2.4.2
12
+
13
+ script:
14
+ - bundle exec rake lint
15
+ - bundle exec rake spec
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at mugil.cephalus+ciconia.local@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in monorepo.gemspec
8
+ gemspec
9
+
10
+ gem 'thor'
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 kamataryo
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.
@@ -0,0 +1,70 @@
1
+ # Monorepo
2
+
3
+ [![Build Status](https://travis-ci.org/kamataryo/monorepo.svg?branch=master)](https://travis-ci.org/kamataryo/monorepo)
4
+
5
+ Ruby based monolepo management tool like [Lerna](https://lernajs.io/).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'monorepo'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install monorepo
22
+
23
+ ## Usage
24
+
25
+ ## `monorepo init`
26
+
27
+ Initialize Monorepo repo.
28
+
29
+ ```shell
30
+ $ monorepo init --config_filename ./Monorepofile
31
+ $ monorepo init -c ./Monorepofile
32
+ $ monorepo init --gems specified_gem_folder
33
+ $ monorepo init -g specified_gem_folder
34
+ ```
35
+
36
+ ## `monorepo exec`
37
+
38
+ Exec commands in each package.
39
+
40
+ ```shell
41
+ $ monorepo exec [COMMAND]
42
+ $ monorepo exec [COMMAND] -c ./Monorepofile
43
+ ```
44
+
45
+ ## `monorepo rake`
46
+
47
+ Run rake task in each package.
48
+
49
+ ```shell
50
+ $ monorepo rake
51
+ $ monorepo rake [TASK]
52
+ ```
53
+
54
+ ## Development
55
+
56
+ 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.
57
+
58
+ 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).
59
+
60
+ ## Contributing
61
+
62
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kamataryo/monorepo. 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.
63
+
64
+ ## License
65
+
66
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
67
+
68
+ ## Code of Conduct
69
+
70
+ Everyone interacting in the Monorepo project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kamataryo/monorepo/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :lint do
5
+ system 'bundle exec rubocop'
6
+ end
7
+
8
+ task l: :lint
9
+
10
+ RSpec::Core::RakeTask.new(:spec)
11
+
12
+ task s: [:spec]
13
+ task test: [:spec]
14
+ task t: [:test]
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'monorepo'
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,4 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require './lib/monorepo'
4
+ MonorepoCLI.start(ARGV)
@@ -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,35 @@
1
+ class MonorepoCLI
2
+ desc 'exec [COMMAND]', 'exec commands at all the monorepo repo'
3
+ method_option :config_filename, aliases: '-c'
4
+ method_option :bundler, aliases: '-b'
5
+
6
+ def exec(command_str)
7
+ config_filename = options[:config_filename] || ''
8
+ conf = MonorepoCLI.load_config(config_filename)
9
+
10
+ unless conf
11
+ puts 'no configuration'
12
+ exit! 1
13
+ end
14
+
15
+ gems = conf['gems']
16
+ subdirs = Dir.glob(gems).select { |o| File.directory?(o) }
17
+
18
+ if subdirs.empty?
19
+ puts 'no gems'
20
+ exit! 2
21
+ end
22
+
23
+ current = Dir.pwd
24
+ bundler = options[:bundler] || conf['bundler']
25
+
26
+ local_command_str = bundler ? "bundle exec #{command_str}" : command_str
27
+
28
+ subdirs.each do |gem|
29
+ Dir.chdir gem
30
+ puts "executing `#{local_command_str}` at #{gem}..."
31
+ system local_command_str
32
+ Dir.chdir current
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,32 @@
1
+ class MonorepoCLI
2
+ desc 'init', 'init monorepo repo'
3
+ method_option :gems, aliases: '-g'
4
+ method_option :config_filename, aliases: '-c'
5
+ method_option :bundler, aliases: '-b'
6
+
7
+ def init
8
+ gem_location = options[:gems] || 'gems'
9
+ config_filename = options[:config_filename] || './Monorepofile'
10
+ bundler =
11
+ if %w[TRUE YES Y].include?((options[:bundler] || '').upcase)
12
+ 'yes'
13
+ else
14
+ 'no'
15
+ end
16
+
17
+ specified_config = {
18
+ 'monorepo' => VERSION,
19
+ 'gems' => "#{gem_location}/*",
20
+ 'bundler' => bundler,
21
+ }
22
+
23
+ File.open(config_filename, 'w') { |f| f.write(specified_config.to_yaml) }
24
+
25
+ # gem directory
26
+ if Dir.exist? "./#{gem_location}"
27
+ puts "gem directory`#{gem_location}` already exists."
28
+ else
29
+ Dir.mkdir "./#{gem_location}"
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,10 @@
1
+ class MonorepoCLI
2
+ desc 'rake [command]', 'exec rake task at all the monorepo repo'
3
+ method_option :config_filename, aliases: '-c'
4
+ method_option :bundler, aliases: '-b'
5
+
6
+ def rake(command_str = '')
7
+ rake_command_str = command_str == '' ? 'rake' : "rake #{command_str}"
8
+ exec(rake_command_str)
9
+ end
10
+ end
@@ -0,0 +1,35 @@
1
+ require 'thor'
2
+ require_relative './version'
3
+
4
+ class MonorepoCLI < Thor
5
+ VERSION = MONOREPO_VERSION
6
+ CONFIG_FILE_NAME = [
7
+ 'Monorepofile',
8
+ 'Monorepofile.yml',
9
+ 'Monorepofile.yaml',
10
+ 'monorepofile',
11
+ 'monorepofile.yml',
12
+ 'monorepofile.yaml',
13
+ ].freeze
14
+
15
+ def self.load_config(filename = '')
16
+ config_filenames =
17
+ if filename == ''
18
+ CONFIG_FILE_NAME
19
+ else
20
+ [filename, *CONFIG_FILE_NAME]
21
+ end
22
+
23
+ config_filenames.each do |config_filename|
24
+ if File.exist?(config_filename)
25
+ config = YAML.load_file(config_filename)
26
+ return config
27
+ end
28
+ end
29
+ nil
30
+ end
31
+ end
32
+
33
+ require_relative './commands/init'
34
+ require_relative './commands/exec'
35
+ require_relative './commands/rake'
@@ -0,0 +1 @@
1
+ MONOREPO_VERSION = '0.0.1'.freeze
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require './lib/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'monorepo'
8
+ spec.version = MONOREPO_VERSION
9
+ spec.authors = ['kamataryo']
10
+ spec.email = ['mugil.cephalus+github.com@gmail.com']
11
+
12
+ spec.summary = 'Monorepo management tool'
13
+ spec.description = 'GEM based monorepo management tool'
14
+ spec.homepage = 'https://github.com/kamataryo/monorepo'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_runtime_dependency 'thor'
25
+ spec.add_development_dependency 'bundler', '~> 1.16'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'rubocop'
29
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: monorepo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - kamataryo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
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
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
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
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !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
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: GEM based monorepo management tool
84
+ email:
85
+ - mugil.cephalus+github.com@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".bundle/config"
91
+ - ".editorconfig"
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".rubocop.yml"
95
+ - ".travis.yml"
96
+ - CODE_OF_CONDUCT.md
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - bin/console
102
+ - bin/monorepo
103
+ - bin/setup
104
+ - lib/commands/exec.rb
105
+ - lib/commands/init.rb
106
+ - lib/commands/rake.rb
107
+ - lib/monorepo.rb
108
+ - lib/version.rb
109
+ - monorepo.gemspec
110
+ homepage: https://github.com/kamataryo/monorepo
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.7.3
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Monorepo management tool
134
+ test_files: []