eac_launcher 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: bfab18d25ccc74782d398e43ed9598d76ffe4774
4
- data.tar.gz: 4e4a2a2c3061ced8aee0666e4b1c79bdb9e3f7de
3
+ metadata.gz: d9fb76da2d6b0eac4f82442cce2b34da22a3da89
4
+ data.tar.gz: 97646bf8c08b58bd6370bdd3b8df96c088bf15bc
5
5
  SHA512:
6
- metadata.gz: d4cce84cdd2e61a1bae63e7e993995b7738428a3cdb244c63fa4ebfcf5997a8341c068a8e0a9510ad655ea169e2f2d869d8359094f589e90838a5585c166a71d
7
- data.tar.gz: d30d3f55b45afb09a9eb37023a5043a7af098fbf59cfbc1ab1f57a9ce0f53ceb334861eb10a740f33b2a1faa3166ecf12b2b14d77f9feb4c8b6883c2c3d3ab6e
6
+ metadata.gz: a84f54221b8c79f7a64d358f8d86ce667d022f8de5fcfae06b505fb243963891c1d711cff5b0b66d8d1cb36ea27bec736e48fbc76117234efb1acd74a7d72875
7
+ data.tar.gz: 8c022f63cc330882484d8638921d82c42a61d920068cbd4865319d2b63e346a0fcae8da244aaf390692f2c995ded283a85c8bbbc4bb36b97583a46f9e4ba4daa
data/README.rdoc CHANGED
@@ -1,3 +1,15 @@
1
1
  = E.A.C. Launcher
2
+ {<img src="https://badge.fury.io/rb/eac_launcher.svg" alt="Gem Version" />
3
+ }[https://badge.fury.io/rb/eac_launcher]
4
+ {<img src="https://travis-ci.org/eduardobogoni/eac_launcher.svg?branch=master" alt="Build Status" />
5
+ }[https://travis-ci.org/eduardobogoni/eac_launcher]
6
+ {<img src="https://api.codeclimate.com/v1/badges/261ff5dcb535b743f468/maintainability" />
7
+ }[https://codeclimate.com/github/eduardobogoni/eac_launcher/maintainability]
8
+ {<img src="https://api.codeclimate.com/v1/badges/261ff5dcb535b743f468/test_coverage" />
9
+ }[https://codeclimate.com/github/eduardobogoni/eac_launcher/test_coverage]
10
+ {<img src="https://beta.gemnasium.com/badges/github.com/eduardobogoni/eac_launcher.svg"
11
+ alt="Dependency Status" />}[https://beta.gemnasium.com/projects/github.com/eduardobogoni/eac_launcher]
12
+ {<img src="http://inch-ci.org/github/eduardobogoni/eac_launcher.svg?branch=master" alt="Inline docs" />
13
+ }[http://inch-ci.org/github/eduardobogoni/eac_launcher]
2
14
 
3
15
  Utilities to deploy applications and libraries.
@@ -2,35 +2,51 @@ module EacLauncher
2
2
  class Context
3
3
  include ::Eac::SimpleCache
4
4
 
5
+ DEFAULT_PROJECTS_ROOT = '.'.freeze
6
+ DEFAULT_SETTINGS_FILE = ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
7
+ DEFAULT_CACHE_ROOT = ::File.join(ENV['HOME'], '.cache', 'eac_launcher')
8
+
5
9
  class << self
10
+ attr_writer :current
11
+
6
12
  def current
7
- default
13
+ @current ||= default
8
14
  end
9
15
 
10
16
  def default
11
- @default ||= Context.new(
12
- ENV['EAC_LAUNCHER_PROJECTS_ROOT'] || '.',
13
- ENV['EAC_LAUNCHER_SETTINGS_FILE'] ||
14
- ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
15
- )
17
+ @default ||= Context.new
16
18
  end
17
19
  end
18
20
 
19
- attr_reader :root, :settings
21
+ attr_reader :root, :settings, :cache_root
20
22
  attr_accessor :publish_options
21
23
 
22
- def initialize(projects_root, settings_file)
23
- @root = ::EacLauncher::Instances::Base.new(projects_root, nil)
24
- @settings = ::EacLauncher::Context::Settings.new(settings_file)
24
+ def initialize(options = {})
25
+ @options = options.with_indifferent_access
26
+ @root = ::EacLauncher::Instances::Base.new(build_option(:projects_root), nil)
27
+ @settings = ::EacLauncher::Context::Settings.new(build_option(:settings_file))
28
+ @cache_root = build_option(:cache_root)
25
29
  @publish_options = { new: false, confirm: false, stereotype: nil }
26
30
  end
27
31
 
28
- def cache_root
29
- File.join(ENV['HOME'], '.cache', 'cli-utils', 'dev')
32
+ def instance(to_root_path)
33
+ instances.find { |i| i.to_root_path == to_root_path }
30
34
  end
31
35
 
32
36
  private
33
37
 
38
+ def build_option(key)
39
+ @options[key] || env_option(key) || default_option(key)
40
+ end
41
+
42
+ def env_option(key)
43
+ ENV["EAC_LAUNCHER_#{key}".underscore.upcase]
44
+ end
45
+
46
+ def default_option(key)
47
+ self.class.const_get("DEFAULT_#{key}".underscore.upcase)
48
+ end
49
+
34
50
  def projects_uncached
35
51
  r = {}
36
52
  instances.each do |i|
@@ -63,8 +63,7 @@ module EacLauncher
63
63
  stereotypes.each do |s|
64
64
  return s.warp_class.new(self) if s.warp_class
65
65
  end
66
- raise ::EacLauncher::Instances::Error, "None stereotype of \"#{to_root_path}\" has " \
67
- "subclass \"CurrentCache\" (#{stereotypes.join(', ')})"
66
+ self
68
67
  end
69
68
 
70
69
  private
@@ -99,7 +98,7 @@ module EacLauncher
99
98
 
100
99
  def scan_subdirectories(path)
101
100
  Dir.entries(path).each do |basename|
102
- next if basename == '.' || basename == '..'
101
+ next if %w[. ..].include?(basename)
103
102
  sp = path.subpath(basename)
104
103
  next unless File.directory?(sp)
105
104
  yield(sp)
@@ -21,11 +21,12 @@ module EacLauncher
21
21
  return if builded?
22
22
  copy_gem_files
23
23
  build_gem
24
- check_gem
24
+ check_gem_empty_size
25
+ check_gem_version
25
26
  end
26
27
 
27
28
  def close
28
- ::FileUtils.remove_entry(@gem_root) if ::File.directory?(@gem_root)
29
+ ::FileUtils.remove_entry(@gem_root) if @gem_root && ::File.directory?(@gem_root)
29
30
  @gem_root = nil
30
31
  end
31
32
 
@@ -40,11 +41,19 @@ module EacLauncher
40
41
  info("Building gemspec #{gemspec_file}...")
41
42
  clear_gems
42
43
  Dir.chdir @gem_root do
43
- EacRubyUtils::Envs.local.command('gem', 'build', gemspec_file).execute!
44
+ isolated_build_gem
44
45
  end
45
46
  end
46
47
 
47
- def check_gem
48
+ def isolated_build_gem
49
+ old_bundle_gemfile = ENV['BUNDLE_GEMFILE']
50
+ ENV['BUNDLE_GEMFILE'] = nil
51
+ EacRubyUtils::Envs.local.command('gem', 'build', gemspec_file).execute!
52
+ ensure
53
+ ENV['BUNDLE_GEMFILE'] = old_bundle_gemfile
54
+ end
55
+
56
+ def check_gem_empty_size
48
57
  Dir.mktmpdir do |dir|
49
58
  Dir.chdir dir do
50
59
  EacRubyUtils::Envs.local.command('gem', 'unpack', gem).system
@@ -69,6 +78,12 @@ module EacLauncher
69
78
  def gem
70
79
  @gem_root.find_file_with_extension('.gem')
71
80
  end
81
+
82
+ def check_gem_version
83
+ spec = ::EacLauncher::Ruby::Gem::Specification.new(gemspec_file)
84
+ return if ::File.basename(output_file, '.gem') == spec.full_name
85
+ raise("Builded gem is not the same version of gemspec (#{spec}, #{output_file})")
86
+ end
72
87
  end
73
88
  end
74
89
  end
@@ -30,6 +30,10 @@ module EacLauncher
30
30
  "#{name}-#{version}"
31
31
  end
32
32
 
33
+ def to_s
34
+ full_name
35
+ end
36
+
33
37
  private
34
38
 
35
39
  def gem_root
@@ -57,6 +57,7 @@ module EacLauncher
57
57
  end
58
58
 
59
59
  def fetch
60
+ parent_cache_git.execute!('subrepo', 'clean', subrepo_subdir)
60
61
  parent_cache_git.execute!('subrepo', 'fetch', subrepo_subdir)
61
62
  end
62
63
 
@@ -39,7 +39,7 @@ module EacLauncher
39
39
  end
40
40
 
41
41
  def publish
42
- gem_build.open
42
+ gem_build.build
43
43
  push_gem
44
44
  ensure
45
45
  gem_build.close
@@ -66,12 +66,12 @@ module EacLauncher
66
66
 
67
67
  def push_gem
68
68
  info("Pushing gem #{gem_spec}...")
69
- if ::EacLauncher::Context.current.publish_options[:confirm]
70
- EacRubyUtils::Envs.local.command('gem', 'push', gem).system
71
- info('Pushed!')
72
- else
73
- warn('Not pushed because not confirmed')
69
+ command = ['gem', 'push', gem_build.output_file]
70
+ unless ::EacLauncher::Context.current.publish_options[:confirm]
71
+ command = %w[echo] + command + %w[(Dry-run)]
74
72
  end
73
+ EacRubyUtils::Envs.local.command(command).system
74
+ info('Pushed!')
75
75
  end
76
76
 
77
77
  def gemspec_uncached
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacLauncher
4
- VERSION = '0.1.3'.freeze
4
+ VERSION = '0.1.5'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-09 00:00:00.000000000 Z
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -126,14 +126,14 @@ dependencies:
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: 0.48.1
129
+ version: 0.49.1
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: 0.48.1
136
+ version: 0.49.1
137
137
  description:
138
138
  email:
139
139
  executables: