autowow 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +14 -14
- data/.rspec +2 -2
- data/.rubocop.yml +118 -116
- data/.travis.yml +11 -11
- data/Gemfile +6 -6
- data/Guardfile +22 -22
- data/LICENSE.txt +21 -21
- data/README.md +143 -139
- data/Rakefile +59 -59
- data/autowow.gemspec +41 -41
- data/bin/autowow +5 -5
- data/bin/aw +5 -5
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/autowow.rb +13 -13
- data/lib/autowow/cli.rb +91 -91
- data/lib/autowow/commands/gem.rb +27 -27
- data/lib/autowow/commands/os.rb +11 -11
- data/lib/autowow/commands/rbenv.rb +19 -19
- data/lib/autowow/commands/vcs.rb +87 -87
- data/lib/autowow/decorators/string_decorator.rb +11 -11
- data/lib/autowow/executor.rb +56 -49
- data/lib/autowow/features/fs.rb +49 -49
- data/lib/autowow/features/gem.rb +48 -48
- data/lib/autowow/features/os.rb +16 -16
- data/lib/autowow/features/rbenv.rb +50 -50
- data/lib/autowow/features/vcs.rb +272 -272
- data/lib/autowow/log_formatter.rb +25 -25
- data/lib/autowow/time_difference.rb +29 -29
- data/lib/autowow/version.rb +3 -3
- metadata +3 -3
data/Rakefile
CHANGED
@@ -1,59 +1,59 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
require "logger"
|
4
|
-
@logger = Logger.new(STDOUT)
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
|
8
|
-
desc "Check if source can be required and is correctly required"
|
9
|
-
task :require do
|
10
|
-
dir = File.dirname(__FILE__)
|
11
|
-
gemspec = load_gemspec(dir)
|
12
|
-
|
13
|
-
# Order is important, assert_can_be_required should be run first
|
14
|
-
assert_can_be_required(dir, gemspec)
|
15
|
-
check_source_files_required(dir, gemspec)
|
16
|
-
check_source_files_included(dir, gemspec)
|
17
|
-
end
|
18
|
-
|
19
|
-
def load_gemspec(dir)
|
20
|
-
require "bundler/setup"
|
21
|
-
Gem::Specification.find do |spec|
|
22
|
-
spec.full_gem_path.include?(File.dirname(__FILE__))
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def check_source_files_required(dir, gemspec)
|
27
|
-
require_gem(gemspec)
|
28
|
-
ruby_files = Dir.glob("#{dir}/**/*.rb").reject{ |f| f.include?(
|
29
|
-
required_ruby_files = $LOADED_FEATURES.select { |f| f.include?(dir) }
|
30
|
-
(ruby_files - required_ruby_files).each do |file|
|
31
|
-
@logger.warn("Source file not required when loading gem: #{file.sub("#{dir}/", '')}")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def check_source_files_included(dir, gemspec)
|
36
|
-
ruby_files_relative = Dir.glob("#{dir}/**/*.rb").reject { |f| f.include?(
|
37
|
-
(ruby_files_relative - gemspec.files.select { |f| f.end_with?(
|
38
|
-
@logger.warn("File ignored when building gem because it's not added to git: #{file}")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def assert_can_be_required(dir, gemspec)
|
43
|
-
local_load_paths = $LOAD_PATH.select { |path| path.include?(dir) }
|
44
|
-
$LOAD_PATH.reject! { |path| local_load_paths.include?(path) }
|
45
|
-
begin
|
46
|
-
require_gem(gemspec)
|
47
|
-
rescue LoadError => e
|
48
|
-
@logger.error("Gem source cannot be required relatively: #{e}")
|
49
|
-
raise
|
50
|
-
ensure
|
51
|
-
$LOAD_PATH.push(*local_load_paths)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def require_gem(gemspec)
|
56
|
-
require_relative "lib/#{gemspec.name.gsub('-', '/')}"
|
57
|
-
end
|
58
|
-
|
59
|
-
task :
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "logger"
|
4
|
+
@logger = Logger.new(STDOUT)
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
desc "Check if source can be required and is correctly required"
|
9
|
+
task :require do
|
10
|
+
dir = File.dirname(__FILE__)
|
11
|
+
gemspec = load_gemspec(dir)
|
12
|
+
|
13
|
+
# Order is important, assert_can_be_required should be run first
|
14
|
+
assert_can_be_required(dir, gemspec)
|
15
|
+
check_source_files_required(dir, gemspec)
|
16
|
+
check_source_files_included(dir, gemspec)
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_gemspec(dir)
|
20
|
+
require "bundler/setup"
|
21
|
+
Gem::Specification.find do |spec|
|
22
|
+
spec.full_gem_path.include?(File.dirname(__FILE__))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def check_source_files_required(dir, gemspec)
|
27
|
+
require_gem(gemspec)
|
28
|
+
ruby_files = Dir.glob("#{dir}/**/*.rb").reject { |f| f.include?("/spec/") }
|
29
|
+
required_ruby_files = $LOADED_FEATURES.select { |f| f.include?(dir) }
|
30
|
+
(ruby_files - required_ruby_files).each do |file|
|
31
|
+
@logger.warn("Source file not required when loading gem: #{file.sub("#{dir}/", '')}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def check_source_files_included(dir, gemspec)
|
36
|
+
ruby_files_relative = Dir.glob("#{dir}/**/*.rb").reject { |f| f.include?("/spec/") }.map { |f| f.sub("#{dir}/", "") }
|
37
|
+
(ruby_files_relative - gemspec.files.select { |f| f.end_with?(".rb") }).each do |file|
|
38
|
+
@logger.warn("File ignored when building gem because it's not added to git: #{file}")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def assert_can_be_required(dir, gemspec)
|
43
|
+
local_load_paths = $LOAD_PATH.select { |path| path.include?(dir) }
|
44
|
+
$LOAD_PATH.reject! { |path| local_load_paths.include?(path) }
|
45
|
+
begin
|
46
|
+
require_gem(gemspec)
|
47
|
+
rescue LoadError => e
|
48
|
+
@logger.error("Gem source cannot be required relatively: #{e}")
|
49
|
+
raise
|
50
|
+
ensure
|
51
|
+
$LOAD_PATH.push(*local_load_paths)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def require_gem(gemspec)
|
56
|
+
require_relative "lib/#{gemspec.name.gsub('-', '/')}"
|
57
|
+
end
|
58
|
+
|
59
|
+
task default: [:require, :spec]
|
data/autowow.gemspec
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "autowow/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "autowow"
|
8
|
-
spec.version = Autowow::VERSION
|
9
|
-
spec.authors = ["thisismydesign"]
|
10
|
-
spec.email = ["thisismydesign@users.noreply.github.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Set of commands to AUTOmate Way Of Working}
|
13
|
-
spec.homepage = "https://github.com/thisismydesign/autowow"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
-
end
|
19
|
-
spec.bindir = "bin"
|
20
|
-
spec.executables << 'autowow'
|
21
|
-
spec.executables << 'aw'
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.add_dependency "easy_logging", ">= 0.3.0" # Include logger easily, without redundancy
|
25
|
-
spec.add_dependency "thor" # CLI
|
26
|
-
spec.add_dependency "pastel" # Colorize output of own logger
|
27
|
-
spec.add_dependency "time_difference", "= 0.5.0" # Calculate project age. Fixed version because we refine it :(
|
28
|
-
spec.add_dependency "launchy" # Open project in browser
|
29
|
-
spec.add_dependency "tty-command", ">= 0.7.0" # Execute system commands nicely
|
30
|
-
spec.add_dependency "reflection_utils", ">= 0.3.0" # Invoke module methods without including the module
|
31
|
-
spec.add_dependency "rubocop" # Style check
|
32
|
-
spec.add_dependency "rubocop-rspec" # Style check
|
33
|
-
|
34
|
-
spec.add_development_dependency "bundler", "~> 1.15"
|
35
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
-
spec.add_development_dependency "guard"
|
38
|
-
spec.add_development_dependency "guard-bundler"
|
39
|
-
spec.add_development_dependency "guard-rspec"
|
40
|
-
spec.add_development_dependency "coveralls"
|
41
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "autowow/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "autowow"
|
8
|
+
spec.version = Autowow::VERSION
|
9
|
+
spec.authors = ["thisismydesign"]
|
10
|
+
spec.email = ["thisismydesign@users.noreply.github.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Set of commands to AUTOmate Way Of Working}
|
13
|
+
spec.homepage = "https://github.com/thisismydesign/autowow"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.executables << 'autowow'
|
21
|
+
spec.executables << 'aw'
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "easy_logging", ">= 0.3.0" # Include logger easily, without redundancy
|
25
|
+
spec.add_dependency "thor" # CLI
|
26
|
+
spec.add_dependency "pastel" # Colorize output of own logger
|
27
|
+
spec.add_dependency "time_difference", "= 0.5.0" # Calculate project age. Fixed version because we refine it :(
|
28
|
+
spec.add_dependency "launchy" # Open project in browser
|
29
|
+
spec.add_dependency "tty-command", ">= 0.7.0" # Execute system commands nicely
|
30
|
+
spec.add_dependency "reflection_utils", ">= 0.3.0" # Invoke module methods without including the module
|
31
|
+
spec.add_dependency "rubocop" # Style check
|
32
|
+
spec.add_dependency "rubocop-rspec" # Style check
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "guard"
|
38
|
+
spec.add_development_dependency "guard-bundler"
|
39
|
+
spec.add_development_dependency "guard-rspec"
|
40
|
+
spec.add_development_dependency "coveralls"
|
41
|
+
end
|
data/bin/autowow
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require
|
4
|
-
|
5
|
-
Autowow::CLI.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "autowow"
|
4
|
+
|
5
|
+
Autowow::CLI.start
|
data/bin/aw
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require
|
4
|
-
|
5
|
-
Autowow::CLI.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "autowow"
|
4
|
+
|
5
|
+
Autowow::CLI.start
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "autowow"
|
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__)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "autowow"
|
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__)
|
data/bin/setup
CHANGED
@@ -1,8 +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
|
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/lib/autowow.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
require_relative
|
5
|
-
|
6
|
-
EasyLogging.level = Logger::DEBUG
|
7
|
-
EasyLogging.formatter = proc do |severity, datetime, progname, msg|
|
8
|
-
Autowow::LogFormatter.beautify(severity, msg)
|
9
|
-
end
|
10
|
-
|
11
|
-
require_relative
|
12
|
-
|
13
|
-
module Autowow; end
|
1
|
+
require "easy_logging"
|
2
|
+
require "reflection_utils"
|
3
|
+
|
4
|
+
require_relative "autowow/log_formatter"
|
5
|
+
|
6
|
+
EasyLogging.level = Logger::DEBUG
|
7
|
+
EasyLogging.formatter = proc do |severity, datetime, progname, msg|
|
8
|
+
Autowow::LogFormatter.beautify(severity, msg)
|
9
|
+
end
|
10
|
+
|
11
|
+
require_relative "autowow/cli"
|
12
|
+
|
13
|
+
module Autowow; end
|
data/lib/autowow/cli.rb
CHANGED
@@ -1,91 +1,91 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
|
12
|
-
require_relative
|
13
|
-
|
14
|
-
module Autowow
|
15
|
-
class CLI < Thor
|
16
|
-
map %w[bm] => :branch_merged
|
17
|
-
map %w[grls] => :gem_release
|
18
|
-
map %w[up] => :update_projects
|
19
|
-
map %w[cb] => :clear_branches
|
20
|
-
map %w[au] => :add_upstream
|
21
|
-
map %w[gc] => :gem_clean
|
22
|
-
map %w[rv] => :ruby_versions
|
23
|
-
map %w[gr] => :greet
|
24
|
-
map %w[rpa] => :rubocop_parallel_autocorrect
|
25
|
-
|
26
|
-
desc "branch_merged", "clean working branch and return to master"
|
27
|
-
def branch_merged
|
28
|
-
Autowow::Features::Vcs.branch_merged
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "gem_release", "release gem and return to master"
|
32
|
-
def gem_release
|
33
|
-
Autowow::Features::Gem.gem_release
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "update_projects", "updates idle projects"
|
37
|
-
def update_projects
|
38
|
-
Autowow::Features::Vcs.update_projects
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "clear_branches", "removes unused branches"
|
42
|
-
def clear_branches
|
43
|
-
Autowow::Features::Vcs.clear_branches
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "add_upstream", "adds upstream branch if available"
|
47
|
-
def add_upstream
|
48
|
-
Autowow::Features::Vcs.add_upstream
|
49
|
-
end
|
50
|
-
|
51
|
-
desc "hi", "day starter routine"
|
52
|
-
def hi
|
53
|
-
Autowow::Features::Vcs.hi
|
54
|
-
end
|
55
|
-
|
56
|
-
desc "hi!", "day starter routine for a new start"
|
57
|
-
def hi!
|
58
|
-
Autowow::Features::Vcs.hi!
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "open", "opens project URL in browser"
|
62
|
-
def open
|
63
|
-
Autowow::Features::Vcs.open
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "gem_clean", "cleans unused gems"
|
67
|
-
def gem_clean
|
68
|
-
Autowow::Features::Gem.gem_clean
|
69
|
-
end
|
70
|
-
|
71
|
-
desc "ruby_versions", "shows ruby versions in use"
|
72
|
-
def ruby_versions
|
73
|
-
Autowow::Features::Rbenv.ruby_versions
|
74
|
-
end
|
75
|
-
|
76
|
-
desc "greet", "shows report of repos"
|
77
|
-
def greet
|
78
|
-
Autowow::Features::Vcs.greet
|
79
|
-
end
|
80
|
-
|
81
|
-
desc "rubocop_parallel_autocorrect", "runs rubocop in parallel mode, autocorrects offenses on single thread"
|
82
|
-
def rubocop_parallel_autocorrect
|
83
|
-
Autowow::Features::Gem.rubocop_parallel_autocorrect
|
84
|
-
end
|
85
|
-
|
86
|
-
desc "exec", "runs command"
|
87
|
-
def exec(*cmd)
|
88
|
-
Autowow::Executor.pretty_with_output.run(cmd)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
require_relative "executor"
|
4
|
+
require_relative "decorators/string_decorator"
|
5
|
+
|
6
|
+
require_relative "features/rbenv"
|
7
|
+
require_relative "features/gem"
|
8
|
+
require_relative "features/vcs"
|
9
|
+
require_relative "features/os"
|
10
|
+
require_relative "features/fs"
|
11
|
+
|
12
|
+
require_relative "commands/gem"
|
13
|
+
|
14
|
+
module Autowow
|
15
|
+
class CLI < Thor
|
16
|
+
map %w[bm] => :branch_merged
|
17
|
+
map %w[grls] => :gem_release
|
18
|
+
map %w[up] => :update_projects
|
19
|
+
map %w[cb] => :clear_branches
|
20
|
+
map %w[au] => :add_upstream
|
21
|
+
map %w[gc] => :gem_clean
|
22
|
+
map %w[rv] => :ruby_versions
|
23
|
+
map %w[gr] => :greet
|
24
|
+
map %w[rpa] => :rubocop_parallel_autocorrect
|
25
|
+
|
26
|
+
desc "branch_merged", "clean working branch and return to master"
|
27
|
+
def branch_merged
|
28
|
+
Autowow::Features::Vcs.branch_merged
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "gem_release", "release gem and return to master"
|
32
|
+
def gem_release
|
33
|
+
Autowow::Features::Gem.gem_release
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "update_projects", "updates idle projects"
|
37
|
+
def update_projects
|
38
|
+
Autowow::Features::Vcs.update_projects
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "clear_branches", "removes unused branches"
|
42
|
+
def clear_branches
|
43
|
+
Autowow::Features::Vcs.clear_branches
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "add_upstream", "adds upstream branch if available"
|
47
|
+
def add_upstream
|
48
|
+
Autowow::Features::Vcs.add_upstream
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "hi", "day starter routine"
|
52
|
+
def hi
|
53
|
+
Autowow::Features::Vcs.hi
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "hi!", "day starter routine for a new start"
|
57
|
+
def hi!
|
58
|
+
Autowow::Features::Vcs.hi!
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "open", "opens project URL in browser"
|
62
|
+
def open
|
63
|
+
Autowow::Features::Vcs.open
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "gem_clean", "cleans unused gems"
|
67
|
+
def gem_clean
|
68
|
+
Autowow::Features::Gem.gem_clean
|
69
|
+
end
|
70
|
+
|
71
|
+
desc "ruby_versions", "shows ruby versions in use"
|
72
|
+
def ruby_versions
|
73
|
+
Autowow::Features::Rbenv.ruby_versions
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "greet", "shows report of repos"
|
77
|
+
def greet
|
78
|
+
Autowow::Features::Vcs.greet
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "rubocop_parallel_autocorrect", "runs rubocop in parallel mode, autocorrects offenses on single thread"
|
82
|
+
def rubocop_parallel_autocorrect
|
83
|
+
Autowow::Features::Gem.rubocop_parallel_autocorrect
|
84
|
+
end
|
85
|
+
|
86
|
+
desc "exec", "runs command"
|
87
|
+
def exec(*cmd)
|
88
|
+
Autowow::Executor.pretty_with_output.run(cmd)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|