go_script 0.1.7 → 0.1.8

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: 7c361deaf94cf8438b4f9e1cc5385aa7ce62bac5
4
- data.tar.gz: e8d6bfefa77c4b1a3079cde37023861b7058d065
3
+ metadata.gz: 18b0d506e2ad5b11139f95c535b36c8ed1850fa0
4
+ data.tar.gz: 83a989383def34f255f8ee3561f38bf7786401d0
5
5
  SHA512:
6
- metadata.gz: 01eafdeee0fae80aadeb928d0b7b227163d014809a33e9307de6dd6d1e5bd06edd8945c3ca83b0eeb6115863a98de46049a52257ccec4b8ec2a7f037420151da
7
- data.tar.gz: ff5dfb9e2fa1fdceee7ba38c2a8ea9c9e3fd5f773ed905a979828d3c5cb2b50706155c9c5cdb9c683d1b3135328f6cc6a335a830ad8919e78380bd938f87dd1c
6
+ metadata.gz: 87bd1fb4fc214ec4ea9d4633b3a426d855760e6ee5d55928ca7c6b4ba8b21c72e864d325dbdd608136f1ba08d5b60f605e17ebfe93c5e68de92def202358d134
7
+ data.tar.gz: 428815e269a17b160a839f48d70e6d681508ac0246c87252f2b57a31c1fb0a6cfb4340a24c626e19e604c4a6f823e3f659ced64c449c2a1207d22e0db15ccdb0
@@ -40,8 +40,7 @@ module GoScript
40
40
  end
41
41
 
42
42
  def exec_cmd(cmd)
43
- status = system(
44
- { 'RUBYOPT' => nil }, cmd, err: :out)
43
+ status = system(cmd, err: :out)
45
44
  if $CHILD_STATUS.exitstatus.nil?
46
45
  $stderr.puts "could not run command: #{cmd}"
47
46
  $stderr.puts '(Check syslog for possible `Out of memory` error?)'
@@ -99,11 +98,11 @@ module GoScript
99
98
  end
100
99
 
101
100
  def lint_ruby(files)
102
- exec_cmd "bundle exec rubocop #{file_args_by_extension files, '.rb'}"
101
+ exec_cmd "rubocop #{file_args_by_extension files, '.rb'}"
103
102
  end
104
103
 
105
104
  def lint_javascript(basedir, files)
106
105
  files = file_args_by_extension files, '.js'
107
- exec_cmd "#{basedir}/node_modules/jshint/bin/jshint #{files}"
106
+ exec_cmd "#{basedir}/node_modules/.bin/eslint #{files}"
108
107
  end
109
108
  end
@@ -1,17 +1,37 @@
1
+ require_relative './version'
2
+
1
3
  module GoScript
2
4
  class Template
3
5
  # rubocop:disable MethodLength
4
6
  def self.preamble
5
7
  <<END_OF_PREAMBLE
6
8
  #! /usr/bin/env ruby
9
+ #
10
+ # The preamble down to the check_ruby_version line was generated by version
11
+ # #{VERSION} of the go_script gem. This preamble tries to load bundler state
12
+ # from Gemfile.lock if present, then the go_script gem for core functionality.
13
+ #
14
+ # This means the ./go script will run `gem install` or `bundle install` as
15
+ # necessary when invoked for the first time, or when dependencies change. It
16
+ # also means that commands invoked within the ./go script do not need to be
17
+ # prefixed with `bundle exec`.
7
18
 
8
19
  require 'English'
9
20
 
10
21
  Dir.chdir File.dirname(__FILE__)
11
22
 
23
+ # If a require statement fails, the script calls try_command_and_restart to
24
+ # try to install the necessary gems before re-executing itself with the
25
+ # original arguments.
12
26
  def try_command_and_restart(command)
13
27
  exit $CHILD_STATUS.exitstatus unless system command
14
- exec({ 'RUBYOPT' => nil }, RbConfig.ruby, *[$PROGRAM_NAME].concat(ARGV))
28
+
29
+ # If the RUBYOPT environment variable is set, bundler will presume that it
30
+ # has already run. Hence, filtering out RUBYOPT forces bundler to load its
31
+ # state during the re-execution.
32
+ env = {}.merge(ENV)
33
+ env.delete('RUBYOPT')
34
+ exec(env, RbConfig.ruby, *[$PROGRAM_NAME].concat(ARGV))
15
35
  end
16
36
 
17
37
  begin
@@ -53,13 +73,12 @@ def_command :update_js, 'Update JavaScript components' do
53
73
  end
54
74
 
55
75
  def_command :test, 'Execute automated tests' do |args|
56
- exec_cmd "bundle exec rake test \#{args.join ' '}"
76
+ exec_cmd "rake test \#{args_to_string args}"
57
77
  end
58
78
 
59
79
  def_command :lint, 'Run style-checking tools' do |files|
60
- files = files.group_by { |f| File.extname f }
61
- lint_ruby files['.rb'] # uses rubocop
62
- lint_javascript Dir.pwd, files['.js'] # uses node_modules/jshint
80
+ lint_ruby files # uses rubocop
81
+ lint_javascript Dir.pwd, files # uses node_modules/eslint
63
82
  end
64
83
 
65
84
  END_STANDARD_DEV_COMMANDS
@@ -1,7 +1,7 @@
1
1
  # @author Mike Bland (michael.bland@gsa.gov)
2
2
 
3
3
  module GoScript
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
 
6
6
  class Version
7
7
  def self.check_ruby_version(min_version)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guides_style_18f
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: Abstracts common functionality used in the `./go` scripts of several
126
140
  18F projects, and provides a `./go` script generator for new projects.
127
141
  email: