rails-lineman 0.0.1 → 0.0.2
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 +4 -4
- data/lib/rails_lineman/lineman_doer.rb +25 -0
- data/lib/rails_lineman/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c8113d485ea10ec81911a937c61c491b3b5f93c
|
4
|
+
data.tar.gz: a9cf0710d4a806f87fe12af899e9bf03cf004968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e15c3476e16b121dd3c60b54d1a60995f69972ab3ee6fa1c6c4d004f4c7c668d3e87c689b56abf8ac07bdc52e101183adcc2c0f523bfd3329308ad67687fc6
|
7
|
+
data.tar.gz: 04e4477818e3e1543deab05e42617476bb6104968341399b9d927d510b910ab4911b4ca1e343655c21d030746a315a28fd32a3ecff6e465266238359ac70a6a3
|
@@ -13,8 +13,10 @@ module RailsLineman
|
|
13
13
|
def build
|
14
14
|
absolutify_lineman_path
|
15
15
|
chdir @lineman_project_location do
|
16
|
+
install_node_js_on_heroku
|
16
17
|
run_npm_install
|
17
18
|
run_lineman_build
|
19
|
+
delete_node_js_from_heroku
|
18
20
|
end
|
19
21
|
copy_javascripts
|
20
22
|
add_javascripts_to_precompile_list
|
@@ -52,6 +54,25 @@ module RailsLineman
|
|
52
54
|
Dir.chdir(og_dir)
|
53
55
|
end
|
54
56
|
|
57
|
+
def install_node_js_on_heroku
|
58
|
+
if heroku?
|
59
|
+
puts "It looks like we're on heroku, so let's install Node.js"
|
60
|
+
system <<-BASH
|
61
|
+
node_version=$(curl --silent --get https://semver.io/node/resolve)
|
62
|
+
node_url="http://s3pository.heroku.com/node/v$node_version/node-v$node_version-linux-x64.tar.gz"
|
63
|
+
curl "$node_url" -s -o - | tar xzf - -C .
|
64
|
+
mv node-v$node_version-linux-x64 heroku_node_install
|
65
|
+
chmod +x heroku_node_install/bin/*
|
66
|
+
export PATH="$PATH:$(pwd)/heroku_node_install/bin"
|
67
|
+
BASH
|
68
|
+
ENV['PATH'] += ":#{Dir.pwd}/heroku_node_install/bin"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def heroku?
|
73
|
+
ENV['DYNO'] && ENV['STACK']
|
74
|
+
end
|
75
|
+
|
55
76
|
def run_npm_install
|
56
77
|
return if system "npm install"
|
57
78
|
raise <<-ERROR
|
@@ -81,6 +102,10 @@ module RailsLineman
|
|
81
102
|
ERROR
|
82
103
|
end
|
83
104
|
|
105
|
+
def delete_node_js_from_heroku
|
106
|
+
system "rm -rf heroku_node_install" if heroku?
|
107
|
+
end
|
108
|
+
|
84
109
|
def copy_javascripts
|
85
110
|
FileUtils.cp_r(File.join(@lineman_project_location, "dist", "js"), @javascripts_destination)
|
86
111
|
end
|