go_script 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: b90683b2a65d61e15558743c1108ebbd66d4cf1b
4
- data.tar.gz: ef2a0ce2405d4cb29093e2bbf0a76ce094943c15
3
+ metadata.gz: 7c361deaf94cf8438b4f9e1cc5385aa7ce62bac5
4
+ data.tar.gz: e8d6bfefa77c4b1a3079cde37023861b7058d065
5
5
  SHA512:
6
- metadata.gz: 68002898685507d633ed2c979a0521ffabee6e4be7accd62c7ea61ca5cb21f7fae522f033413e4fb02245932d406c72095d72ebdae8f6ae0c8b3a728b5fec07b
7
- data.tar.gz: 7cdb22cef865ef7e0e66992a952184021a617a65f11faa070c7874daf7a345ca22bc294c51579b1382983667a160469556ebaa08c80424c7401b02f3ad2e3d02
6
+ metadata.gz: 01eafdeee0fae80aadeb928d0b7b227163d014809a33e9307de6dd6d1e5bd06edd8945c3ca83b0eeb6115863a98de46049a52257ccec4b8ec2a7f037420151da
7
+ data.tar.gz: ff5dfb9e2fa1fdceee7ba38c2a8ea9c9e3fd5f773ed905a979828d3c5cb2b50706155c9c5cdb9c683d1b3135328f6cc6a335a830ad8919e78380bd938f87dd1c
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## The `./go` script: a unified development environment interface.
1
+ ## The `./go` script: a unified development environment interface
2
2
 
3
3
  A `./go` script aims to abstract away all of the steps needed to develop (and
4
4
  sometimes deploy) a software project. It is a replacement for READMEs and
@@ -3,58 +3,6 @@
3
3
 
4
4
  require_relative '../lib/go_script'
5
5
 
6
- puts <<END_OF_TEMPLATE
7
- #! /usr/bin/env ruby
8
-
9
- require 'English'
10
-
11
- Dir.chdir File.dirname(__FILE__)
12
-
13
- def try_command_and_restart(command)
14
- exit $CHILD_STATUS.exitstatus unless system command
15
- exec({ 'RUBYOPT' => nil }, RbConfig.ruby, *[$PROGRAM_NAME].concat(ARGV))
16
- end
17
-
18
- begin
19
- require 'bundler/setup' if File.exist? 'Gemfile'
20
- rescue LoadError
21
- try_command_and_restart 'gem install bundler'
22
- rescue SystemExit
23
- try_command_and_restart 'bundle install'
24
- end
25
-
26
- begin
27
- require 'go_script'
28
- rescue LoadError
29
- try_command_and_restart 'gem install go_script' unless File.exist? 'Gemfile'
30
- abort "Please add \\\"gem 'go_script'\\\" to your Gemfile"
31
- end
32
-
33
- extend GoScript
34
- check_ruby_version '#{RUBY_VERSION}'
35
-
36
- command_group :dev, 'Development commands'
37
-
38
- def_command :init, 'Set up the development environment' do
39
- end
40
-
41
- def_command :update_gems, 'Update Ruby gems' do |gems|
42
- update_gems gems
43
- end
44
-
45
- def_command :update_js, 'Update JavaScript components' do
46
- update_node_modules
47
- end
48
-
49
- def_command :test, 'Execute automated tests' do |args|
50
- exec_cmd "bundle exec rake test \#{args.join ' '}"
51
- end
52
-
53
- def_command :lint, 'Run style-checking tools' do |files|
54
- files = files.group_by { |f| File.extname f }
55
- lint_ruby files['.rb'] # uses rubocop
56
- lint_javascript Dir.pwd, files['.js'] # uses node_modules/jshint
57
- end
58
-
59
- execute_command ARGV
60
- END_OF_TEMPLATE
6
+ puts GoScript::Template.preamble
7
+ puts GoScript::Template.standard_dev_commands
8
+ puts GoScript::Template.end
data/lib/go_script.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # @author Mike Bland (michael.bland@gsa.gov)
2
2
 
3
3
  require_relative './go_script/go'
4
+ require_relative './go_script/template'
4
5
  require_relative './go_script/version'
data/lib/go_script/go.rb CHANGED
@@ -44,7 +44,7 @@ module GoScript
44
44
  { 'RUBYOPT' => nil }, cmd, err: :out)
45
45
  if $CHILD_STATUS.exitstatus.nil?
46
46
  $stderr.puts "could not run command: #{cmd}"
47
- $stderr.puts "(Check syslog for possible `Out of memory` error?)"
47
+ $stderr.puts '(Check syslog for possible `Out of memory` error?)'
48
48
  exit 1
49
49
  else
50
50
  exit $CHILD_STATUS.exitstatus unless status
@@ -64,8 +64,8 @@ module GoScript
64
64
  exec_cmd 'npm install'
65
65
  end
66
66
 
67
- JEKYLL_BUILD_CMD = 'bundle exec jekyll build --trace'
68
- JEKYLL_SERVE_CMD = 'bundle exec jekyll serve -w --trace'
67
+ JEKYLL_BUILD_CMD = 'jekyll build --trace'
68
+ JEKYLL_SERVE_CMD = 'jekyll serve -w --trace'
69
69
 
70
70
  def args_to_string(args)
71
71
  args ||= ''
@@ -90,10 +90,11 @@ module GoScript
90
90
  end
91
91
 
92
92
  def git_sync_and_deploy(commands, branch: nil)
93
- exec_cmd 'git stash'
94
- exec_cmd "git checkout -b #{branch}" unless branch.nil?
95
- exec_cmd 'git pull'
96
- exec_cmd 'bundle install' if File.exist? 'Gemfile'
93
+ exec_cmd 'git fetch origin #{branch}'
94
+ exec_cmd 'git clean -f'
95
+ exec_cmd "git reset --hard #{branch.nil? ? 'HEAD' : 'origin/' + branch}"
96
+ exec_cmd 'git submodule --sync --recursive'
97
+ exec_cmd 'git submodule update --init --recursive'
97
98
  commands.each { |command| exec_cmd command }
98
99
  end
99
100
 
@@ -0,0 +1,73 @@
1
+ module GoScript
2
+ class Template
3
+ # rubocop:disable MethodLength
4
+ def self.preamble
5
+ <<END_OF_PREAMBLE
6
+ #! /usr/bin/env ruby
7
+
8
+ require 'English'
9
+
10
+ Dir.chdir File.dirname(__FILE__)
11
+
12
+ def try_command_and_restart(command)
13
+ exit $CHILD_STATUS.exitstatus unless system command
14
+ exec({ 'RUBYOPT' => nil }, RbConfig.ruby, *[$PROGRAM_NAME].concat(ARGV))
15
+ end
16
+
17
+ begin
18
+ require 'bundler/setup' if File.exist? 'Gemfile'
19
+ rescue LoadError
20
+ try_command_and_restart 'gem install bundler'
21
+ rescue SystemExit
22
+ try_command_and_restart 'bundle install'
23
+ end
24
+
25
+ begin
26
+ require 'go_script'
27
+ rescue LoadError
28
+ try_command_and_restart 'gem install go_script' unless File.exist? 'Gemfile'
29
+ abort "Please add \\\"gem 'go_script'\\\" to your Gemfile"
30
+ end
31
+
32
+ extend GoScript
33
+ check_ruby_version '#{RUBY_VERSION}'
34
+
35
+ END_OF_PREAMBLE
36
+ end
37
+ # rubocop:enable MethodLength
38
+
39
+ # rubocop:disable MethodLength
40
+ def self.standard_dev_commands
41
+ <<END_STANDARD_DEV_COMMANDS
42
+ command_group :dev, 'Development commands'
43
+
44
+ def_command :init, 'Set up the development environment' do
45
+ end
46
+
47
+ def_command :update_gems, 'Update Ruby gems' do |gems|
48
+ update_gems gems
49
+ end
50
+
51
+ def_command :update_js, 'Update JavaScript components' do
52
+ update_node_modules
53
+ end
54
+
55
+ def_command :test, 'Execute automated tests' do |args|
56
+ exec_cmd "bundle exec rake test \#{args.join ' '}"
57
+ end
58
+
59
+ 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
63
+ end
64
+
65
+ END_STANDARD_DEV_COMMANDS
66
+ end
67
+ # rubocop:enable MethodLength
68
+
69
+ def self.end
70
+ "execute_command ARGV\n"
71
+ end
72
+ end
73
+ end
@@ -1,7 +1,7 @@
1
1
  # @author Mike Bland (michael.bland@gsa.gov)
2
2
 
3
3
  module GoScript
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
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.6
4
+ version: 0.1.7
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-01-08 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: jekyll
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Abstracts common functionality used in the `./go` scripts of several
112
126
  18F projects, and provides a `./go` script generator for new projects.
113
127
  email:
@@ -124,6 +138,7 @@ files:
124
138
  - lib/go_script.rb
125
139
  - lib/go_script/command_group.rb
126
140
  - lib/go_script/go.rb
141
+ - lib/go_script/template.rb
127
142
  - lib/go_script/version.rb
128
143
  homepage: https://github.com/18F/go_script
129
144
  licenses:
@@ -145,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
160
  version: '0'
146
161
  requirements: []
147
162
  rubyforge_project:
148
- rubygems_version: 2.4.5.1
163
+ rubygems_version: 2.5.1
149
164
  signing_key:
150
165
  specification_version: 4
151
166
  summary: "./go script: a unified development environment interface"