Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Merge 8b35a2f into 0f6cce6
Browse files Browse the repository at this point in the history
  • Loading branch information
nathankleyn committed Sep 25, 2015
2 parents 0f6cce6 + 8b35a2f commit 9accdce
Show file tree
Hide file tree
Showing 44 changed files with 723 additions and 398 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.gem
coverage
.shanty
Gemfile.lock
8 changes: 8 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ LineLength:
# problem.
ModuleFunction:
Enabled: False

# FIXME: Only enabling because we are using the singleton pattern still for the
# Env and TaskEnv classes and they store memoized values that need to be
# preserved even after mixing in. Without class vars, this does not work. We
# plan to refactor these singletons out and into class instances that are passed
# around instead as needed.
ClassVars:
Enabled: False
19 changes: 16 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
sudo: false
language: ruby
rvm:
- 2.2.0
notifications:
webhooks: https://hubot-shantytown.rhcloud.com/hubot/travis?room=#shantytow n
- 2.2.3

# We have to install Rust manually, as Travis does not yet allow multiligual
# builds. We install the latest stable Rust build.
before_install:
- mkdir ~/rust-installer
- curl -sL https://static.rust-lang.org/rustup.sh -o ~/rust-installer/rustup.sh
- sh ~/rust-installer/rustup.sh --prefix=~/rust --spec=stable -y --disable-sudo 2> /dev/null
- export PATH=~/rust/bin:$PATH
- export LD_LIBRARY_PATH=~/rust/lib:$LD_LIBRARY_PATH
- rustc --version
- cargo --version
script: bundle exec ./bin/shanty --trace test

notifications:
webhooks: https://hubot-shantytown.rhcloud.com/hubot/travis?room=#shantytown
88 changes: 55 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,112 @@ PATH
shanty (0.3.0)
acts_as_graph_vertex (~> 1.0)
algorithms (~> 0.6)
attr_combined_accessor (~> 1.0)
call_me_ruby (~> 1.0)
bundler (~> 1.10)
call_me_ruby (~> 1.1)
commander (~> 4.3)
gitignore_rb (~> 0.2.2)
i18n (~> 0.7)
shenanigans (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
acts_as_graph_vertex (1.0.0)
algorithms (0.6.1)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
attr_combined_accessor (1.0.0)
byebug (4.0.5)
ast (2.1.0)
astrolabe (1.3.1)
parser (~> 2.2)
builder (3.2.2)
byebug (5.0.0)
columnize (= 0.9.0)
call_me_ruby (1.0.2)
call_me_ruby (1.1.1)
coderay (1.1.0)
columnize (0.9.0)
commander (4.3.4)
commander (4.3.5)
highline (~> 1.7.2)
coveralls (0.8.1)
coveralls (0.8.2)
json (~> 1.8)
rest-client (>= 1.6.8, < 2)
simplecov (~> 0.10.0)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
cucumber (2.1.0)
builder (>= 2.1.2)
cucumber-core (~> 1.3.0)
diff-lcs (>= 1.1.3)
gherkin3 (~> 3.1.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (1.3.0)
gherkin3 (~> 3.1.0)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
filewatcher (0.5.1)
ffi (1.9.10)
filewatcher (0.5.2)
trollop (~> 2.0)
highline (1.7.2)
gherkin3 (3.1.1)
gitignore_rb (0.2.4)
ffi (~> 1.9)
highline (1.7.7)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.7.0)
json (1.8.2)
json (1.8.3)
method_source (0.8.2)
mime-types (2.6.1)
mime-types (2.6.2)
multi_json (1.11.2)
multi_test (0.1.2)
netrc (0.10.3)
parser (2.2.2.5)
parser (2.2.2.6)
ast (>= 1.1, < 3.0)
powerpack (0.1.1)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.1.0)
byebug (~> 4.0)
pry-byebug (3.2.0)
byebug (~> 5.0)
pry (~> 0.10)
rainbow (2.0.0)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
rspec-support (~> 3.3.0)
rspec-mocks (3.3.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubocop (0.31.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
rubocop (0.34.2)
astrolabe (~> 1.3)
parser (>= 2.2.2.1, < 3.0)
parser (>= 2.2.2.5, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
rubocop-rspec (1.3.0)
rubocop-rspec (1.3.1)
ruby-prof (0.15.8)
ruby-progressbar (1.7.5)
shenanigans (1.0.11)
simplecov (0.10.0)
docile (~> 1.1.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
term-ansicolor (1.3.0)
term-ansicolor (1.3.2)
tins (~> 1.0)
thor (0.19.1)
tins (1.5.2)
tins (1.6.0)
trollop (2.1.2)
unf (0.1.4)
unf_ext
Expand All @@ -102,10 +120,14 @@ PLATFORMS

DEPENDENCIES
coveralls (~> 0.8)
cucumber (~> 2.1)
filewatcher (~> 0.5)
pry-byebug (~> 3.1)
rspec (~> 3.2)
rubocop (~> 0.31)
rubocop-rspec (~> 1.3)
ruby-prof (~> 0.15)
shanty!

BUNDLED WITH
1.10.6
1 change: 0 additions & 1 deletion examples/test-static-project-2/Shantyfile

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions examples/test-static-project/Shantyfile

This file was deleted.

File renamed without changes.
46 changes: 29 additions & 17 deletions lib/shanty/env.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require 'i18n'
require 'logger'
require 'pathname'
require 'yaml'

require 'shanty/project_tree'

module Shanty
#
module Env
Expand All @@ -10,12 +13,17 @@ module Env

CONFIG_FILE = '.shanty.yml'

# This must be defined first due to being a class var that isn't first
# first accessed with ||=.
@@config = nil

def clear!
@logger = nil
@environment = nil
@build_number = nil
@root = nil
@config = nil
@@logger = nil
@@environment = nil
@@build_number = nil
@@root = nil
@@config = nil
@@project_tree = nil
end

def require!
Expand All @@ -27,26 +35,34 @@ def require!
end

def logger
@logger ||= Logger.new(STDOUT)
@@logger ||= Logger.new(STDOUT).tap do |logger|
logger.formatter = proc do |_, datetime, _, msg|
"#{datetime}: #{msg}\n"
end
end
end

def environment
@environment ||= ENV['SHANTY_ENV'] || 'local'
@@environment ||= ENV['SHANTY_ENV'] || 'local'
end

def build_number
@build_number ||= (ENV['SHANTY_BUILD_NUMBER'] || 1).to_i
@@build_number ||= (ENV['SHANTY_BUILD_NUMBER'] || 1).to_i
end

def root
@root ||= find_root
@@root ||= find_root
end

def project_tree
@@project_tree ||= ProjectTree.new(root)
end

def config
return @config unless @config.nil?
return @config = {} unless File.exist?(config_path)
return @@config unless @@config.nil?
return @@config = {} unless File.exist?(config_path)
config = YAML.load_file(config_path) || {}
@config = config[environment] || {}
@@config = config[environment] || {}
end

private
Expand All @@ -66,11 +82,7 @@ def config_path
end

def find_root
if root_dir.nil?
fail "Could not find a #{CONFIG_FILE} file in this or any parent directories. \
Please run `shanty init` in the directory you want to be the root of your project structure."
end

fail I18n.t('missing_root', config_file: CONFIG_FILE) if root_dir.nil?
root_dir
end

Expand Down
9 changes: 5 additions & 4 deletions lib/shanty/graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class Graph
extend Forwardable
include Enumerable

def_delegators :@projects, :<<, :empty?, :length, :each, :values, :[], :inspect, :to_s
def_delegators :@projects, :<<, :empty?, :length, :each, :values, :[],
:inspect, :to_s

# Public: Initialise a Graph.
#
# project_path_trie -
# projects - An array of projects to use. These are expected to be pre-sorted and linked via the ProjectLinker.
# projects - An array of projects to use. These are expected to be
# pre-sorted and linked via the ProjectLinker.
def initialize(project_path_trie, projects)
@project_path_trie = project_path_trie
@projects = projects
Expand All @@ -41,8 +43,7 @@ def by_name(name)
def all_with_tags(*tags)
return [] if tags.empty?
select do |project|
project_tags = project.tags.map(&:to_sym)
tags.map(&:to_sym).all? { |tag| project_tags.include?(tag) }
tags.map(&:to_sym).all? { |tag| project.all_tags.include?(tag) }
end
end

Expand Down
Loading

0 comments on commit 9accdce

Please sign in to comment.