Created
April 30, 2015 09:10
-
-
Save vcostin/316145158428479279ac to your computer and use it in GitHub Desktop.
openproject plugin file generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# url_content_iterate.rb | |
require 'open-uri' | |
#https://gist.github.com/myabc/7905820e99914c2acdf8#file-list-of-plugins | |
REMOTE_URL = 'https://gist.githubusercontent.com/myabc/7905820e99914c2acdf8/raw/4b0f8da8ff8462c824f155b1b3f04ed36ff8e661/List%20of%20plugins' | |
LOCAL_FILE = './plugin_list.txt' | |
LOCAL_PLUGIN_GENERATOR = 'plugin_generator.plugin' | |
PLUGIN_BRANCH = 'release/4.1' | |
# string template | |
plugin_file = "PLUGIN_BRANCH = '#{PLUGIN_BRANCH}' # your topic branch \n" | |
plugin_file += "\n" | |
plugin_file += "group :opf_plugins do \n" | |
open(REMOTE_URL, 'rb') do |read_file| | |
read_file.each_line do |line| | |
# puts line | |
line = line.delete("\n") | |
plugin_file +=" gem '#{line}', git: '[email protected]:finnlabs/#{line}', branch: PLUGIN_BRANCH \n" | |
end | |
end | |
plugin_file += "end \n" | |
def write_string_to_file(file_name = LOCAL_PLUGIN_GENERATOR, string_content = '') | |
File.open(file_name, 'wb') do |plugin_generator_file| | |
plugin_generator_file.write(string_content) | |
end | |
end | |
write_string_to_file(LOCAL_PLUGIN_GENERATOR, plugin_file) | |
puts 'done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment